OS Presentation
OS Presentation
UNIVERSITY
BANGLADESH
Operating System
NAME: Madhurja Mondal
ID:CSE 072 08239
Batch:72-C
Topic-6
1
A. Given five memory partitions of 200 KB, 250
KB, 500 KB, 120 KB and 600 KB(fixed
size),assume that all partitions are available
to allocate. And four processes of 240 KB,
580 KB,100 KB, and 200 KB size are also
given.Apply Best Fit and Worst Fit algorithms
to place these processes and for the given
scenario determine which algorithm makes
the most efficient use of memory.
B. Compare the main memory organization
schemes of contiguous memory
allocation, paging, and segmentation with
respect to the following issues:
i) External Fragmentation
ii) Internal Fragmentation
2
..
Best fit:
There are five given partiton and all parts available for allocation.
Four processes of 240KB,580KB,100KB and 200KB size are given.
Lets apply Best fit for the giver processes:-
P1
P1=240 200 10 500 120 6000
P1 P2
P2=580 200 10 500 120 200
P1 P3 P2
P3=100 200 10 500 20 200
3
P1 P3 P2
P4=200 P4 10 500 20 20
The Best Fit algorithm tries to find out the smallest hole
possible in the list that can accommodate
the size requirement of the process. Allocate the smallest
hole that is big enough. We must search the
entire list, unless the list is ordered by size. This strategy
produces the smallest leftover hole.
4
Worst Fit:
There are five given partition assuming all the partition available to allocate. Four
processes of 240KB,580KB,100KB and 200KB size are given.
Lets apply the worst fit:-
P1
P1=240 200 250 500 120 3600
P1
P2=580 (NO Allocation left) 200 250 500 120 3600
P3 P1
P3=100 200 250 400 120 3600
P4 P3 P1
P4=200 200 50 400 120 3600
The worst fit algorithm scans the entire list every time and tries to find out the
biggest hole in the
list which can fulfill the requirement of the process.
5
1. Internal Fragmentation:
Internal fragmentation happens when the memory is split into mounted-sized blocks.
Whenever a method is requested for the memory, the mounted-sized block is allotted to
the method. In the case where the memory allotted to the method is somewhat larger
than the memory requested, then the difference between allotted and requested memory
is called internal fragmentation.
The above diagram clearly shows the internal fragmentation because the
difference between memory allocated and required space or memory is
called Internal fragmentation.
6
2. External Fragmentation:
External fragmentation happens when there’s a sufficient quantity of
area within the memory to satisfy the memory request of a method.
However, the process’s memory request cannot be fulfilled because the
memory offered is in a non-contiguous manner. Whether you apply a first-
fit or best-fit memory allocation strategy it’ll cause external
fragmentation.
In the above diagram, we can see that, there is enough space (55 KB) to
run a process-07 (required 50 KB) but the memory (fragment) is not
contiguous. Here, we use compaction, paging, or segmentation to use the
free space to run a process.
7
Thank You