linux26进程调度器和内核抢占(Linux26 process scheduler and kernel preemption)
linux26进程调度器和内核抢占(Linux26 process scheduler and kernel preemption)
Linux26 process scheduler and kernel preemption
New scheduler
The 2.6 version of the Linux kernel used by the new scheduler algorithm developed by IngoMolnar, called O (1) algorithm, it performs extremely well under high load, and when there are many processors can scale well.
In the 2.4 scheduler, after the timeslice recalculation algorithm requires that all processes exhaust their time, their new timeslices can be re calculated. So in a lot of processors in the system, when the process time slice to run out of them after waiting for retry (in order to get the new time slices), resulting in most of the processor is in the idle state; it will affect the efficiency of SMP. In addition, when the idle processor begins execution of that time has yet to be exhausted in a wait state process (if their own processor is busy), causes the process began to jump between the processor "". When a high priority process or interactive process jumps, the performance of the overall system is affected.
A new method to solve the problem of the scheduler is based on the CPU distribution to each time slice, and the abolition of the global synchronization and retry cycle. The scheduler uses two priority arrays, active arrays and expired arrays, which can be accessed by pointers. The active array contains all the tasks that are mapped to a CPU and the time slice is not exhausted. The out of date array contains an ordered list of all the tasks that a time slice has run out of. If the time slice all activities have been exhausted, then the pointer to the two array swap, the expired array (including ready tasks) becomes the active array, and an array of activities to become the new empty array contains the overdue task. The index of an array is stored in a 64 bit bitmap, and it is easy to find the highest priority task.
The new scheduler no longer has a big runqueue_lock. It maintains a running queue / lock mechanism for each