Unit 2


Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess Communication; Threads- Overview, Multicore Programming, Multithreading Models; Windows 7 - Thread and SMP Management. Process Synchronization - Critical Section Problem, Mutex Locks, Semophores, Monitors; CPU Scheduling and Deadlocks. I

Part A

# Question
1 When a system is said to be in safe state?
2 What is a critical section and what requirements must a solution to the critical solution problem satisfy?
3 Is it possible to have a deadlock with only one process? Justify your answer
4 Compare user threads and kernel threads.
5 Show that mutual exclusion will be violated if the signal and wait operations are not executed atomically
6 Is it possible to prevent the occurrence of deadlock? Under what conditions?
7 If there is a cycle in the resource allocation graph, it may or maynot be in deadlock state �. Comment on this statement.
8 How can you judge a scheduling algorithm to be the best? Define any four scheduling criteria used to compare the scheduling algorithms
9 What is race condition?

Part B

# Question
1 (i)Explain the FCFS, preemptive and non-preemptive versions of ShortestJobFirstandRoundRobin(time-slice2)scheduling algorithmswithGanttChartforthefourprocessesgiven. Compare their average turn around and waiting time. (9) Process Arrival Time Burst time P1 0 10 P2 1 6 P3 2 12 P4 3 15 (ii)Discuss how deadlock could be detected in detail (4)
2 (i)Describe about short- term, Mid-term, Long-term scheduling. (7) ii)Explain about Inter Process Communication. (6)
3 (i) Compare the advantages of threads over multiple processes? What Major advantages do they have? (6) (ii) Explain in detail Process control block (7)
4 (i)Discuss various states of a process (6) (ii) Examine thread and SMP management. (7)
5 (i)Canyoudiscusstheadvantagesofthreadsovermultiple processes? What major disadvantages do they have? And also elaborate the various issues associated with the thread in detail? (7) (ii) What is a process? Describe the operation on a process in detail. (6)
6 (i)Illustrate the actions taken by a kernel to context-switch between processes(7) (ii)Identify two programming examples in which multithreading does not provide better performance than a single threaded solution(6)
7 List the differences in degree to which the following scheduling algorithms discriminate in favour of short processes a)FCFS (3) b) RR (5) c) Multilevel feedback queue (5)
8 (i)Show how wait() and signal() semaphore operations could be implemented in multiprocessor environments, using Test and Set instructions. The solution should exhibit minimal busy waiting. Develop pseudo code for implementing operations. (7) (ii)Discuss about issues to be considered with multithreaded programs (6)
9 (i)The OS contains 3 resources ,the number of instance of each resource type are 7,7,10.the current resource allocation state is as shown below. ProcessCurrent locationMaximum need R1 R2 R3 R1 R2 R3 P12 2 23 6 8 P22 0 34 3 3 P31 2 43 4 4 Is the current allocation in a safe state?Evaluate. (4) (ii)ExplainCriticalsectionproblemanddiscussthe requirementsthatasolutiontothecriticalsectionmust justify (9)
10 (i)Describe various approaches for recovering from deadlock (7) (ii) Define semaphore. Explain the use of semaphore in synchronization problem with an example (6)
11 Write about deadlock conditions and banker's algorithm in detail . (13)
12 (i)Give a solution for readers writers problem using condition critical regions. (7) (ii) How does deadlock avoidance differ from deadlock prevention? (6)
13 (i)What are the criteria for evaluating the performance of scheduling algorithms? (4) (ii)Discuss about the approaches for evaluating the scheduling algorithms. (9)
14 Construct a Resource Allocation Graph for the following scenario. At time �t� Process P1 request for a resource X, process P2 requests for a resource Y. Both the resources are Available and they are allocated to the requesting process. At time t1 where t1>t2 both the processes are still holding the resources, however process P1 request for Y which is held by P2, process P2 request for X held by P1. Will there beadeadlock?ifthereisadeadlockdiscussthefour necessary conditions for deadlock, else justify there is no deadlock .(13)