Professional Documents
Culture Documents
97 Exam 2 Sol
97 Exam 2 Sol
13, 1997)
1.
(a) 8 pts.
<Answer>
Unlike the normal page table the i-th entry contains
information on the page occupying page frame i.
This is used with an associative memory (i.e. TLB)
and on a miss in the associative memory (i.e. TLB miss)
the inverted page table is searched [Tanenbaum p.107].
(b) 8 pts.
<Answer>
Use a hash table
2.
(a) 8 pts.
<Answer>
It is not always true that the more page frames the memory has,
the fewer page faults a program will get.
Ex.) FIFO can cause more page faults with 4 page frames
than with 3 page frmaes for some reference string
[Tanenbaum pp.114-115] (4 pts.).
Stack algorithms:
Page replacement algorithms with the property
that M(m,r) is included in M(m+1,r) for all m, r, and reference
strings, where M is an array keeping track of the state of memory
, m is the number of page frames, and r is an index
into the reference string of the process [Tanenbaum pp. 116-117].
In other words, the set of pages
in memory with m page frames is always a subset of
the set of pages that would be in memory with m + 1 page frames.
(b) 8 pts.
<Answer>
"LIFO (Last-In-First-Out) page replacement algorithm
is a stack algorithm"
Sample proof)
Assumption: The memory is initially empty.
M1: the system with m page frames
M2: the system with m + 1 page frames
P1: the set of pages in memory of M1
P2: the set of pages in memory of M2
f : an index into a given reference string
when the m_{th} page fault occurs
Induction step:
Inductive Hypothesis -
P1 is a subset of P2 when r = n, where n is greater than f.
3.
(a) 8 pts.
Replace the page that has not been used for the longest
period of time.
<Answer>
1, 2, 3, 4, 5, 3, 1, 6, 7, 8, 7, 9, 4, 5, 4, 5, 2, 9
PF PF PF PF PF PF PF PF PF PF PF PF PF
13 page faults
(b) 8 pts.
Replace the page that has the longest forward distance.
<Answer>
1, 2, 3, 4, 5, 3, 1, 6, 7, 8, 7, 9, 4, 5, 4, 5, 2, 9
PF PF PF PF PF PF PF PF PF PF
10 page faults
4.
<16 pts.>
<Answer>
5.
(a) 4 pts.
<Answer>
It can happen that Process A locks account 100 and then tries to get a lock
for account 200 which cannot be locked by Process A
since account 200 has been already locked by another process waiting
for account 100.
(b) 4 pts.
<Answer>
Order accounts (i.e. resource) numerically.
Only after a process locks the lower-numbered
(or the higher-numbered) account first, it locks
the other account.
(c) 4 pts.
<Answer>
- Mutual exclusion
- Hold and wait
- Non-preemption
- Circular wait
(d) 4 pts.
<Answer>
Circular wait condition
6.
(a) 8 pts.
<Answer>
Yes.
There are many ways that make all the processes finish jobs.
Ex.)
<P0,P2,P1,P3,P4>, <P0,P4,P1,P2,P3>, <P2,P0,P1,P3,P4>, ...
(b) 8 pts.
<Answer>
Yes.
P0 can still finish its job
since its resource is already allocated,
even though the sytem grants (0,4,2,0) to P1.
Finishing P0, we have (1,1,1,2) as Available vector
and P4 can get its needs.
Now P1, P2, and P3 can finish its job.
Thus, after granting P1's request
the system is still in a safe state.
7.
(a) 8 pts.
The operating system should erase the block
before releasing it from a security point of view
; however, from a performance point of view
it is not desirable since it needs additional
disk writes.
(b) 8 pts.
Yes.
We can use file names like /usr/bin/csh.