Operating System Homework-3: Submitted by
Operating System Homework-3: Submitted by
Homework-3
Submitted By:
Section: E - 3004
Roll_No: RE3004B77
Group: 2
Course_code: 1604
Subject_code: CAP316
Submitted To:
Miss. jasleen
PART A
Normally, a process that is swapped out will be swapped back into the same
memory space that it occupied previously. This restriction is dictated by the
method of address binding. If binding is done at assembly or load time, then
the process cannot be easily moved to a different location.
Implementation of overlay:-
Function1() (20kb)
50KB
Function1()
Function2() 70 Function1()
(50kb) Display ()
KB
(70kb)
Display () 40KB (40kb)
Implementation of swapping:-
Operating system
Process1
User
Proces2
process/application
= 100 milliseconds
As both the swap out and swap in should take place, the total swap time is
then about 220 milliseconds (above time is doubled). A round robin CPU
scheduling should have a time slot size much larger relative to swap time of
220 milliseconds. Also if process is not utilising memory space and just
waiting for I/O operation or blocked, it should be swapped.
2. A system uses multi-programming with variable no. of
tasks, with a memory of 110K for user processes. Draw the
memory map corresponding to the current memory
allocation table:
Ans-First fit:-
D 0 15
A 20 10
B 46 18
C 90 20
Best fit:-
A 20 10
D 31 15
B 46 18
C 90 20
Worst fit:-
A 20 10
B 46 18
D 65 15
C 90 20
Process 350 must be wait until release the memory space from other
process.
Process 350 must be wait until release the memory space from other
process.
In the above figure “Best fit” is the best algorithm for memory allocation.
After allocated memory to the arrival processes the memory state is, at
memory space 500k, 83k memory space is left, at 200k, 88k memory space
is left, at 300k, 82k memory space is left, at 600k, 250k memory space is
left.
P
ART B
Ans-
As was given for a 8 Page, 1024 words & 32 frames (shown below)
8 pages -> 2^3 bits
1024 bytes -> 2^10 bits
32 frames -> 2^5 bits
Therefore:
Logical memory = 3+10=13 bits (Page + Word)
Physical memory = 10 + 5 =15 bits (Word + Frame)
Ans-FIFO:-
0 1 7 0 1 2 0 1 2 3 2 7 1 0 3 1 0 3
0 0 0 2 2 2 3 3 3 1 1 1
1 1 1 0 0 0 2 2 2 0 0
7 7 7 1 1 1 7 7 7 3
OPT:-
0 1 7 0 1 2 0 1 2 3 2 7 1 0 3 1 0 3
0 0 0 0 3 3 3
1 1 1 1 1 1
7 2 2 7 0
LRU:-
0 1 7 0 1 2 0 1 2 3 2 7 1 0 3 1 0 3
0 0 0 0 3 3 1 1 3 3
1 1 1 1 7 7 7 7 1
7 2 2 2 2 0 0 0
Ans-
1 2 3 2 6 3 4 1 5 6 1 6 4 2
1 1 1 6 6 6 5 5 5 2
2 2 2 4 4 4 6 6 6
3 3 3 1 1 1 4 4
1 2 3 2 6 3 4 1 5 6 1 6 4 2
1 1 1 1 4 4 4 4
2 2 2 2 1 1 1
3 3 3 3 5 5
6 6 6 6 2