Feature #2: Resume Process
Explore how to build an OS feature to resume preempted processes in a round-robin order by finding the nth missing process ID from a sorted list. Understand the application of a binary search algorithm to efficiently identify missing processes and manage memory allocation with O(log n) time complexity.
We'll cover the following...
Description
Our second task is building a feature to identify which process should be resumed into memory from its preempted state. Initially, one or more contiguous memory blocks are allocated to each running process. The allocation is done in ascending order of process ID. This means that the lower-numbered process IDs get memory blocks near address 0, and higher-numbered process IDs get allocated at higher addressed portions of memory. Some processes are preempted(interrupted) and currently don’t have any memory allocated to them. The OS wants to schedule one of the preempted processes. The OS uses a strategy that the resumes preempted processes in a round-robin fashion, starting with the one that has the lowest process ID. We are currently in the nth round of process resumption. Our task is to find the nth process to resume from a list ...
Solution
Since we are ...