I read wikipedia about process scheduler:

The process scheduler is a part of the operating system that decides which process runs at a certain point in time.

I don't really understand what that means. What is a process scheduler in Linux? Is it part of the kernel? What exactly does it do?


1 Answer 1


In Linux, the process scheduler is a core part of the kernel. It doesn’t exist as a separate thread, or module, it’s implemented as a function, __schedule().

The job of the process scheduler is to decide which process should run next. Each processor in the system has a runqueue, which is the list of processes which are waiting to run on the CPU. When it’s invoked, the scheduler looks at this list of processes, and decides which one to run next; this can be the process (or rather, thread) which was running previously, or it could be another one. Various other systems in the kernel add and remove tasks from the runqueue, or move them from one CPU’s runqueue to another.

The kernel will reschedule processes in a number of circumstances: whenever a process is blocked (by a semaphore, mutex etc.), and whenever a reschedule has been requested and the system transitions from userspace to the kernel or back. The timer tick doesn’t directly invoke the scheduler, it requests a reschedule.


You must log in to answer this question.

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