Welcome! Log In Create A New Profile

Advanced

Scheduler Question

Posted by parisscot 
Scheduler Question
September 29, 2009 12:02PM
Hello I am trying to understand how the scheduler() main function works in sched.c for linux v2.6.17.14.

Most specifically how the code describes what is going on. I understand conceptually the the scheduler looks for the highest priority task by searching the active priority array to find the first set bit. Then it selects the first task in the list at that priority, but exact coding describes this implementation?

I think it is:

3011 idx = sched_find_first_bit(array->bitmap);
3012 queue = array->queue + idx;
3013 next = list_entry(queue->next, task_t, run_list);

Can someone explain what lines 3012 and 3013 are doing?

Thanks!
Re: Scheduler Question
September 30, 2009 12:48AM
1. Older code, suggest reading new kernel source.
2. 3012&3013 are used to get the 2nd task, not the 1st one.
3. Why to get the 2nd one? Here I just give an example:
If CPU#0 is executing the 1st task, and the running task on CPU#1 has lower prio, then CPU#1 could pick above 2nd task up and run it; the lower prio one on CPU#1 will be dropped back to the lower prio queue in this case

-The Effo Staff
Effo Project, [effo.sourceforge.net]
Author:

Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 9 plus 4?
Message: