Hi John,
I am presenting on the topic Firefox OS. I need your help to develope some slides for
"Thread Scheduling"in 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