Briefly describe why a micro-kernel operating system structure is a more robust than a monolithic (simple) operating system structure.
What is the purpose of the process control block (PCB)? Explain the relationship between PCB size and context switch time.
Four processes are ready to run. Their CPU burst times are 5, 12, 1 and 7.
Modify the SOS Dispatcher
to support a class of real-time processes that get selected to run
before any other normal processes. Normal processes only
get to run when there are no real-time processes to run. Show any needed
changes to the struct ProcessDescriptor
data
structure.
Consider running the following psuedo-code on a Unix system:
#include < stdio.h > int main() { int *num, shm_id shm_id = shmget(502) /* get memory */ num = (int *) shmat(shm_id) /* attach to it. Initialize as */ fork() *num = *num + 1 printf("%d ", *num) }
What are the possible outputs?
Add semcreate()
, semwait()
and
semsignal()
system calls to assure that only
the output 1 2
gets printed.
Consider the following pseudo-code implementation
of a semwait()
call:
sema[sid].count--; if (sema[sid].count < 0) { insert(sema[sid].queue, current_process); pd[current_process].state = BLOCKED; Dispatcher(); }
Why might disabling interrupts be ok ensure that there is not a
race condition surrounding the modification of the count
variable? How else might the OS protect count
?
True or False:
Consider the following variant to the two-process Peterson's solution to a critical-section problem:
int flag[1]; /* boolean, shared, one per-process */ int turn; /* shared */ while(1) { flag[my_pid] = true; turn = my_pid; /* usually set to your_pid */ while (flag[your_pid] || turn==your_pid){ /* usually an || */ /* critical section */ flag[my_pid] = false; /* remainder section */ }
Does it work? Explain why or why not.
In the dining philosopher's solution shown in class, suppose philosopher 2 was absentminded and never let go of his left fork, even while thinking. If all the other philosophers behaved normally and kept thinking and eating, what would be the eventual outcome of the system?
Return to the CS3013 Home Page
Send all questions to the TA mailing list.