DEPARTMENTOFCOMPUTER SCIENCE & ENGINEERING
INTERNAL TEST – II
Semester: 4 Session: Feb- June 2022
Course Name: Operating Systems Course Code: 18CIC45
Date: 08/06/2022 MaxMarks:45
Time: 9:30 to 11:00 AM Duration: 90 minutes
Note: Answer three questions. Each question carries 15 Marks.
Bloom’s
Q# Questions Marks CO’s
Level
(15×3 = 45 Marks)
a Illustrate the differences between paging and segmentation.
Segmentation:-
Program is divided in to variable sized segments.
User is responsible for dividing the program in to segments.
Segmentation is slower than paging.
Visible to user. 05 CO3 L2
Paging:-
Programs are divided in to fixed size pages.
Division is performed by the OS.
1. Paging is faster than segmentation.
Invisible to user.
b Present any two mechanism used for implementing page table.
06 CO3 L3
c Given page fault service time 4msec, memory access time 10
nanoseconds page fault rate 0.0006, calculate effective access time.
04 CO4 L2
EAT=(1-p)*MAT+ p*page fault handling time
=(1-0.0006)* 10*10-9+ 0.0006*4*10-3
Effective access time:2.409994*10-6 seconds
OR
2. a Determine the total swapping time for a user process of size 2MB with a
data transfer rate from memory to disk of 10MB per second and average
latency is 10 msec.
Transfer time= 2MB/10MB 04 CO3 L3
=200ms
Total swapping time=2*(200+10)
=420ms
b Consider the following segment table:
Segment Base Limit
0 330 124
1 876 211
2 111 99 04 CO3 L3
3 498 302
Compute the physical addresses for the following logical addresses
a)0, 99 b)2,78 c)1,265 d)3,222
answer: 429, 189, illegal address, 720
Page1of2
c With a neat diagram, explain how TLB improves the performance of
paging system.
Diagram 3 Marks, Steps 4 Marks
O7 CO4 L2
3. a Discuss the steps involved in handling the page fault, with a help of a
neat diagram.
Steps involved in handling a Page Fault: Diagram 3 Marks, Steps 2 Marks
05 CO4 L2
A page fault causes the following sequence to occur:-
1. Trap to the OS. Save the user registers and process state. Determine
that the interrupt was a page fault.
2. Checks the page references were legal and determine the location of
page on disk.
3. Issue a read from disk to a free frame. If waiting, allocate the CPU to
some other user.
4. Brings page from hard disk to memory by finding a free frame.
5. Updates the page table and other table to show that the desired page is
now in memory.
6. Restore the user register process state and new page table then
resume the interrupted instruction.
Page2of2
b Given five memory partitions of 100Kb, 500Kb, 200Kb, 300Kb, 600Kb (in
order), demonstrate how would the first-fit, best-fit, and worst-fit
algorithms place processes of 212 Kb, 417 Kb, 112 Kb, and 426 Kb (in
order)? Which algorithm makes the most efficient use of memory?
First Fit Algorithm Best fit algorithm Worst fit algorithm
Proces Partitions
s In 500K(288K) PI:212 In 300K (88 PI:212K In 600
PI:212 In 600K(183 K K) P2:417 K(388K)
K K) P2:417 In 500K(83 K) K In 500K(83K) 06 CO4 L2
P2:417 In 200K(88 K) K In 200K(88 K) P3:112 In 300K(188
K Has to wait P3:112 In K K)
P3:112 K 600K(174K) P4:426 Has to wait
K Wastage of P4:426 K
P4:426 memory: 959 K Wastage of Wastage of
K K memory: 533 memory: 959
K K
c Consider a paging system with TLB with 95% hit ratio, 20 nanoseconds to
search the TLB and 100 nanoseconds to access memory. Calculate the
effective memory access time (EMAT).
04 CO4 L2
EMAT=hc+(1-h)M
=0.95*(20+100)+0.05*(20+100+100)
=125ns
OR
4. a Consider the following page reference string 5, 6, 7, 8, 5, 6, 9, 5, 6, 7, 8,
9
.How many page fault would occur for the following page replacement
algorithm assuming 3 frames. 09 CO4 L2
i. LRU= 10
ii. FIFO=9
iii. Optimal=7
b Differentiate between Tree structured and Acyclic –graph directory
structures with their advantages and disadvantages.
Tree-structured directory –
Once we have seen a two-level directory as a tree of height 2,
the natural generalization is to extend the directory structure to
a tree of arbitrary height.
This generalization allows the user to create there own
subdirectories and to organize on their files accordingly.
1. A tree structure is the most common directory structure.
The tree has a root directory, and every file in the system
have a unique path.
Advantages:
Very generalize, since full path name can be given.
Very scalable, the probability of name collision is less. 06 CO4 L2
Searching becomes very easy, we can use both
absolute path as well as relative.
Disadvantages:
Every file does not fit into the hierarchical model, files
may be saved into multiple directories.
We can not share files.
It is inefficient, because accessing a file may go under multiple
directories.
Acyclic graph directory –
An acyclic graph is a graph with no cycle and allows to share
subdirectories and files. The same file or subdirectories may
be in two different directories. It is a natural generalization of
the tree-structured directory.
It is used in the situation like when two programmers are Page3of2
working on a joint project and they need to access files. The
associated files are stored in a subdirectory, separating them
from other projects and files of other programmers, since they
are working on a joint project so they want the subdirectories
to be into their own directories. The common subdirectories
should be shared. So here we use Acyclic directories
Advantages:
We can share files.
Searching is easy due to different-different paths.
Disadvantages:
We share the files via linking, in case of deleting it may create
the problem, If the link is soft link then after deleting the file we
left with a dangling pointer.
In case of hard link, to delete a file we have to delete all the
reference associated with it.
a What are three major methods used for allocating a disk space?
5. Explain each with advantages and disadvantages.
1. Contiguous Allocation
In this scheme, each file occupies a contiguous set of blocks on
the disk. For example, if a file requires n blocks and is given a
block b as the starting location, then the blocks assigned to the
file will be: b, b+1, b+2,……b+n-1. This means that given the
starting block address and the length of the file (in terms of
blocks required), we can determine the blocks occupied by the
file.
The directory entry for a file with contiguous allocation contains
Address of starting block
Length of the allocated portion
2. Linked List Allocation 06 CO5 L2
In this scheme, each file is a linked list of disk blocks
which need not be contiguous. The disk blocks can be scattered
anywhere on the disk.
The directory entry contains a pointer to the starting and the
ending file block. Each block contains a pointer to the next block
occupied by the file.
2. Linked List Allocation
In this scheme, each file is a linked list of disk blocks
which need not be contiguous. The disk blocks can be scattered
anywhere on the disk.
The directory entry contains a pointer to the starting and the
ending file block. Each block contains a pointer to the next block
occupied by the file.
b Present design principles of Linux operating system.
05 CO5 L3
Linux Operating System has primarily three components
Page4of2
Kernel − Kernel is the core part of Linux. It is responsible for all
major activities of this operating system. It consists of various
modules and it interacts directly with the underlying hardware.
Kernel provides the required abstraction to hide low level hardware
details to system or application programs.
System Library − System libraries are special functions or programs
using which application programs or system utilities accesses
Kernel's features. These libraries implement most of the
functionalities of the operating system and do not requires kernel
module's code access rights.
System Utility − System Utility programs are responsible to do
specialized, individual level tasks.
c Discuss the different approaches to managing free space on a disk.
Bitmap or Bit vector –
A Bitmap or Bit Vector is series or collection of bits where each
bit corresponds to a disk block. The bit can take two values: 0
and 1: 0 indicates that the block is allocated and 1 indicates a
free block.
bitmap of 16 bits as: 0000111000000110.
Linked List –
In this approach, the free disk blocks are linked together i.e. a
free block contains a pointer to the next free block. The block
number of the very first disk block is stored at a separate
location on disk and is also cached in memory
Grouping – 04 CO5 L2
This approach stores the address of the free blocks in the first
free block. The first free block stores the address of some, say
n free blocks. Out of these n blocks, the first n-1 blocks are
actually free and the last block contains the address of next
free n blocks
Counting –
This approach stores the address of the first free disk block and
a number n of free contiguous disk blocks that follow the first
block.
Every entry in the list would contain:
1. Address of first free disk block
2. A number n
6. a Consider a disk drive with 200 tracks. The read write head is initially at
track 53. The queue of pending requests is:
98, 183, 37, 122, 14, 124, 65,67
Calculate the average seek time using SSTF, SCAN, C-SCAN and
LOOK disk scheduling algorithms.
SSTF AVG SEEK TIME: 29.5 08 CO5 L3
SCAN AVG SEEK TIME: upwards=22.87, downwards=
C-SCAN AVG SEEK TIME: upwards=41.37,
downwards=29.5
LOOK AVG SEEK TIME: upwards=37.35, downwards=26
b Explain in detail, the components of kernel that the kernel module
supports under Linux.
Three types of components:
1.Module Management
2.Driver Registration: 07 CO5 L2
Device driver
File systems
Network protocol
Binary format Page5of2
3.Conflits Resolution
Page6of2