CT3 OS Answer Key-Final PDF
CT3 OS Answer Key-Final PDF
c) 9
d) 7
The aim of creating page replacement algorithms is to ____________
a) replace pages faster
7. b) increase the page fault rate 1
c) decrease the page fault rate
d) to allocate multiple pages to processes
A FIFO replacement algorithm associates with each page the _______
a) time it was brought into memory
8. b) size of the page in memory 1
c) page after and before it
d) page recently used
What is the Optimal page – replacement algorithm?
a) Replace the page that has not been used for a long time
9. b) Replace the page that has been used for a long time 1
c) Replace the page that will not be used for a long time
d) Replace the page that will big in size.
Optimal page – replacement algorithm is difficult to implement, because ____________
a) it requires a lot of information
10. b) it requires future knowledge of the reference string 1
c) it is too complex
d) it is extremely expensive
Defective sectors on a disk are often called as ______.
a) good block
11. b) destroyed blocks 1
c) bad blocks
d) error blocks
File type can be represented by ____________
a) file name
12. b) file extension 1
c) file identifier
d) file permission
_________ is a sequence of procedures and functions.
a) object file
13. b) source file 1
c) executable file
d) text file
Which of the following is crucial time while accessing the data on the disks?
a) seek time
14. b) Rotational delay 1
c) Transmission time
d) Waiting time
The ________ policy restricts scanning to one direction only.
a) SCAN
15. b) C-SCAN 1
c) FCFS
d) SSTF
____________ are often used where very rapid access is required, where fixed length records are
used, and where records are always accessed one at a time.
a) Direct files
16. 1
b) Sequential files
c) Indexed files
d) Indexed sequential file
17. __________________ refers to the logical structuring of records. 1
a) file organisation
b) structural organisation
c) physical organisation
d) logical organisation
The universe consists of __________
a) all users in the system
18. b) all users that are not owners 1
c) all users that aren’t included in the group or owners
d) all users that are included in group
Virtual memory uses disk space as an extension of ____.
a) secondary storage
19. b) main memory 1
c) tertiary storage
d) cache memory
________is series or collection of bits where each bit corresponds to a disk block.
a) Bit Vector
20. b) Array 1
c) List
d) Index
PART B (3 X 10 = 30)
ANSWER ALL THE QUESTIONS
Q.
Questions Marks
No.
a) Explain in detail about thrashing and working set model
Thrashing : (5 Marks)
➢ A process is busy with swapping pages in and out. This high paging activity is called
Thrashing.
➢ A process is in thrashing if it is spending more time on paging rather than executing.
Cause of Thrashing
If a process does not have “enough” pages, the page-fault rate is very high. This leads to:
➢ low CPU utilization.
➢ operating system thinks that it needs to increase the degree of multiprogramming.
another process added to the system
21 10
The working set model states that a process can be in RAM if and only if all of the pages
that it is currently using (often approximated by the most recently used pages) can be in
RAM.
b) Give a brief discussion about virtual memory and how OS handles the page fault
effectively?
Virtual memory (5 Marks)
Virtual memory is a technique that allows the execution of processes that are not completely
in Main memory.
Virtual memory – involves the separation of logical memory as perceived by users from
physical memory.
Need for virtual memory
➢ Programs often have code to handle unusual error conditions. Since these errors
seldom, if ever, occur in practice, this code is almost never executed.
➢ Arrays, lists, and tables are often allocated more memory than they actually need. An
array may be declared 100 by 100 elements, even though it is seldom larger than 10
10
by 10 elements.
➢ An assembler symbol table may have room for 3,000 symbols, although the average
program has less than 200 symbols. Certain options and features of a program may be
used rarely. Even in those cases where the entire program is needed, it may not all be
needed at the same time.
➢ One major advantage of this scheme is that programs can be larger than physical
memory.
➢ Further, virtual memory abstracts main memory into an extremely large, uniform
array of storage, separating logical memory as viewed by the user from physical
memory.
➢ This separation allows an extremely large virtual memory to be provided for
programmers when only a smaller physical memory is available.
1. Check an internal table (usually kept with the process control block) whether the
reference was a valid or an invalid memory access.
2. If the reference
Invalid, we terminate the process.
Valid but we have not yet brought in that page, we now page it in.
3. Find a free frame
4. Schedule a disk operation to read the desired page into the newly allocated frame.
5. When the disk read is complete, modify the internal table kept with the process and
the page table to indicate that the page is now in memory.
6. We restart the instruction that was interrupted by the trap. The process can now access
the page as though it had always been in memory.
a) Consider a disk queue with requests for I/O to blocks on cylinders 98, 183, 41, 122, 14, 2
124, 65, 67. The head is initially at cylinder number 53. The cylinders are numbered from
0 to 199. What is the total head movement (in number of cylinders) incurred while servicing
these requests for each of the following disk scheduling algorithms:
22
i.FCFS ii. SSTF iii. SCAN iv. LOOK v. C-LOOK
• Total head movements using FCFS= [(98 – 53) + (183 – 98) + (183 – 41) + (122 – 41)
+ (122 – 14) + (124 – 14) + (124 – 65) + (67 – 65)]
• = 45 + 85 + 142 + 81 + 108 + 110 + 59 + 2
• =632
ii. SSTF(Shortest Seek Time First)
• Shortest Seek Time First (SSTF) selects the request with the minimum seek time
from the current head position
iii. SCAN
• The disk arm starts at one end of the disk, and moves toward the other end, servicing
requests until it gets to the other end of the disk, where the head movement is reversed
and servicing continues.
• SCAN algorithm Sometimes called the elevator algorithm
iv. LOOK
• It is similar to the SCAN disk scheduling algorithm except for the difference that the
disk arm in spite of going to the end of the disk goes only to the last request to be
serviced in front of the head and then reverses its direction from there only. Thus it
prevents the extra delay which occurred due to unnecessary traversal to the end of the
disk.
v. C-LOOK
• In CLOOK, the disk arm in spite of going to the end goes only to the last request to be
serviced in front of the head and then from there goes to the other end’s last request.
Thus, it also prevents the extra delay which occurred due to unnecessary traversal to
the end of the disk.
head is initially at cylinder number 53. The cylinders are numbered from 0 to 199
(41-14)]
= 12+2+31+24+2+59+169+27)=326
File-System Implementation
• Types - On-disk and in-memory structures 3
• On Disk Data Structures
✓ Boot Control Block - Boot Control Block contains all the information which is
needed to boot an operating system from that volume. It is called boot block in
UNIX file system. In NTFS, it is called the partition boot sector.
✓ Volume Control Block - Volume control block all the information regarding that
volume such as number of blocks, size of each block, partition table, pointers to free
blocks and free FCB blocks. In UNIX file system, it is known as super block. In
NTFS, this information is stored inside master file table.
✓ Directory Structure (per file system) -A directory structure (per file system) contains
file names and pointers to corresponding FCBs.
✓ File Control Block - File Control block contains all the details about the file such as
ownership details, permission details, file size,etc. In UFS, this detail is stored in
inode.
• In-Memory File System Structures 3
✓ The in-memory data structures are used for file system management as well as
performance improvement via caching. This information is loaded on the mount time
and discarded on ejection.
inodes are unique only across a single filesystem, and certainly do not carry across
networked file systems. )
The VFS in Linux is based upon four key object types:
o The inode object, representing an individual file
o The file object, representing an open file.
o The superblock object, representing a filesystem.
o The dentry object, representing a directory entry.
Directory Implementation
Directories need to be fast to search, insert, and delete, with a minimum of wasted disk space.
23
2
Two-level directory
• In the two-level directory structure, each user has there own user files directory
(UFD). The UFDs has similar structures, but each lists only the files of a single user.
system’s master file directory (MFD) is searches whenever a new user id=s logged in.
The MFD is indexed by username or account number, and each entry points to the
UFD for that user.
2
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