Professional Documents
Culture Documents
Student ID : 040050323
Contact No : 0134363937
Email : Nazrin.Jamaluddin@wdc.com
No. of Pages : 11
(Including this)
Question 1
Paging
The contiguous memory allocation can make the memory wastage whether internal or
external fragmentation. The memory not fully utilize. To prevent this problem, non-
contiguous memory allocation method need to be implement. The first method called
Paging.
In paging, the physical memory is divided into equal size of blocks called frames.
Logical memory divided into equal blocks called pages. Below is the basic diagram for
Logical address located in Logical memory. For execution the process, it must move
from logical to physical memory. Here we can see the page 0 located at frame 1. For
example, page 3, the frame is 7, so in physical memory, it located at the last in frame table. A
few pages can be the same single process. Each page require one frame.
User will see Logical memory as a contiguous blocks of memory but in fact the frames are
solved. All the process (from logical to physical memory) can allocate into physical memory
because the equal size of page and frame. Not like contiguous allocation, the partition size is
various. 7. Not a good explanation. By right, internal fragmentation happens when a fixed
size block of memory says 32 kb allocated to a process but it only used up of 23 kb of memory
where 9 kb of memory are wasted. Because paging is using fixed size block which can lead to
Segmentation.
program function, method, object, stack, and arrays. Each process is divided into segment.
Refer figure below. Logical address in segmentation consists of a two tuple, <segment-
number, offset>.
The segment table(maps two-dimensional physical addresses) contain limit and base
for every segment. Base is the starting physical address while limit is the length of the
segment. Segment-table base register (STBR) show the location in physical memory.
Segment-table length register (STLR) show the segment used by program. Below is the
Offset must be greater than 0 and less than segment limit. Otherwise, OS trap this and
produce error refer to Gitam (2011). While internal fragmentation still occur in Paging,
Segmentation able to eliminate it. Unlike Paging, segment have varies sizes and can fit into
Question 2
1 3 3 5 1 1 8 3 8 9 9 9
1 1 1 8 8
3 3 3 9
5 5 5
Page faults = 5
Belady’s anomaly is a phenomena when increasing the number of page frames can
1 3 3 5 1 1 8 3 8 9 9 9
1 1 1 1 9
3 3 3 3
5 5 5
8 8
Page faults = 5
So, the conclusion for Belady’s anomaly in this reference string = if increase frame, it
c) Optimal algorithm
1 3 3 5 1 1 8 3 8 9 9 9
1 1 1 8 8
3 3 3 9
5 5 5
Page faults = 5
1 3 3 5 1 1 8 3 8 9 9 9
1 1 1 1 1 9
3 3 8 8 8
5 5 3 3
Page faults = 6
Question 3
Contiguous allocation
As we know, in a storage devices, there are many physical blocks. Every block has a
size in bytes. File firstly stored in logical block, then it will map into physical block. In
Contiguous allocation, there are many contiguous block in the disk. OS will allocate the
blocks into a file. Based on UIC University (2013) as the block is adjacent, so it not required
a lot of time to reading one block to another block. So the time taken to access the files is
faster.
Each file contain the address of starting block and the size of file.
The sequential and direct access are efficient for this method. For sequential access, it
refer to starting block and next block as sequence until it find the data need to be accessed. It
will start back from beginning if need to go to other blocks. While for direct access, the read
and write operation will go directly (not one by one) to the block based on the start block and
External fragmentation may occur. The operating system should maintain a list of free
holes (unused block) and then select the appropriate hole by implement best fit or first fit
algorithm. When the file allocated, the free disk space broken into little pieces. So, the next
The other problem is how to specify the future space for file. To solve this, need some
initial guessing. If the file become larger than guessing, it can be move to other disk area
called overflow.
Linked Allocation
Because users not quite know how the file size can grow or, Linked list is a solution.
The arrangement of block scattered, but connect each other using links. University of Regina
(2014) mentioned that the directory maintain the first block and last block of the file. From
figure below, every block have the next address of block until end.
The advantage is free space management system. No wastage space that can suffer
from external fragmentation. No more problem to specify the future space for file as the link
for next address can go to any free block. The file can grow as it want until disk space is full.
The disadvantage is it only support for sequential access. The example, if the read and
write operation access the 20th of block of a file, operation must begin at the start address
back. Same concept like sequential access. So it take a time. Besides that, a single damaged
Indexed allocation
The best allocation method is indexed allocation. Tong (2010) said indexed allocation
support for direct access because placing all the pointer into 1 place called index block. The
example for figure below. The index block for file moo located at block 8. In block 8, there
are pointer next address. So the operation can access file directly. No external fragmentation.
However, indexed allocation suffers from wastage of space. An entire index block is
to be allocated even if only one or two pointers to actual blocks are stored in it. Every file
needs to have an index block, so the index block must be as small as possible to reduce
wastage of space. If the index block is too small, it will not be able to store pointers to all the
http://www.tutorialspoint.com/operating_system/os_memory_management.htm
Gitam University 2011. “Segmentation.” Gitam. November 25. Accessed March 15, 2015.
http://www.gitam.edu/eresource/comp/gvr(os)/8.5.htm
UIC University 2013. “Main Memory.” UIC. July 19. Accessed March 15, 2015.
http://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/8_MainMemory.html
University of Regina 2014. “Files Systems, Physical View (Disk Allocation Methods).”
http://www2.cs.uregina.ca/~hamilton/courses/330/notes/allocate/allocate.html
IGNOU 2009. “DISK ALLOCATION METHODS.” IGNOU. August 11. Accessed March
cst101-bl4-u4-06.htm
Tong, Lai Yu 2010. “File Systems.” California State University. April 24. Accessed March