Re: Booting to the Web
Hi, As far as I remember, thread scheduling in Firefox OS is handled by the Linux kernel, so if you are looking for documentation, you should probably look in that direction. Cheers, David On 11/12/13 6:14 AM, saurabhlnt...@gmail.com wrote: Hi.. I am presenting on the topic Firefox OS. I need your help to develope some slides for Thread Schedulingin firefox OS. I am not able to find out any data regrading thread scheduling. Kindly help. ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform -- David Rajchenbach-Teller, PhD Performance Team, Mozilla ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Booting to the Web
Hi, There is nothing special about FFOS thread scheduling that I'm aware of. Threads are implemented by the underlying Linux kernel and are scheduled by the kernel itself. We use an Android kernel, so thread scheduling on FFOS is affected by wake locks. I don't know if we use cgroups* or nice levels for fine-tuning scheduling behavior. We don't have RT scheduling, etc. The b2g process, which is our main executable, contains a main thread that is always ready for running (i.e., it's guaranteed to make forward progress). And b2g uses a number of threads for off-loading long-running tasks. These threads are scheduled when there is work for them to do, but might also sleep; it depends on the thread's purpose. Best regards Thomas * /sys/fs/cgroup is empty, so probably not On 12.11.2013 06:14, saurabhlnt...@gmail.com wrote: Hi.. I am presenting on the topic Firefox OS. I need your help to develope some slides for Thread Schedulingin firefox OS. I am not able to find out any data regrading thread scheduling. Kindly help. ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Booting to the Web
Hi John, I am presenting on the topic Firefox OS. I need your help to develope some slides for Thread Schedulingin firefox OS. I am not able to find out any data regrading thread scheduling. Kindly help. as Thomas already mentioned FxOS uses the regular Linux scheduler for handling threads; this includes the main thread of each application as well as DOM workers and other helper threads. Currently we adjust nice values to prioritize process and thread execution. Depending on the status of a process we assign it a different nice level. We've currently got 7 levels: MASTER - nice 0, used for the main b2g process FOREGROUND_HIGH - nice 0, used for processes holding a CPU wakelock FOREGROUND - nice 1, used for foreground processes FOREGROUND_KEYBOARD - nice 1, used for the keyboard app BACKGROUND_PERCEIVABLE - nice 7, used for background processes playing audio BACKGROUND_HOMESCREEN - nice 18, used for the homescreen app BACKGROUND - nice 18, used for all other background apps As you can see some levels share the same nice values, that's because those levels currently differ in the way they're treated by the out-of-memory killer. All those values can be adjusted at build time via preferences, you can find those here: http://hg.mozilla.org/mozilla-central/file/54e8c6492dc4/b2g/app/b2g.js#l610 Within a process the main thread receives the nice value of the process whilst DOM worker threads receive a nice value that is one point higher than the main thread (thus they run at a lower priority than the main thread). If you're interested how process priorities are handled you can find the relevant code here: http://hg.mozilla.org/mozilla-central/file/54e8c6492dc4/hal/HalTypes.h#l79 http://hg.mozilla.org/mozilla-central/file/54e8c6492dc4/dom/ipc/ProcessPriorityManager.h http://hg.mozilla.org/mozilla-central/file/54e8c6492dc4/dom/ipc/ProcessPriorityManager.cpp We don't use cgroups as Thomas mentioned because we found them to be hopelessly broken on certain kernels and we couldn't rely on them for a solid implementation. Being one of the persons who wrote this code I should really be doing a write-up of this in our Firefox OS architecture page but I didn't have enough time for it yet :-| Gabriele ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
Re: Booting to the Web
On 11/12/2013 10:27 AM, Gabriele Svelto wrote: Being one of the persons who wrote this code I should really be doing a write-up of this in our Firefox OS architecture page but I didn't have enough time for it yet :-| I was actually thinking while reading your mail that it was a great write up and should be on the page. :-) I took the liberty of adding it here: https://wiki.mozilla.org/B2G/Architecture#Threading Hope you don't mind. Thanks! Ben ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform