Feature #2: Resume Process

Implementing the "Resume Process" feature for our "Operating System" project.


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 of process IDs that are currently in memory.

We’ll be provided with an array of process IDs and a number n. We’ll have to find the nth missing process id starting from the beginning of the array.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.