Rakesh K
Rakesh K

Reputation: 8505

Memory allocation for processes

I have a question regarding the process execution with relation to memory allocated. Let's say I have two processes, P1 and P2. If P1 allocates huge chunks of memory leaving little free memory for P2 and now if I start P2, will P2 run without any changes to P1's memory? or will the OS page out some memory from P1 to create space for P2? Request you to answer these questions for my clarity.

Thanks, Rakesh.

Upvotes: 0

Views: 250

Answers (1)

AvinashK
AvinashK

Reputation: 3423

There are two cases:-

If paging is not supported and we allocate memory to entire process at once:

Suppose there are two processes and round robin scheduling is involved. Then, when the quantum of P1 ends and if there is not enough memory for P2, P1 is swapped out to a backing store and P2 is brought in.

If paging and virtual memory is supported:

Now both processes will have frames allocated to them based on their priority or size. Either global or local page replacement algorithms will be followed if space is not there.

Upvotes: 1

Related Questions