Search⌘ K
AI Features

Feature #2: Resume Process

Explore how to build an OS feature that resumes preempted processes in round-robin order by finding missing process IDs using binary search. Understand how to apply this algorithm to manage memory allocation efficiently and resume the correct process with optimal time and space complexity.

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 an array ...

Solution

Since we are ...