operating-systemschedulingreal-time-systems

Are there any Operating Systems that use non preemptive scheduling ? If so what type of tasks do they perform?


Can you kindly help with the real world applications of non preeemptive scheduling as there seem to be no operating systems which use this sceduling is this just for theory or are there any working operating systems which use this scheduling? If what type of tasks are these opereating systems desginated to handle if there are any which are task specific.


Solution

  • First, it's important to understand that preemption is a spectrum. You can imagine that one end of the spectrum is some form of hardcore preemtive scheduling, while the other end is some form of hardcore non-preemtive scheduling. In between the two extremes, there is a whole range of options, some of which exist as research proposals, while others have made their way to production-grade operating systems.

    Preemtive scheduling enables the system to operate highly reliably when executing potentially untrusted or buggy code and improves the overall responsiveness of the system. That's why all modern large operating systems essentially use preemtive scheduling (with many variations).

    However, for memory-constrained and/or real-time platforms, there has been and still ongoing a substantial amount of research on the advantages and disadvantages of preemtive scheduling (PMT) and non-preemtive scheduling (also called cooperative scheduling or CMT). Preemption generally degrades the predictability of the execution times of tasks. That is, the execution time of each task may either degrade or improve. This is mainly due to two reasons. First, different tasks may be operating on different data. Therefore, when a task gets scheduled to run next, the data that it will access will evict from the CPU caches some or all of the data used by the previously scheduled task, which may still need to be scheduled to run. Second, modern CPUs employ a number of dynamic prediction/speculation techniques (branch prediction, prefetching, etc.). The behaviors of different tasks may reduce or improve the effectiveness of these techniques, depending on how similar the tasks are, and incur a performance hit on every context-switch.

    Non-preemtive scheduling can reduce memory consumption. If a task consists of several phases, it can allocate memory just to complete one phase and then release any memory that it will not need in later phases and yield control to allow other tasks to run. This is generally not possible with preemtive scheduling.

    Non-preemtive scheduling naturally supports mutual exclusion without any additional complexity or performance overhead. This can be achieved by having tasks not to yield execution while they are executing in a mutually exclusive section of code. Locking mechanisms are required to support mutual exclusion with preemtive scheduling.

    Because of these reasons, non-preemtive scheduling techniques are wildly used in memory-constrained and/or real-time systems. Wikipedia has a list of real-time OSes, many of which support non-preemtive scheduling.