Beruflich Dokumente
Kultur Dokumente
Department of CA
HOMEWORK-1
Declaration:
I declare that this assignment is my individual work. I have not copied
from any other student’s work or from any other source except where due
acknowledgement is made explicitly in the text, nor has any part been written for me by
another person.
Student’s Sign:
AMAR SINGH
a). Paging
B). Segmentation
Paging
Paging is a memory management scheme that permits the physical address space of a processs
to be noncontiguous. Paging avoids the considerable problem of fitting memory chunks of
varying sizes onto the backing store; most memory management schemes used before the
introduction of paging suffered from this problem. The problem arises because, when some
code fragmentation or data residing in main memory need to be swapped out, space must be
found on the backing store. The backing store also has the fragmentation problems discussed in
connection with main memory, except that access is much slower, so compaction is impossible.
Because of its advantages over earlier methods. Traditionally support for paging has been
handled by hardware, however recent designs have implemented paging by closely integrating
the hardware and operating system.
Segmentation
An important aspect of memory management that became unavoidable with paging is the
separation of the user’s view of memory and the actual physical memory. Segmentation is a
memory management scheme that supports this user view of memory. A logical address space
is a collection of segments. Each segment has a name and a length. The addresses specify both
the segment name and the offset within the segment. The user therefore specifies both each
address by two quantities: a segment name and an offset. For simplicity of implementation,
segments are numbered and are referred to by a segment number, rather than by a segment
name. thus, a logical address consist of two tuple:
<segment-number, offset>.
Ans:-The best available algorithm is best fit rather than first fit and
worst fit because in best fit algorithm there is less internal fragmentation
as compared to other available algorithms. If the processes come in the
order given above then the state of processes is same as that of part a.
c) Compute the total internal fragmentation for part (a), if any.
Ans:- the total internal fragmentation is given below:
500k-417k=83k
200k-112k=88k
330k-212k=118k
600k-350k=250k
Thus the total internal fragmentation is 539k
PART B
Consider a logical address space of 8 pages of 1024 bytes each, mapped onto a
physical memory of 32 frames. Determine the no. of bits in the logical address and
that in physical address.
5 Consider the page reference string: 0, 1, 7, 0, 1, 2, 0, 1, 2, 3, 2, 7, 1, 0, 3, 1, 0, 3.
Calculate the total no. of page faults (with no pre-paging at all) using OPT, FIFO, LRU
and Clock algorithms such that 3 frames are allocated to the process.
Ans:-
Reference String
0 1 7 0 1 2 0 1 2 3 2 7 1 0 3 1 0 3
0 0 0 3 3 3 0 0
1 1 1 2 2 2 3
7 7 7 1 1 1
6 A virtual memory system exhibits the follow trace of page nos. as:
1,2,3,2,6,3,4,1,5,6,1,6,4,2. Simulate the page replacements for the following
scenarios:
Determine the total no. of page faults for each. State whether Belady’s anomaly
occurs?
Ans:-
a) FIFO with 3 page frames:
1 2 3 2 6 3 4 1 5 6 1 6 4 2
1 2 3 3 6 6 4 1 5 6 6 6 4 2
1 2 2 3 3 6 4 1 5 5 5 6 4
1 1 2 2 3 6 4 1 1 1 5 6
1 2 3 2 6 3 4 1 5 6 1 6 4 2
1 2 3 3 6 6 4 1 5 5 5 5 5 2
1 2 2 3 3 6 4 1 1 1 1 1 5
1 1 2 2 3 6 4 4 4 4 4 1
1 1 2 3 6 6 6 6 6 4