[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A small change in the scheduler
Hi all,
I have another question.
I have seen the sched_exit comment and it says that the parent task
retrieves timeslices from the child, if I am no wrong. Do tasks really
deliver timeslices to their children? Is it always happen? Why?
It is said below in the comments.
/*
1283 * Potentially available exiting-child timeslices are
1284 * retrieved here - this way the parent does not get
1285 * penalized for creating too many threads.
1286 *
1287 * (this cannot be used to 'generate' timeslices
1288 * artificially, because any timeslice recovered here
1289 * was given away by the parent in the first place.)
1290 */
1291 void fastcall sched_exit(task_t * p)
1292 {
1293 unsigned long flags;
1294 runqueue_t *rq;
1295
1296 /*
1297 * If the child was a (relative-) CPU hog then decrease
1298 * the sleep_avg of the parent as well.
1299 */
1300 rq = task_rq_lock(p->parent, &flags);
1301 if (p->first_time_slice) {
1302 p->parent->time_slice += p->time_slice;
1303 if (unlikely(p->parent->time_slice > task_timeslice(p)))
1304 p->parent->time_slice = task_timeslice(p);
1305 }
1306 if (p->sleep_avg < p->parent->sleep_avg)
1307 p->parent->sleep_avg = p->parent->sleep_avg /
1308 (EXIT_WEIGHT + 1) * EXIT_WEIGHT + p->sleep_avg /
1309 (EXIT_WEIGHT + 1);
1310 task_rq_unlock(rq, &flags);
1311 }
On 5/29/05, Karane Mariano Vieira <karane@xxxxxxxxx> wrote:
> Hi All
>
> I would like to change the way the scheduler delivers the timeslices,
> it is the goal of a small homework in my university.
>
> I´d like to know:
> - the exactly moment (in the code) the a task receives its timeslice
> - Is there any differency between the code which deal with processes
> and threads
> ()
>
> --
> Karane.
>
--
Karane.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/