Assignment-OS_Module-2
Assignment-OS_Module-2
Q2: Free memory holes of sizes 15K, 10K, 5K, 25K, 30K, 40K are available. The processes of
size 12K, 2K, 25K, 20K is to be allocated. How processes are placed in first fit, best fit, worst fit.
Calculate internal as well as external fragmentation.
Q3: Calculate page faults for (LRU, FIFO, OPT) for following sequences where page frame is
three.
0,1,2,1,4,2,3,7,2,1,3,5,1,2,5.
Q5: Consider a system consisting of four resources of the same type that are shared by three
processes, each of which needs at most two resources. Is this system deadlock-free? Why or why
not?
Q6: Consider the following snapshot-
Q7. Given 3 processes A, B and C, three resources x,y and z and following events, i) A requests
x ii) A requests y iii) B requests y iv) B requests z v) C requests z vi) C requests x vii) C requests
y Assume that requested resources should always be allocated to the request process if it is
available. Draw the resource allocation graph for the sequences. And also mention whether it is a
deadlock? If it is, how to recover the deadlock.
Q8. A system shares 9 tape drives. The current allocation and maximum requirement of tape
drives for 4 processes are shown below:
Q9. Describe the SSTF disk scheduling algorithm using the following data. The dist head is
initially at position-cylinder 53.the cylinder sequence of requests is 98, 183, 37, 122, 14, 124, 65.
67. Find the total head movement.
Q10. Suppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The drive currently
services a request at cylinder 143, and the previous request was at cylinder 125. the queue of
pending request in FIFO order is 86,1470,913,1774,948,1509,1022,1750,130 Starting from the
current position, what is the total distance(in cylinders) that the disk arm moves to satisfy all
pending requests, for each of the following algorithms i)FCFS ii) SSFT iii) SCAN iv) LOOK v)
C-SCAN.
Q11. The queue of requests in FIFO is 86, 147, 91, 177, 94,150,102,175,130 what is the total
head movement needed to satisfy the requests for the following Scheduling algorithms FCFS,
SJF, SCAN, LOOK, C-SCAN.
Q12. Suppose that the head of moving head disk with 200 tracks numbered 0 to 199 is currently
serving the request at track 143 and has just finished a request at track 125. If the queue request
is kept in FIFO order, 86, 147, 91, 177, 94, 150, 102, 175, 130. What is the total head movement
to satisfy these requests for i) FCFS II) SSTF disk scheduling algorithm
Q13: A system contains three programs and each requires three tape units for its operation. The
minimum number of tape units which the system must have such that deadlocks never arise is
_________.
Q14: Assume that in a certain computer, the virtual addresses are 64 bits long and the physical
addresses are 48 bits long. The memory is word addressable. The page size is 8 kB and the word
size is 4 bytes. The Translation Look-aside Buffer (TLB) in the address translation path has 128
valid entries. At most how many distinct virtual addresses can be translated without any TLB
miss?
Q15: Consider a computer system with 40-bit virtual addressing and page size of sixteen
kilobytes. If the computer system has a one-level page table per process and each page table
entry requires 48 bits, then the size of the per-process page table is __________ megabytes.
Q16: A computer system implements 8 kilobyte pages and a 32-bit physical address space. Each
page table entry contains a valid bit, a dirty bit, three permission bits, and the translation. If the
maximum size of the page table of a process is 24 megabytes, the length of the virtual address
supported by the system is ________ bits.
Q17: Assume that there are 3-page frames which are initially empty. If the page reference string
is 1, 2, 3, 4, 2, 1, 5, 3, 2, 4, 6, the number of page faults using the optimal replacement policy
is__________.
Q18: Consider a paging hardware with a TLB. Assume that the entire page table and all the
pages are in the physical memory. It takes 10 milliseconds to search the TLB and 80
milliseconds to access the physical memory. If the TLB hit ratio is 0.6, the effective memory
access time (in milliseconds) is?
Q20 A system uses FIFO policy for page replacement. It has 4 page frames with no pages loaded
to begin with. The system first accesses 100 distinct pages in some order and then accesses the
same 100 pages but now in the reverse order. How many page faults will occur?
Q21: A process has been allocated 3 page frames. Assume that none of the pages of the process
are available in the memory initially. The process makes the following sequence of page
references (reference string): 1, 2, 1, 3, 7, 4, 5, 6, 3, 1 If optimal page replacement policy is used,
how many page faults occur for the above reference string?
Q22: In a virtual memory system, size of virtual address is 32-bit, size of physical address is 30-
bit, page size is 16 Kbyte and size of each page table entry is 32-bit. The main memory is byte
addressable. Which one of the following is the maximum number of bits that can be used for
storing protection and other information in each page table entry?
Q23: Consider six memory partitions of size 200 KB, 400 KB, 600 KB, 500 KB, 300 KB and
250 KB. These partitions need to be allocated to four processes of sizes 357 KB, 210 KB, 468
KB and 491 KB in that order.
24. Consider a memory management system that uses a page size of 2 KB2 KB.
Assume that both the physical and virtual addresses start from 0. Assume that the pages
0,1,20,1,2, and 33 are stored in the page frames 1,3,21,3,2, and 00, respectively. The physical
address (in decimal format) corresponding to the virtual address 25002500 (in decimal format) is
____
int D[128][128];
Demand paging is used for allocating memory and each physical page frame holds 512 elements
of the array D. The Least Recently Used (LRU) page-replacement policy is used by the operating
system. A total of 30 physical page frames are allocated to a process which executes the
following code snippet:
The number of page faults generated during the execution of this code snippet is _____.
28. Determine the number of page faults when references to pages occur in the order
1,2,4,5,2,1,2,4. Assume that the main memory can accommodate 3 pages and the main memory
already has the pages 1 and 2, with page 1 brought earlier than page 2. (assume LRU i.e., Least-
Recently-Used algorithm is applied).
30. Consider a computer system with ten physical page frames. The system is
provided with an accesses sequence (a1,a2,...,a20,a1,a2,...,a20), where each ai is a distinct virtual
page number. The difference in the number of page faults between the last-in-first-out page
replacement policy and the optimal page replacement policy is ______.