Operating System
Operating System
Unit – 4
Memory Management
We admit that some of the content or the images provided in this channel's
videos may be obtained through the routine Google image searches and
few of them may be under copyright protection. Such usage is completely
inadvertent.
Can you have a m/m which is large in size, have very less access
time and also have less per unit cost??
The answer is No.
As all these three criteria’s would not met simultaneously that’s
why we don’t have a single memory in the systems.
Cache Memory
Main Memory
Secondary Memory
Fixed Variable
partition partition Paging Segmentation
• Advantage:
• Implementation is simple.
• Processing overhead is low.
• Disadvantage:
• Limit in process size.
• Degree of multiprogramming is also limited.
• Causes External fragmentation because of
contiguous memory allocation.
• Causes Internal fragmentation due to fixed
partition of memory.
First Fit
Best Fit
Worst Fit
First Fit
Best Fit
Worst Fit
100 500
52 52 552
…
P100 – page1
4. ContinueUnit-
the4process
Memoryby restarting (Rashmi Rathi Upadhyay)
Management 57
First In First Out (FIFO)
The simplest page replacement algorithm.
When the page must be replaced the oldest page is chosen.
one FIFO queue is maintained to hold all pages in memory.
Replace the page which at the top of the queue and add new
pages from rear end (tail)of the queue.
Reference String : 2 3 2 1 5 2 4 5 3 2 5 2
3 frames (3 pages can be in memory at a time per process)
F3 1 1 1 1 0 0 0 3 3 3 3 2 2
F2 0 0 0 0 3 3 3 2 2 2 2 1 1 1
F1 7 7 7 2 2 2 2 4 4 4 0 0 0 0 0
F F F F Hit F F F F F F hit F F hit
15 page faults
• Very simple.
• Easy to implement.
Disadvantage
F1 1 1 1 1 1 1 5
F2 2 2 2 2 2 2 2
F3 3 3 5 5 5 4 4
f4 4 4 4 4 3 3 3
4* 2hit * 2hit * * *
F1 7 2 2 2 2 4 4 4 0 0 1 1 1 1 1 1
F2 0 0 0 0 0 0 0 3 3 3 3 3 0 0 0 0
F3 1 1 1 3 3 3 2 2 2 2 2 2 2 2 7 7
3* * hit * hit * * * * 4hit * hit * hit * 2hit
10 page faults
15 page faults
F1 7 7 7 7 7 7 7 3
F2 0 0 0 3 0 4 4 4
F3 1 2 2 2 2 2 2 2
3* * hit * * * 2hit *
F1 1 1 1 1 1 1 3 3 3 3 3 3 6
f2 2 2 2 2 2 2 2 7 7 2 2 2 2
f3 3 4 4 5 6 6 6 6 6 6 1 1 1
3* * 2hit * * 3hit * * 2hit * * 2hit *
F1 1 1 1 1 4
F2 2 2 2 2 2
F3 3 3 3 3 3
f4 4 4 5 5 5
4* 2 hit * 3hit *
Disadvantage: