Advanced Process Scheduling Exercises
I am Jyotiprakash, a deeply driven computer systems engineer, software developer, teacher, and philosopher. With a decade of professional experience, I have contributed to various cutting-edge software products in network security, mobile apps, and healthcare software at renowned companies like Oracle, Yahoo, and Epic. My academic journey has taken me to prestigious institutions such as the University of Wisconsin-Madison and BITS Pilani in India, where I consistently ranked among the top of my class.
At my core, I am a computer enthusiast with a profound interest in understanding the intricacies of computer programming. My skills are not limited to application programming in Java; I have also delved deeply into computer hardware, learning about various architectures, low-level assembly programming, Linux kernel implementation, and writing device drivers. The contributions of Linus Torvalds, Ken Thompson, and Dennis Ritchie—who revolutionized the computer industry—inspire me. I believe that real contributions to computer science are made by mastering all levels of abstraction and understanding systems inside out.
In addition to my professional pursuits, I am passionate about teaching and sharing knowledge. I have spent two years as a teaching assistant at UW Madison, where I taught complex concepts in operating systems, computer graphics, and data structures to both graduate and undergraduate students. Currently, I am an assistant professor at KIIT, Bhubaneswar, where I continue to teach computer science to undergraduate and graduate students. I am also working on writing a few free books on systems programming, as I believe in freely sharing knowledge to empower others.
Multi-CPU I/O + CPU Scheduling
In a computing environment, we have two Central Processing Units (CPUs) and five distinct processes. Each process arrives at the system at a unique, random time and undergoes the following sequence:
First CPU Burst: Upon arrival, the process requires a first batch of processing time on a CPU.
I/O Operation: After the first CPU burst, the process moves to perform an Input/Output (I/O) operation. This environment has infinite I/O resources, allowing multiple processes to perform I/O operations simultaneously without queuing.
Second CPU Burst: Following the I/O operation, the process returns for a second burst of CPU time.
Completion: After the second CPU burst, the process completes its execution and retires.
Since there are two CPUs available, there are two separate queues for CPU processing. The scheduling algorithm employed is the Shortest Remaining Time First (SRTF) algorithm. In this context, the "remaining time" is the sum of the times remaining from both the first and second CPU bursts combined.
Your task is to analyze this system and determine the following metrics for each process:
Response Time: The time from the arrival of the process until the first time it is scheduled.
Waiting Time: The total time a process spends in the ready queue (excluding the time spent in I/O operations).
Turnaround Time: The total time from the arrival of the process until its completion.
Completion Order: The sequence in which the processes complete their execution.
Gantt Charts: Visual representations showing how the two CPUs are utilized over time, including the allocation of processes to each CPU.
| Process | Arrival Time (units) | First Burst (units) | I/O Time (units) | Second Burst (units) |
| P1 | 2 | 8 | 10 | 5 |
| P2 | 1 | 4 | 9 | 2 |
| P3 | 9 | 9 | 5 | 9 |
| P4 | 4 | 1 | 4 | 2 |
| P5 | 7 | 4 | 11 | 10 |
Exploring Aging in Priority Preemptive Scheduling
This problem explores the concept of aging in a priority-based preemptive scheduling algorithm within a single CPU system. There are five processes, labeled P1 to P5, each with its own initial priority level. In this scheduling environment, the priority of a process is dynamic and is subject to change based on the time it spends in the ready queue.
The aging mechanism works as follows:
Every 5 units of time a process spends in the ready queue, its priority is increased by 1.
The priority value is inversely related to the actual priority: a lower numerical value indicates a higher scheduling priority.
The minimum possible priority value a process can have is 0, representing the highest priority level.
The CPU scheduling is done based on priority, with the preemptive approach being used. This means that if a process with a higher priority (lower numerical value) enters the ready queue, it preempts the currently running process.
Your task will be to determine the order of execution, waiting times, and turnaround times for each process, using the assigned initial priorities and burst times for the processes.
| Process | Arrival Time (units) | Initial Priority | Burst Time (units) |
| P1 | 0 | 4 | 19 |
| P2 | 7 | 3 | 20 |
| P3 | 3 | 1 | 20 |
| P4 | 4 | 0 | 30 |
| P5 | 6 | 2 | 20 |
Break ties by looking at the remaining time. If two processes have the same priority, only preempt if the running process has a higher remaining time. If that is also the same, do not preempt.
Exploring Multi-Level Queue Scheduling with Priority Preemption
This problem investigates a multi-level queue scheduling scenario designed to demonstrate the intricacies and efficiency of different scheduling algorithms working in tandem within a single CPU system. The system consists of three distinct queues, each employing a different scheduling algorithm, and a priority-based mechanism to manage the CPU allocation among these queues.
The three queues and their respective scheduling algorithms are as follows:
First Queue - Round Robin (RR):
This queue utilizes the Round Robin scheduling algorithm with a time quantum of 2 units.
Processes in this queue are given the highest priority (Priority 0).
Second Queue - Shortest Remaining Time Next (SRTN):
This queue employs the Shortest Remaining Time Next algorithm, a preemptive version of the shortest job next.
Processes in this queue are assigned a medium priority (Priority 1).
Third Queue - First Come First Serve (FCFS):
The third queue operates on the First Come First Serve scheduling principle.
Processes in this queue are given the lowest priority (Priority 2).
The CPU scheduling works on a priority preemptive basis across these queues:
At any given time, the CPU selects the process from the queue with the highest priority (lowest numerical value).
Within each queue, the respective scheduling algorithm (RR, SRTN, or FCFS) determines which process is selected.
Preemption occurs if a process from a higher-priority queue becomes ready while a process from a lower-priority queue is executing. In such a case, the lower-priority process is preempted in favor of the higher-priority one.
Round Robin (RR) queue:
| Process | Arrival Time (units) | Burst Time (units) |
| PQ11 | 2 | 10 |
| PQ12 | 5 | 20 |
| PQ13 | 20 | 29 |
Shortest Remaining Time Next (SRTN) queue:
| Process | Arrival Time (units) | Burst Time (units) |
| PQ21 | 10 | 20 |
| PQ22 | 5 | 10 |
| PQ23 | 34 | 29 |
First Come First Serve (FCFS) queue:
| Process | Arrival Time (units) | Burst Time (units) |
| PQ31 | 7 | 29 |
| PQ32 | 2 | 17 |
| PQ33 | 5 | 9 |
Find the response time, waiting time, and turnaround of each process. Draw the Gantt chart for the CPU. Find the order of completion of the processes.