Feature #1: Allocate Space
We'll cover the following...
Description
The first feature we need to build will identify the contiguous sub-processes that can be replaced with an incoming process of size n. In this scenario, we have p running processes numbered 1 through p in our system. We allocate memory to these processes contiguously such that process 1
occupies p_1
MB, process 2
immediately occupies p_2
MB, and so on. We receive the contiguous allocations p_1, p_2, …, p_n
as an array. An incoming process requires a contiguous chunk of n
MB anywhere in memory. To allocate memory to this process, we can evict one process or a set of processes that occupy contiguous memory locations that once evicted free up an n
MB amount of space collectively. Here, our task will be to find the total number of all possible subsets of currently running processes that together account for a contiguous allocation of n
MBs of memory.
In this scenario, we will be provided with two inputs. First, we will be given a list of integers representing the size ...
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy