CPU Sheduling on Various Operating Systems

The process of assigning specific tasks to resources in order to perform a specific task is known as scheduling. The main purpose of CPU scheduling is to assign tasks to be executed whenever the processor remains idle, by selecting available processes from the memory.

There are several types of scheduling algorithms such as,
  • First-Come, First-Served (FCFS) Scheduling.

  • Shortest-Job-Next (SJN) Scheduling.

  • Priority Scheduling.

  • Shortest Remaining Time.

  • Round Robin(RR) Scheduling.

  • Multiple-Level Queues Scheduling. 

Mainly CPU scheduling can be classified into two types as,

  • Pre-emptive – here the tasks are scheduled according to the priority level of the tasks. The tasks with the highest priority are executed first while the lover ones are executed later when the higher priority task finishes its execution.


  • Non-pre-emptive – here the task that keeps running in the CPU will release the CPU either by switching context or terminating, because here the CPU has been allocated for specific processes.

Through CPU Scheduling we hope to maximize the CPU utilization and throughput while minimizing the turn-around time, response time and waiting time.

Most multi-programmed operating systems use a timer which allocates a time interval for certain process during CPU allocation. This helps prevent a process from tying up the system forever.

CPU Scheduling on Windows 10 


Windows 10 operating system uses multilevel feedback queue algorithm. Here the process is assigned to a queue and it remains in that queue until it is granted access to the CPU. The CPU assign processes to the queue based on the CPU bursts characteristics. If a process takes too much time it is assigned a lower priority queue and it a task remains in a lover priority queue for too long it is move into a higher priority queue.

Windows uses a round-robin scheduling. While there have been several smart heuristic enhancements in Vista to ensure that such processes, such as the disk defragmenter. Also in Windows 7, 8 uses the same scheduler as Vista, but some slight changes may have been made.

 

 


CPU Scheduling on MacOS 

 

In MacOS The kernel schedules multiprocessing tasks using a pre-emptive scheduling algorithm and uses cooperative scheduling for threads, where one process controls multiple cooperative threads. Like most operating systems MacOS also uses Round-Robin scheduling and all Process Manager processes run within a special multiprocessing task, called the "blue task". Each process has its own copy of the Thread Manager that schedules that process's threads cooperatively. Mach provides thread scheduling policies with a flexible framework. Multilevel feedback queue scheduling algorithm splits the ready queue into several different queues and allows a process to shift between queues. Here the Round-robin threads are run quantum (time slice) for a certain duration and then put at the end of the queue of threads. The scheduler operates a Round-Robin scheduling algorithm if several processes exist in the same queue. 


 Also MacOS uses a multilevel feedback queue, consisting with four priority bands for threads as, 

  • normal 

  • system high priority

  • kernel mode only

  • real-time.

CPU Scheduling on Linux 

 

The CPU Scheduling on Linux operating systems are priority based and the tasks are scheduled based upon the static and dynamic properties of tasks. These tasks are combined to form a tasks goodness and each time the Linux scheduler runs, it examines every task on the run queue and its goodness value is computed.

Looking at the scheduling latency in finer detail, the Linux scheduler makes use of a timer that interrupts every 10 msec. A task's counter starts out at the same value its priority contains. Once its dynamic priority (counter) has eroded to 0 it is again reset to that of its static priority (priority)

The Linux scheduler algorithm is a dynamic scheme combining pre-emptive priority with biased time slicing and it has been gone through some big improvements since kernel version 2.4. It assigns higher priority tasks to longer time quantum, and shorter time quantum to lower priority tasks which makes each process as either a process in real-time or a regular process. In the range [0,99], static priorities are allocated to the real-time tasks where the lower number means higher priority.  

 

The Linux kernel maintains a list of all the executable tasks in the data structure of a run queue. There are two priority arrays to a run queue as, current and expired. The active array contains all tasks with time remaining, and the inactive array contains all the tasks which have been disabled. The scheduler selects the task from the active list to be executed by the CPU considering the highest priority and when all the tasks have exhausted, these two priority arrays are exchanged.

 



Comments

Popular posts from this blog

How to install Oracle 12C in a Linux environment