Problem 2. ---------- Main concerns: (1) efficiency and (2) tighter control of hardware (3) would require use of nonstandard (even if existent) language features to deal with specific hardware Problem 10. ---------- typedef struct Semaphore_ { int value; // the value of the semaphore Queue wait_queuel // quueue of processes stopped at the semaphore } Semaphore; int down(Semaphore s) { DisableInterupts(); s.value = s.value - 1; if (s.value < 0) { add the current process in s.wait_queue schedule another process } EnableInterupts(); } int up(Semaphore s) { DisableInterupts(); s.value = s.value + 1; if (s.value <= 0) { proc = first process in the semaphore queue add proc in the 'ready to run' queue } EnableInterupts(); } Problem 14. ---------- One solution is to implement a mechanism similar to a pipe as a communication buffer between order tackers and cooks (or between cooks and packaging specialists ...). One possibility is to simply use the pipe provided by the system, another is to implement the pipe using Message Passing. Problem 21. ---------- a) Scheduling quanta 1ms. Mean turnaround time: aprox 22. b) Scheduling order: 6 8 10 2 4. Mean turnaround time: (6+(6+8)+(6+8+10)+(6+8+10+2)+(6+8+10+2+4))/5 = 20 c) Scheduling order: 10 6 2 4 8. Mean turnaround time: (10+(10+6)+(10+6+2)+(10+6+2+4)+(10+6+2+4+8))/5 = 19.2 d) Scheduling order: 2 4 6 8 10. Mean turnaround time: (2+(2+4)+(2+4+6)+(2+4+6+8)+(2+4+6+8+10))/5 = 14