Beruflich Dokumente
Kultur Dokumente
a. Mutual exclusion
b. Hold and wait
c. No preemption
d. Circular wait
e. None of above
a. Deadlock Prevention
b. Deadlock Avoidance
c. Deadlock Detection and Recovery
d. Deadlock Ignorance
e. None of above
(b) 5. A computer provides the user with virtual address space of 2^32
(2 to the power 32) bytes. Pages of size 4096 (4K or 2^12) bytes
are used for implementing virtual memory where the total physical
memory is equal to 2^18 bytes. If the hexadecimal virtual
address is 23456111, the page number in hexadecimal would be:
a. 3456
b. 23456
c. 56111
d. 4096
(c) 6. In paging system where page size is 2048 words, and the available
physical memory is equal to 2 ^ 17 = 128 K words, the length of the
physical address is equal to:
(c) 7. If normal memory access time is 100 nanoseconds and the cache search
time is 20 nanoseconds and all 80% of the page table entries are
found in the cache memory the paged memory access time is equal to:
(c) 10. If there are 64 segments, and the maximum segment size is 1024
words, the length of logical address is:
(c) 11. Assume a page reference string for a process with m frames
(initially all empty). The page reference string has length p with
n distinct page numbers occurring in it. For any page replacement
algorithms, What is a lower bound on the number of page faults?
a. m
b. p
c. n
d. None of above
(b) 12. Assume a page reference string for a process with m frames
(initially all empty). The page reference string has length p with
n distinct page numbers occurring in it. For any page replacement
algorithms, What is an upper bound on the number of page faults?
a. m
b. p
c. n
d. None of above
(c) 14. The modified (dirty) bit is used for the purpose of:
Ans:
Ans:
a.
b. Consider the resource-allocation graph in Figure 8.2. Two cycles
exist in the system.
Ans:
o Deadlock Ignorance: Ignore the problem and pretend that deadlocks never
occur in the system; used by most operating systems, including UNIX.
o Deadlock Detection and Recovery: Allow the system to enter a deadlock
state and then recover.
o Deadlock Avoidance: Avoid system to enter a deadlock state.
o Deadlock Prevention: Negate one of the four conditions necessary
to cause a deadlock.
Ans:
Ans:
+---+-----+------+--------+--------+-----+--+
|xxx| P3 | xxxx | P5 | xxxxxx | P7 |xx|
+---+-----+------+--------+--------+-----+--+
0 50 160 240 320 420 480 500
Note that P3, P5, and P7 are processes in memory. Assume that process
P3 was just swapped into memory. Consider each of the four swapping
algorithms discussed in class: first fit, next fit, best fit and worst
fit, Complete the table showing where each of the processes will be
loaded.
Assume that new processes arrive in the order P8, P9, P10, and are of
size 50K, 70K, and 45K, respectively.
Ans:
First fit:
+---+-----+----+-+--------+---+----+-----+--+
|P8 | P3 | P9 |x| P5 |P10| xx | P7 |xx|
+---+-----+----+-+--------+---+----+-----+--+
0 50 160 230 240 320 365 420 480 500
Next fit (It fits in the memory it could fit next to the previous
assignment):
+---+-+-----+---+--+--------+----+--+-----+--+
|P10|x|P3 |P8 |xx| P5 | P9 | x| P7 |xx|
+---+-+-----+---+--+--------+----+--+-----+--+
0 45 50 160 210 240 320 390 420 480 500
* Note: In this case, first and next fits are same. But in many cases,
they could be different.
Best fit:
+---+-----+----+-+--------+---+----+-----+--+
|P8 | P3 | P9 |x| P5 |P10| xx | P7 |xx|
+---+-----+----+-+--------+---+----+-----+--+
0 50 160 230 240 320 365 420 480 500
Worst fit:
+---+-+-----+----+-+--------+---+----+-----+--+
|P10|x| P3 | P9 |x| P5 |P8 | xx | P7 |xx|
+---+-+-----+----+-+--------+---+----+-----+--+
0 45 50 160 230 240 320 370 420 480 500
Ans:
Ans:
b. What page fault rate is needed to have the effective access time of
less than 110 nanoseconds?
Ans:
Ans:
b) 110 - 50 * p < 70
50 * p > 40
p > 80%
10. Under what circumstances do page faults occur? Describe the actions
taken by the operating system when a page fault occurs.
Ans:
A page fault occurs when an access to a page that has not been brought
into main memory takes place. The operating system verifies the memory
access, aborting the program if it is invalid. If it is valid, a free
frame is located and I/O is requested to read the needed page into the
free frame. Upon completion of I/O, the process table and page table are
updated and the instruction is restarted.
a. LRU replacement
b. FIFO replacement
c. Optimal replacement
d. Second-chance replacement
Ans:
12. Suppose there are 16 virtual pages and 4 page frames. Determine
the number of page faults that will occur with the reference
string 1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6 if the page frames
are initially empty, using each of the following page replacement
algorithms: a. LRU b. FIFO c. Optimal.
Ans:
a. LRU - 10
b. FIFO - 14
c. Optimal - 8
13. What is the cause of thrashing? How does the system detect thrashing?
Once it detects thrashing, what can the system do to eliminate this
problem?
Ans:
Ans:
15. Consider the average process size is 128 KB and the number of page
entries is 8. What will be appropriate page size?
Ans: