How CFS work in Android? Difference from Linux

1,632 views
Skip to first unread message

Deborah

unread,
Mar 16, 2012, 9:38:57 AM3/16/12
to Android Linux Kernel Development
I am trying to get a better understanding on ANDROID CFS. I have some
doubt on scheduler's behavior.
The difference between Android scheduler and Linux scheduler
Scheduler
— 5 files — The Android kernel also contains slight changes to the
CPU
process scheduler and time-keeping algorithms. We don’t know the
history of these changes, and the impact was not evident based on a
cursory examination.
Do you know which are this files?
If I understand, Process.THREAD_PRIORITY_DEFAULT or
Process.THREAD_PRIORITY_BACKGROUND are 'nice' value. How does Android
convert 'nice' value in 'timeslice'?
What is the initial value of 'virtual runtime' in Android and how to
calculate?
In Android, is 'cgroups' use to define scheduling classes? The
following application states: (i) Foreground process - Critical
priority; (ii) Visible process and Service process - High priority;
(iii) Background process and Empty process - Low priority; are three
scheduling classes ?
Thanks in advance,
Deborah

Glenn Kasten

unread,
Mar 19, 2012, 11:21:27 AM3/19/12
to android...@googlegroups.com
Threads voluntarily assign themselves a nice priority within the permitted range, and activity manager assigns threads of an app process to an appropriate cpuctl cgroup. 

Deborah

unread,
Mar 19, 2012, 1:22:20 PM3/19/12
to Android Linux Kernel Development
Glenn thanks for your reply! I'm really confused. Could you explain
how the CFS work?
Does it divide the CPU time into epochs?
In a single epoch, has every process a specified time quantum that is
computed at the beginning of each epoch?
If yes, is 'virtual runtime' set to zero in each epoch or is it an
approximated average?
Help please!!! :(

Glenn Kasten

unread,
Mar 19, 2012, 9:43:20 PM3/19/12
to android...@googlegroups.com
I'm sorry but generic Linux is beyond the scope of this group. I suggest doing a web search for the specific topics you're interested in.  However, here are a few links to help you get started:

Deborah

unread,
Mar 20, 2012, 8:46:21 AM3/20/12
to Android Linux Kernel Development
Thanks, but maybe the only solution is to read the source code!!!
Regards,
Deborah

On Mar 20, 2:43 am, Glenn Kasten <gkas...@android.com> wrote:
> I'm sorry but generic Linux is beyond the scope of this group. I suggest
> doing a web search for the specific topics you're interested in.  However,
> here are a few links to help you get started:
>  http://en.wikipedia.org/wiki/Completely_Fair_Scheduler
>  http://www.ibm.com/developerworks/linux/library/l-completely-fair-sch...

San Mehat

unread,
Mar 20, 2012, 9:35:02 AM3/20/12
to android...@googlegroups.com
On Tue, Mar 20, 2012 at 5:46 AM, Deborah <falcone...@gmail.com> wrote:
Thanks, but maybe the only solution is to read the source code!!!

Careful you don't fall in...
 



--
San Mehat | Staff Software Engineer | s...@google.com | 415-366-6172

David Ahern

unread,
Mar 19, 2012, 1:32:53 PM3/19/12
to Deborah, android...@googlegroups.com
On 3/19/12 11:22 AM, Deborah wrote:
> Glenn thanks for your reply! I'm really confused. Could you explain
> how the CFS work?
> Does it divide the CPU time into epochs?
> In a single epoch, has every process a specified time quantum that is
> computed at the beginning of each epoch?
> If yes, is 'virtual runtime' set to zero in each epoch or is it an
> approximated average?
> Help please!!! :(

One of the better explanations of CFS:
http://lwn.net/Articles/404993/

David

Tsai Gaggery

unread,
Mar 19, 2012, 9:58:05 PM3/19/12
to android...@googlegroups.com
I think the chapter 2 of Professional Linux Kernel Architecture will
be helpful to understand the CFS. It not only describes the concept
but source code exploring.

2012/3/20 Glenn Kasten <gka...@android.com>:

--
Regards,
Gaggery

Deborah

unread,
Mar 23, 2012, 11:31:46 AM3/23/12
to Android Linux Kernel Development
Thanks Gaggery!

On Mar 20, 2:58 am, Tsai Gaggery <gaggery.t...@gmail.com> wrote:
> I think the chapter 2 of Professional Linux Kernel Architecture will
> be helpful to understand the CFS. It not only describes the concept
> but source code exploring.
>
> 2012/3/20 Glenn Kasten <gkas...@android.com>:
>
>
>
>
>
>
>
>
>
> > I'm sorry but generic Linux is beyond the scope of this group. I suggest
> > doing a web search for the specific topics you're interested in.  However,
> > here are a few links to help you get started:
> >   http://en.wikipedia.org/wiki/Completely_Fair_Scheduler
> >   http://www.ibm.com/developerworks/linux/library/l-completely-fair-sch...
Reply all
Reply to author
Forward
0 new messages