Uploaded by Mah Ru

Hasnain Ahmad 007 OS Assignment-4

Operating System
Assignment 4
Hasnain Ahmad Kazmi
Bs 2018
Submitted to: Ma’am Afia Zafar
The difference between the Paging and segmentation is that in paging, pages
are always of fixed size while in Segmentation, segments are of variable-length.
1. Internal Fragmentation:
Paging may lead to internal fragmentation. In internal fragmentation there is
fixed-sized memory. It happens when the memory assigned to the process is
greater as compared to the memory requested by the process. The solution
of internal fragmentation is best-fit block.
2. External Fragmentation:
Segmentation may lead to external fragmentation. In external fragmentation
there is variable-sized memory blocks. It happens when the total free
memory space is enough to load a process but the process still can’t load
because the free blocks of memory are not contiguous. Solution of external
fragmentation is compaction, paging and segmentation.
3. Sharing:
In Segmentation sharing happens at the segmentation level which is simple.
But to share a paging system there must be an entry for each page in page
map table.
To maintain the translation structures in Paging more memory overhead is
needed. Paging requires one entry per page that gives the physical address in
which the page is located. In Segmentation 2 registers per segment are needed.
One that maintains the base or starting address of the segment while the other
register maintains the limit address. Hence Segmentation is faster than paging
in memory translation.
There are 3 basic placement strategies:
First Fit: In the first fit, the partition is allocated which is the first empty block
from the top of Memory. It scans memory from the beginning and chooses the
first available block that is large enough.
Best Fit: A process is placed in memory hole where it best fits. In this method,
the memory wastage is minimal as it allocates the memory blocks with minimum
memory wastage.
Worst Fit: Allocate the process to the partition which is the largest among the
freely available partitions available in the main memory. The remaining memory
may still be large enough to store some other Process. The approach is known
as the worst fit method as it causes the maximum amount of memory wastage
in the memory.