This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: COP4600 Operating Systems Solutions to Homework 1 February 13, 2008 Questions 1. For each of the scheduling scenarios below indicate whether it is possible if threads are implemented at the a) user-level and b) kernel-level. Assume that there are 3 processes (A, B, and C) and Xi denotes a thread in process X. Explain your answer. (a) A0 B0 C0 A0 B1 C0 Answer: a) user-level: Not possible because when CPU is switching from A0 to B1 it is the OS that is doing the switch. Since OS doesn’t know about individual threads in this scheme the best thing it can do when it reschedules process B again is to continue with where B left off at the time of context switch. Since thread B0 was running at the time of context switch then it can only reschedule B0 not B1. b) kernel-level: possible. (b) A0 A1 B0 C0 B1 C1 Answer: a) user-level: Not possible; same reasoning as in (a): OS cannot sched- ule B1 when it reschedules process B also cannot schedule C1 when it reschedules process C. b) kernel-level: possible. (c) B0 C0 A0 C0 C1 B1 Answer: a) user-level: Not possible; same reasoning as in (a): OS cannot sched- ule B1 when it reschedules process B. b) kernel-level: possible. (d) A0 B0 C0 C1 B0 A0 Answer: a) user-level: Possible; same reasoning as in (c). b) kernel-level: possi- ble. 2. Consider the multithreaded web server application discussed in Section 2.2.1 and the pseudo code in Figure 2.9 and indicate the names of the shared data and the name of the function(s) that involve critical region(s). Which classical IPC problem do the critical regions in the web server application correspond to? Write a pseudo code for each of the functions that you characterized as critical region using semaphores or 1 monitors....
View Full Document
- Spring '07
- Operating Systems, Context switch, Thread pool pattern, T2 T1, T3 T2