Priority scheduling

from Wikipedia, the free encyclopedia

The priority scheduling (also PS - priority scheduling ) is in operating systems commonly used time-division method (so-called. " Scheduling ") which each process a priority assigns each and brings the runnable process with the highest priority for execution.

background

A processor core in a computer can only handle one process (at a time). In order to still be able to process several processes quasi-simultaneously , the processor core switches between them very quickly - they receive so-called "time slices" (generally the time slices have a fixed duration in the millisecond range). A process with a higher priority can “get its turn” more often , while a process with a lower priority has to wait longer for a time slice.

Types and procedures

The priority assignment can be static or dynamic:

  • In real-time systems , static prioritization is often used, while other systems often use dynamic priorities.
  • With dynamic priority assignment, the priority is reduced with each timer tick until another process has a higher priority than the currently executable one.

It is also possible to divide processes into different priority classes. Round-robin scheduling is typically used within the individual priority classes. An example of a scheduler with dynamically managed priority classes is the multilevel feedback queue scheduler.

Various system goals can be achieved using intelligent algorithms for assigning priorities. This makes it possible to dynamically increase process priorities in processes with high I / O in order to improve the interactivity of the system.

Risk of priority inversion

There is a risk of priority inversion , which occurs when a process with low priority has exclusively reserved a resource with the aid of a semaphore variable that is required by a process with high priority. Although the high-priority process should actually be executed, it has to wait until the lower-priority process releases the resource again with a . This problem can be exacerbated by a process of medium priority, since this can now suppress both the high and low priority process for as long as desired. A famous crash attributed to this bug is the near-loss of the Pathfinder Mars probe . Although the problem has been known since the 1970s, no optimal solution has yet been found. Two well-known approaches are the priority limit or -schranke (priority ceiling) and the priority inheritance (Priority Inheritance) .