Question: (a) Explain why interrupts are not appropriate for implementing synchronization primitives in multiprocessor systems (10 marks) (b) Race conditions are possible in many computer

(a) Explain why interrupts are not appropriate for implementing synchronization primitives in multiprocessor

(a) Explain why interrupts are not appropriate for implementing synchronization primitives in multiprocessor systems (10 marks) (b) Race conditions are possible in many computer systems. Consider a banking system with two methods: deposit(amount) and withdraw( amount). These two methods are passed the amount that is to be deposited withdrawn from a bank account. Assume that a husband and wife share a bank account and that concurrently the husband calls the withdraw() method and the wife calls deposit(). Describe how a race condition is possible and what might be done to prevent the race condition from occurring. (10 marks) (c) Consider the following code segment: pid t pid; pid if (pid = 0) {/* child process */ fork (); thread create ( . . .); fork (); 1. How many unique processes are created? (5 marks) 2. How many unique threads are created? (5 marks) fork (); Design Assignment: Multi-level queue scheduling is used in scenarios where the processes can be classified into groups based on property like process type, CPU time, IO access, memory size, etc. In a multi-level queue scheduling, there will be 'n' number of queues, where 'n' is the number of groups the processes are classified into. Each queue will be assigned a priority and will have its own scheduling algorithm (e.g. round-robin scheduling or FCFS). For the process in a queue to execute, all the queues of priority higher than it should be empty, meaning the process in those high priority queues should have completed its execution. In this type of scheduling, once assigned to a queue, the process will not move to any other queues. Design a scheduling algorithm for this type of scheduling considering the following scenario. All the processes in the system are divided into two categories - system processes and user processes. System processes are to be given higher priority than user processes. The priority of each process ranges from 1 to 3. You may consider fixed priority scheduling for all the processes. (30 Marks) (a) Consider the example in the figure below. IDEI A P1 i) Explain how the four necessary conditions for deadlock are satisfied in this figure (3Marks) ii) We have discussed in class rules of deadlock avoidance, can you state one rule to avoid deadlock in the above figure (2Marks) R1 11 (b) (5 Marks) Consider the example of resource allocation graph in the figure below: P2 R3 COCA DOE R2 P3 d R4 P4 i) Is there a deadlock in the figure above. If yes, determine which processes and resources arevate Window participating in the deadlock. Can we resolve this deadlock by adding more resources? If yes, explain? Settings to activa If no, explain?. In both cases, determine a feasible sequence of processes to show completion. (a) Explain why interrupts are not appropriate for implementing synchronization primitives in multiprocessor systems (10 marks) (b) Race conditions are possible in many computer systems. Consider a banking system with two methods: deposit(amount) and withdraw( amount). These two methods are passed the amount that is to be deposited withdrawn from a bank account. Assume that a husband and wife share a bank account and that concurrently the husband calls the withdraw() method and the wife calls deposit(). Describe how a race condition is possible and what might be done to prevent the race condition from occurring. (10 marks) (c) Consider the following code segment: pid t pid; pid= fork (); if (pid= 0) {/* child process */ fork (); thread create ( . . .); fork (); 1. How many unique processes are created? (5 marks) 2. How many unique threads are created? (5 marks) Design Assignment: Multi-level queue scheduling is used in scenarios where the processes can be classified into groups based on property like process type, CPU time, IO access, memory size, etc. In a multi-level queue scheduling, there will be 'n' number of queues, where 'n' is the number of groups the processes are classified into. Each queue will be assigned a priority and will have its own scheduling algorithm (e.g. round-robin scheduling or FCFS). For the process in a queue to execute, all the queues of priority higher than it should be empty, meaning the process in those high priority queues should have completed its execution. In this type of scheduling, once assigned to a queue, the process will not move to any other queues. Design a scheduling algorithm for this type of scheduling considering the following scenario. All the processes in the system are divided into two categories - system processes and user processes. System processes are to be given higher priority than user processes. The priority of each process ranges from 1 to 3. You may consider fixed priority scheduling for all the processes. (30 Marks) (a) Consider the example in the figure below. IDEI A P1 i) Explain how the four necessary conditions for deadlock are satisfied in this figure (3Marks) ii) We have discussed in class rules of deadlock avoidance, can you state one rule to avoid deadlock in the above figure (2Marks) R1 11 (b) (5 Marks) Consider the example of resource allocation graph in the figure below: P2 R3 COCA DOE R2 P3 d R4 P4 i) Is there a deadlock in the figure above. If yes, determine which processes and resources arevate Window participating in the deadlock. Can we resolve this deadlock by adding more resources? If yes, explain? Settings to activa If no, explain?. In both cases, determine a feasible sequence of processes to show completion.

Step by Step Solution

3.37 Rating (147 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The image you sent is a question from a computer science exam paper It asks students to explain why ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!