Search⌘ K
AI Features

Feature #2: Resume Process

Explore how to implement a resume process feature in operating systems by finding the nth preempted process using binary search. Understand memory allocation for processes, round-robin scheduling, and how to efficiently identify missing process IDs. This lesson deepens your comprehension of OS concepts and algorithm application for coding interviews.

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