Uploaded by i.love.monaschon

Compre Q A Upload

advertisement
BITS PILANI HYDERABAD CAMPUS
OPERATING SYSTEMS (CS F372)
SEM II 2020-2021
COMPREHENSIVE REGULAFR EXAMINATION
TYPE – OPEN BOOK MAX. MARKS – 80
DURATION – 120 MINS.
NO. OF SECTIONS – 3, NO. OF QUESTIONS – 28
SECTION: 1 – True/False Type Questions (12 x 2 = 24 Marks)
1. Mutex lock involves busy waiting. Write true or false.
[2 marks]
Ans. true
2. block( ) and wakeup( ) operations are associated with semaphore implementation with busy
waiting. Write true or false. [2 marks]
Ans. false
3. The addresses generated by the CPU are known as physical addresses. Write true or false. [2
marks]
Ans. false
4. Paging is not prone to internal fragmentation. Write true or false.
[2 marks]
Ans. false
5. Locality of reference is harmful for demand paging. Write true or false. [2 marks]
Ans. false
6. Dirty bit is used to determine whether a victim frame should be written to disk during page
replacement. Write true or false. [2 marks]
Ans. true
7. If page fault rate of a process is too low, we can take away one frame from the process. Write
true or false. [2 marks]
Ans. true
8. Positioning time of a disk is the time for the desired sector to rotate under the disk head.
Write true or false. [2 marks]
Ans. false
9. RAID stands for redundant arrays of individual disks. Write true of false. [2 marks]
Ans. false
10. Hash table based directory implementation is prone to collisions. Write true or false. [2
marks]
Ans. true
11. FAT stands for File Allocation Table. Write true or false. [2 marks]
Ans. true
12. The solution to the Dining Philosopher's problem (that we have studied in the lectures) uses
counting semaphores. Write true or false. [2 marks]
Ans. false
SECTION: 2 – Short Answer Type (12 x 2 = 24 Marks)
1. Suppose a file system on a computer uses contiguous allocation scheme. Suppose a file
named as input.txt is present on this computer. The directory entry of input.txt is as follows:
File Name
start
length
input.txt
3
6
If each block is of size 512 bytes, what is the size of the file. Assume that there is no wastage
of space on any of the allocated blocks. Write only the answer. No calculation or explanation
required.
[2 marks]
Ans. 3072 bytes
2. Suppose a file system on a computer uses indexed allocation scheme. On this computer, each
block is of size 256 bytes. You have a file named as abc.txt. Block number 8 is the index block
of this file. The size of abc.txt is 2304 bytes. Each pointer requires 8 bytes of space. Calculate
the wastage of storage space in bytes on the index block. Write only the answer. No calculation
or explanation required. [2 marks]
Ans. 184 bytes
3. Suppose you have the following bit vector: 00000100001100000010010101100000.
Calculate the total number of free blocks. Write only the answer. No calculation or explanation
required. [2 marks]
Ans. 8
4. Suppose a computer system uses RAID Level 1. There is a total of 20 disks present on this
system. Each disk is of 4 Gigabytes. Calculate in Gigabytes the amount of data that can be
stored on the disks. Write only the answer. No calculation or explanation required.
[2
marks]
Ans. 40 gigabytes
5. Suppose a hypothetical computer system uses RAID Level 4. There is a total of 9 disks
present on this system. Each disk contains 20 blocks. For how many data blocks each block of
the parity disk will be storing the parity information? Write only the answer. No explanation
or calculation required. [2 marks]
Ans. 8
6. Consider a computer system that uses the buddy system for kernel memory allocation. You
need memory for a kernel object of size 90 KB. Calculate the amount of kernel memory that
will be allocated by the buddy system. Note that you have to allocate a single chunk of memory.
Write only the answer. No calculation or explanantion required. [2 marks]
Ans. 128 KB
7. Consider the following page reference string - 1, 1, 3, 4, 6, 3, 3, 6, 4, 1, 1, 1, 6, 4, 2, 1, 3, 2.
Determine the working set for the given page reference string. Write only the answer. No
calculation or explanation required. [2 marks]
Ans. 1, 2, 3, 4, 6
8. Consider a computer system that uses the proportional frame allocation strategy. There is a
total of 150 frames available that can be allocated to processes. Suppose there are 3 processes,
P1, P2 and P3, that need frames to be allocated. The size of P1 is 100 KB, size of P2 is 130 KB
and size of P3 is 190 KB. How many frames will be allocated to P3? Assume all 150 frames
are available. Write only the answer. No calculation or explanation required. [2 marks]
Ans. 67
9. Consider a system that uses hierarchical page table with two-level paging scheme. For this
system p1 is of 8 bits, p2 is of 10 bits and d is of 7 bits. Calculate the total number of inner
page tables. Write only the answer. No calculation or explanation required. [2 marks]
Ans. 256
10. Consider a computer system that uses paging scheme along with TLB. The TLB hit ratio
is 75%. For searching the TLB, 30 nanoseconds is required. The main memory access time is
200 nanoseconds. Calculate the effective access time. Write only the answer. No explanation
or calculation required. [2 marks]
Ans. 280 nanoseconds
11. Suppose a computer system uses the segmentation scheme for memory management. The
segment table is as follows:
Limit
Base
400
1000
350
1700
500
300
475
2100
800
2700
Is the logical address <3, 490> a valid address for memory reference. Write only yes or no. No
explanation or calculation required. [2 marks]
Ans. No
12. Suppose a deadlock has been detected in the system. Processes P1, P2, P3 and P4 are
involved in the deadlock. The system will attempt a recovery from deadlock by rolling back a
process. Assume that the deadlock can be resolved by rolling back only one process. P1 has
been rolled back completely once. P2 has been rolled back completely 5 times. P3 has been
rolled back completely 3 times and P4 has not been rolled back before. Which process should
be selected for rollback? Assume that a process is assigned the same process ID when it is
restarted after a rollback. [2 marks]
Ans. P4
SECTION: 3 – Descriptive Type Questions
1. A computer system contains 4 types of resources - R1, R2, R3 and R4. A total of 16 instances
of R1, 12 instances of R2, 13 instances of R3 and 9 instances of R4 are present in the system.
Currently, 6 processes, P1, P2, P3, P4, P5 and P6 are active in the system. The current snapshot
of the system is shown in the table shown below. Determine a safe sequence (if one exists) for
the given system state using Banker’s algorithm. Clearly show all the steps by calculating the
Need data structure and the Available data structure at each step, the conditions that are
satisfied and the sequence in which resource requests of processes can be satisfied. Note that
you can answer this question by typing in the text box provided or uploading your answer.
[8 marks]
Ans.
The Need matrix is
R1
R2
R3
3
3
1
3
2
2
2
3
4
2
4
1
2
3
3
3
2
2
R4
0
2
0
4
0
1
First P5 can execute.
Available = (2, 4, 3, 0) + (3, 1, 0, 0) = (5, 5, 3, 0)
Then P1 can execute
Available = (5, 5, 3, 0) + (2, 0, 1, 0) = (7, 5, 4, 0)
Then P3 can execute
Available = (7, 5, 4, 0) + (2, 1, 1, 1) = (9, 6, 5, 1)
Then P6 can execute
Available = (9, 6, 5, 1) + (3, 3, 2, 2) = (12, 9, 7, 3)
Then P2 can execute
Available = (12, 9, 7, 3) + (0, 1, 3, 4) = (12, 10, 10, 7)
Finally, P4 can execute
Available = (12, 10, 10, 7) + (4, 2, 3, 2) = (16, 12, 13, 9)
The safe sequence is <P5, P1, P3, P6, P2>
2. Consider the following sequence of references to the given page numbers - 1, 3, 4, 1, 3, 2,
2, 1, 3, 5, 4, 3, 2, 4, 1, 3, 2, 5. If LRU page replacement algorithm is used, determine the number
of page faults with 3 physical frames. Assume that the system uses pure demand paging. Show
in detail how the page faults occur and how the pages are replaced. Note that this is an upload
type question.
[8 marks]
Ans.
3. Consider a disk queue with I/O requests to blocks on the following cylinders — 30, 134, 28,
15, 56, 85, 126, 80, 60, 8. Currently the head is at cylinder 52. The system uses the SSTF disk
scheduling algorithm. Assume that the range of cylinder numbers on the disk is from 0 to 199.
Calculate the total head movement for servicing all the I/O requests. Clearly show the sequence
in which the I/O requests are serviced. Also, clearly show the calculations. This is an upload
type question.
[8 marks]
Ans.
4. Consider the set of processes shown in the table below along with their arrival times and
CPU burst cycles given in milliseconds. The processes are scheduled using the SRTF
algorithm. In case of tie, the selection is done based on FCFS. Calculate the average waiting
time. Your answer should contain a proper Gantt Chart and a detailed calculation. This is an
upload type question. [8 marks]
Ans.
Process
Arrival Time
CPU Burst Cycle (in milliseconds)
P1
0
8
P2
1
6
P3
2
4
P4
3
9
P5
5
7
P6
5
8
P7
8
10
P8
11
3
Download