Paging Numericals
Paging Numericals
Paging Numericals
2/22/2024 1
Computer Science and Information Technology
Course Code : MCA301 Course Name: Operating System
Contiguous Memory Allocation
Fixed Size Partitioning
❑ Main memory is divided into several partitions and size of each partitions is
NOT fixed i.e. each partition may be of different sizes and we can not divide it
further.
❑ Only one process is allowed in one partition.
❑ Number of partitions (Decided by Administrators)
❑ Size of Partition (Decided by Administrators)
❑ Suffers from Internal Fragmentation and External Fragmentation
5KB 2KB 2KB 1KB
10 KB
❑ If P1 = 4 KB, then it can be accommodated in only partition of size 5 KB. In
this scenario, 1 KB is wasted which is known as internal fragmentation.
❑ External Fragmentation means the total space required is available but it is
not available in contiguous fashion. For example space required is 4 KB but it
is available in fragmented fashion NOT in contiguous.
2/22/2024 2
Computer Science and Information Technology
Course Code : MCA301 Course Name: Operating System
Contiguous Memory Allocation
Variable Size Partitioning
❑ Main memory is NOT divided into partitions i.e. we do not have predefined
partitions.
❑ Suffers from External Fragmentation
10 KB
❑ If P1 = 4 KB, then it can be accommodated in only partition of size 5 KB. In
this scenario, 1 KB is NOT wasted and is reused.
❑ Best Fit is performing best in Fixed Size Partitioning while worst in
Variable Size Partitioning.
❑ Worst Fit is performing best in Variable Size Partitioning while worst in
Fixed Size Partitioning.
2/22/2024 3
Computer Science and Information Technology
Course Code : MCA301 Course Name: Operating System
Contiguous Memory Allocation
First, Best and Worst Fit under Variable Size Partition
❑ P1 = 300 KB, P2 = 25 KB, P3 = 125 KB, P4 = 50 KB
❑ If P1 = 4 KB, then it can be accommodated in only partition of size 5 KB. In
this scenario, 1 KB is wasted which is known as internal fragmentation
Initially
P1
50 KB 150 KB 300 KB 350 600
First Fit
P2 P3 P1 P4
50 KB 150 KB 300 KB 350 600
2/22/2024 4
Computer Science and Information Technology
Course Code : MCA301 Course Name: Operating System
References
Recommended Books
❑ Modern Operating Systems By Andrew S. Tanenbaum
❑ Operating System Concepts By Abraham Silberschatz
❑ Operating Systems By William Stallings
❑ Operating Systems by Dietel, D
❑ https://www.gatevidyalay.com/priority-scheduling-cpu-
scheduling-examples/
2/22/2024 5