The purpose of this homework is to dust off your OS skillz and provide you with a mechanism for self-evaluation. CSE 221 assumes from the start that you are already familiar with the OS concepts in these problems. As such, you should feel relatively comfortable answering them. If, however, you find the concepts unfamiliar and are struggling to answer them, you should likely take CSE 120 before taking CSE 221.
a) Set value of timer
b) Read the clock
c) Clear memory
d) Turn off interrupts
e) Switch from user to kernel mode
class CountdownEvent {
...private variables...
CountdownEvent (int count) { ... }
void Increment () { ... }
void Decrement () { ... }
void Wait () { ... }
}
class Barrier {
...private variables...
Barrier (int n) { ... }
void Done () { ... }
}
To speed up path name resolution, namei uses a cache of previously resolved paths. When resolving a path, namei caches all prefixes of the path as well. For example, when resolving "/one/two", namei will cache resolutions for "/", "/one", and "/one/two". Furthermore, when resolving a path name, namei will match in its cache the longest prefix of the path name that it can before making disk requests. For example, if "/one" is in the cache and namei needs to resolve "/one/two", it will start with the cached value for "/one" to resolve "/one/two". For the problems below, you may assume that the master block is already in memory and no disk I/O is required to read it. Further assume that all directories and files are one block in size.