






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
These are the Exam of Operating System which includes Caller-Save, Trap Frame, Interrupt Handling, Latest, Processor-Architecture News, Building, Management, Analysis, Management etc.Key important points are: Keyboard Interrupts, Keyboard Controller, Person, Reasonable Scheduling, Processes Running, Blocking Getchar, Quantum Values, Kernel Similar, Implementing, Child Process
Typology: Exams
1 / 10
This page cannot be seen from the preview
Don't miss anything!







(b) Here are graph nodes for three states a process can be in. Draw directed arcs (i.e., arrows) between the nodes to indicate all legal transitions. Label each arc with a 1-word summary term and then, below the figure, provide a brief explanation (1 or 2 sentences should suffice) of what you meant by each summary term. For any node pair (i,j) you do not need to draw more than a single arc from i to j, i.e., you do not need to draw more than six arcs (and you may need to draw fewer). Another way to say this is that, for each transition, you need provide us with only one explanation of why such a transition happens.
running
sleeping
runnable
(c) Imagine you and your programming partner are both logged in to UNIX3.ANDREW.CMU.EDU when you are seized by an impulse to disrupt your partner’s calm, cool demeanor. Your first idea is to write a C program which will write zeroes throughout the address space of your partner’s shell (command interpreter, i.e., bash, tcsh, etc.). To your sadness you discover that the operating system has placed an insurmountable hardware barrier in your path. Explain why you have no hope of accessing memory belonging to your partner’s processes.
struct mutex {
void mutex_init(struct mutex *mp) {
void mutex_lock(struct mutex *mp) {
void mutex_unlock(struct mutex *mp) {
int cards[6][6]; mutex lock[6][6]; mutex pairs_lock; int pairs_left; int everybody_done;
void init(void) { ...shuffle 36-card deck into cards[ ][ ] ...mutex_init() all of lock[ ][ ]... mutex_init(&pairs_lock); pairs_left = 18; everybody_done = 0; }
int play() { int score = 0; while (!everybody_done) { int i1, j1, i2, j2, tmp1, tmp2, tmp3, tmp4;
i1 = generate_random(0, 5); j1 = generate_random(0, 5); i2 = generate_random(0, 5); j2 = generate_random(0, 5);
if ((i1 == i2) && (j1 == j2)) continue;
mutex_lock(lock[i1][j1]); mutex_lock(lock[i2][j2]);
if ((cards[i1][j1] == cards[i2][j2]) && (cards[i1][j1] != GONE)) { ++score; cards[i1][j1] = cards[i2][j2] = GONE; mutex_lock(pairs_lock); if (--pairs_left == 0) everybody_done = 1; mutex_unlock(pairs_lock); } mutex_unlock(lock[i1][j1]); mutex_unlock(lock[i2][j2]); } return (score); }
boolean waiting[2] = { false, false }; int turn = 0;
(This protocol is presented in the standard form, i.e., if process 0 is running this code, i == 0 and j == 1; if process 1 is running this code, i == 1 and j == 0.) There is a problem with this protocol. That is, it does not ensure that all three require- ments (mutual exclusion, progress, and bounded waiting) are always met. Identify a requirement which is not met and lay out a scenario which demonstrates your claim. Use the format presented in class, i.e., P0 P waiting[0] = false; turn = 0;