Which of the following CPU scheduling algorithms is/are supported by LINUX operating system?
Preemptive priority scheduling and time sharing CPU scheduling
CPU scheduling is a fundamental concept in operating systems. It determines which process gets access to the CPU at any given time and for how long. The goal of CPU scheduling is to improve system performance, such as increasing throughput, minimizing response time, and ensuring fairness among processes. The Linux operating system, being a complex and versatile system, employs sophisticated CPU scheduling mechanisms to manage system resources efficiently.
In preemptive priority scheduling, processes are assigned a priority level. The scheduler always selects the process with the highest priority to run. Preemptive means that if a new process arrives with a higher priority than the currently running process, the running process can be interrupted (preempted) and the higher-priority process is given the CPU.
Time-sharing scheduling involves dividing the CPU time among multiple processes. Each process is allocated a small slice of CPU time, known as a time slice or quantum. After a process uses its time slice, it is preempted, and the CPU is given to another process. This cycle repeats, creating the illusion that all processes are running concurrently. Time-sharing is often used in interactive systems where users expect timely responses.
Linux has evolved its CPU scheduling algorithms over time. Historically, it used schedulers like the O(1) scheduler. The modern Linux kernel primarily uses the Completely Fair Scheduler (CFS) for normal processes. While CFS is often described as a fair queuing scheduler, it essentially implements time-sharing by ensuring each process gets a fair proportion of the CPU time based on its 'niceness' value (which influences its effective priority). Higher priority processes get more CPU time or smaller wait times.
Linux schedulers are generally preemptive. This means that the scheduler can interrupt a running process if a higher-priority process becomes ready, or if a process exceeds its allocated time slice (in the case of time-sharing).
The combination of handling processes based on priority (even if implicitly through fairness mechanisms) and using time slices to share the CPU among many processes aligns with the concepts of preemptive priority scheduling and time-sharing.
Therefore, the description that best fits the nature of CPU scheduling supported by the Linux operating system, considering both its historical and modern implementations (like CFS which balances fairness with priority-like behavior) and its preemptive nature, is a combination of preemptive priority scheduling and time sharing.
| Scheduling Concept | Linux Implementation Relevance |
|---|---|
| Preemption | Key characteristic of Linux schedulers. Running processes can be interrupted. |
| Priority | Used to influence scheduling decisions (e.g., 'niceness' in CFS affects CPU share). |
| Time Sharing | CPU time is shared among processes, often via time slices (conceptually in CFS via targeted latency). |
| Non-preemptive | Not the primary mode for standard process scheduling in Linux. |
| Concept | Description | Linux Support |
|---|---|---|
| Preemptive | Can interrupt running process | Yes |
| Priority-based | Processes scheduled based on priority level | Yes (implicitly via 'niceness' in CFS) |
| Time-Sharing | CPU time divided among processes | Yes (Implemented via CFS fairness) |
| Non-Preemptive | Process runs until completion or blocks | No (for standard processes) |
The Linux kernel has had several different CPU schedulers over its history.
While CFS focuses on fairness, its behavior can be influenced by process priorities (niceness values), effectively incorporating aspects of priority scheduling. Combined with its preemptive nature and allocation of CPU time, it embodies both preemptive priority and time-sharing principles for normal processes.
Consider the following four processes with the arrival time and length of CPU burst given in milliseconds :
| Process | Arrival Time | Burst Time |
| P 1 | 0 | 8 |
| P 2 | 1 | 4 |
| P 3 | 2 | 9 |
| P 4 | 3 | 5 |
The average waiting time for preemptive SJF scheduling algorithm is
Consider the following set of processes and the length of CPU burst time given in milliseconds:
Process | CPU Burst time (ms) |
P 1 | 5 |
P 2 | 7 |
P 3 | 6 |
P 4 | 4 |
Assume that processes being scheduled with Round-Robin Scheduling Algorithm with Time Quantum 4ms. Then the waiting time for P 4is _________ ms.
Consider three intensive processes, which requires 10,20 and 30 units of time and arrive at times 0,2 and 6 respectively. how many context switches are needed if the operating system implements a shortest remaining time first scheduling algorithm? Do not count the context switches at time zero and at the end.
Given CPU time slice of 2 ms and the following list of processes.
Process | Burst time (ms) | Arrival time (ms) |
p 1 | 3 | 0 |
p 2 | 4 | 2 |
p 3 | 5 | 5 |
Find average turnaround time and average waiting time using round-robin CPU scheduling?
In which of the following scheduling criteria, context switching will never take place?