lkml.org 
[lkml]   [2002]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectQ: 2.4 Scheduler
Hi.

I have some specific questions concering the implementation of the
scheduler in 2.4.18, which I hope you would please answer for me.

Question #1:
Has anyone documented the functionality of the current scheduler? It
seems that the algorithm used is very sparse explained (although very
easy to understand by looking at the code), and the comments in the
code does not always what the purpose of a function is, but rather how
it works.

Question #2:
In the schedule function, a 'goodness' value is calculated for all
processes, and the maximum is remembered. If this value is zero, tasks
gets a new quantum. The question here is which tasks. Take a look at the
code below. (shed.c, 617)

/* Do we need to re-calculate counters? */
if (unlikely(!c)) {
struct task_struct *p;

spin_unlock_irq(&runqueue_lock);
read_lock(&tasklist_lock);
for_each_task(p)
p->counter = (p->counter >> 1) + NICE_TO_TICKS(p->nice);
read_unlock(&tasklist_lock);
spin_lock_irq(&runqueue_lock);
goto repeat_schedule;
}

What I do not understand here is the 'for_all_tasks'. Its defined in
sched.h, line 870:

#define for_each_task(p) \
for (p = &init_task ; (p = p->next_task) != &init_task ; )

Would someone please explain the structure of this - Its very hard to
see what this list consists of. Also if anyone has the time to give some
more general information on 'struct task' I would be happy - It's a big
structure, and it's hard to track down where the structure is modified,
and why.


Question #3:
What is the main purpose of 'reschedule_idle.'? In the UP case, its
all about removing the current task from the CPU, but a more detailed
explanation would be nice. Of course I'm interested in the SMP case.

I hope that some of you would be so kind as to spend some time to
answer these questions. The reason for me asking is, that I'm trying
to document the scheduler (from a theoretical point of view). I also
plan to describe the works of Ingo's O(1) scheduler in 2.5, but I
haven't started looking at that yet.

Thanks in advance
Anders Fugmann

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:21    [W:0.050 / U:4.976 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site