On Friday 02 January 2009 10:55:26 Shyam Burkule wrote: > Hi All, Hi! first off, UTLK is a bit outdated when it comes to schduling :s > In Understanding The Linux Kernel, 3rd edition I read that > *scheduler_tick()* is invoked once every tick to perform some operations > related to scheduling. I am confused here, how costly it would be to call > the function after every tick? Does it really happened? If not, then how > indication of process time slice exhausted(if any) comes to know?? Well, this depends on the scheduling-tick frequency. If you have set this to 1000Hz, it will naturally consume 10 times the resources than if you compile it with 100Hz. The timer-tick function does a number of things, not just checking if the currently running task should be preempted, but also updates the time, the runqueue time as well as the cpu load before calling the appropriate tick-function to the class of the currently executing process. If it is a CPU intensive task that does not use syscalls, the scheduler-tick will trigger once in a while and test to see if the timeslice has been exhausted (or, in post-2.6.23, if the balance is sufficiently skewed so that another task has a graver need to run). The timer-tick is useful in the tickless CFS world as it will prevent CPU intensice functions to hog the CPU between syscalls. On return from syscalls, the kernel will test the task to see if it needs to be rescheduled Btw, what you mean *after* every tick? It is already called when a tick occurs, so strictly speaking, it is executing *after* a tick as the event triggers the action. CFS does not use timeslice in the same way that O(1) did, you should think more along the lines of 'share of bandwith'. > Thanks > Shyam -- med Vennlig Hilsen - Yours Sincerely Henrik Austad -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ