Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A scheduler being a system program must be scheduled for execution so that it can wake up and schedule other programs. I read about process scheduling and algorithms but couldn't figure out how a scheduler itself is scheduled.
Does it schedule itself ? if yes then how ? and what algorithm ? because it should be waking up more often than any other program so there must be a different algorithm I think.

I have a LOT many similar questions in mind but all of them relate to just one thing, How a scheduler itself is scheduled ?

share|improve this question
    
just to clarify, you are only really speaking of multi-thread/process scheduling, not task schedulers like cron, at, or the the windows task scheduler, right? – Frank Thomas Nov 24 '13 at 20:39
    
@Frank, yes, In speaking of multi thread/process scheduling. – Gufran Nov 25 '13 at 3:48

There are multiple approaches to that problem.

Cooperative Multitasking Schedulers

A cooperative scheduler is invoked every time a program invokes it or yields control to it. It cooperates with the operating system and other running programs. A program that never yields, e. g. a “hanging” process, will never leave the running state on a machine with a single CPU.

Preemptive Multitasking scheduler

A very simple preemptive scheduler is invoked periodically by a timed CPU interrupt. A program cannot prevent this (without system level privileges) and will leave the running state because the CPU repositions the instruction pointer during interrupts.

I suggest you read the Wikipedia article on multitasking.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .