Question

In: Computer Science

Suppose the following two processes

Suppose the following two processes, foo and bar, are executed concurrently and share the semaphore variables S and R (each initialized to 1) and the integer variable x (initialized to 0).

Suppose the following two processes, foo and bar, are executed

a. Can the concurrent execution of these two processes result in one or both being blocked forever? If yes, give an execution sequence in which one or both are blocked forever.
b. Can the concurrent execution of these two processes result in the indefinite postponement of one of them? If yes, give an execution sequence in which one is indefinitely postponed.

Solutions

Expert Solution

a. 

Yes. If foo( ) executes semWait(S) and then bar( ) executes semWait(R) both processes will then block when each executes its next instruction. Since each will then be waiting for a semSignal( ) call from the other, neither will ever resume execution.

 

 

 

b. 

No. If either process blocks on a semWait( ) call then either the other process will also block as described in (a) or the other process is executing in its critical section. In the latter case, when the running process leaves its critical section, it will execute a semSignal( ) call, which will awaken the blocked process.


No. If either process blocks on a semWait( ) call then either the other process will also block as described in (a) or the other process is executing in its critical section. In the latter case, when the running process leaves its critical section, it will execute a semSignal( ) call, which will awaken the blocked process.

Related Solutions

7. Suppose a firm has access to two production processes with the following marginal cost curves:...
7. Suppose a firm has access to two production processes with the following marginal cost curves: MC1 = 2Q1 and MC2 = 3Q2 If it wants to produce 30 units of output, how much should it produce with each process? 8. Output for a simple production process is given by Q = 2KL, where K denotes capital and L denotes labor. The price of capital is $25 per unit and capital is fixed at 5 units in the short run....
Suppose that the following processes arrive for execution at time 0 in the order A, B,...
Suppose that the following processes arrive for execution at time 0 in the order A, B, C: process Run Time Priority A 4 1=high B 2 3=low C 3 2=medium Determine the execution order (with the time marks) of these process using the following 4 schedulings: FCFS, SJF, a non-preemptive priority, and RR (time slice = 2). What is the waiting time of each process for each of the scheduling algorithm? Which scheduling algorithm achieves the shortest average waiting time?
Which of the following processes are endothermic? Which of the following processes are endothermic? the reaction...
Which of the following processes are endothermic? Which of the following processes are endothermic? the reaction associated with the ionization energy of potassium. the reaction associated with the heat of formation of CaS. the formation of F2 from its elements in their standard states. the reaction associated with the lattice energy of LiCl. None of the above are endothermic.
Experimental Studies of Reaction Rates Name two molecular processes and the timescales of these processes.
Experimental Studies of Reaction Rates Name two molecular processes and the timescales of these processes.
A company manufactures a product that goes through two processes. You are given the following cost...
A company manufactures a product that goes through two processes. You are given the following cost information about the process for the month of November 2019. Process 1 Process 2 Inputs (units) 15,000 - Finished input from process 1 - 10,000 Finished output in process 2 10,000 - Finished unit output from process 2 - 9,500 Opening WIP – Units - 2,000 Opening WIP - Value - GHS 26,200 Input – Material GHS 26,740 - - Labour GHS 36,150 GHS...
In which of the following processes is (delta)H = (delta)E? Why? (a) Two moles of ammonia...
In which of the following processes is (delta)H = (delta)E? Why? (a) Two moles of ammonia gas are cooled from 325 C to 300 C at 1.2atm (b) One gram of water is vaporized at 100C and 1 atm. (c) A mole of nitrogen gas reacts with a mole of oxygen gas to form two moles of nitric oxide gas in a 40L container. (d) Calcium carbonte is heated to form calcium oxide and carbon dioxide in a container with...
Twinnings Corporation manufactures Scheduling Books. There are two processes: printing and binding. The following information is...
Twinnings Corporation manufactures Scheduling Books. There are two processes: printing and binding. The following information is given for the printing department for September. Units: Units, beginning work in process 40,000 (20% complete for materials, 60% complete for conversion) Started            300,000 Completed     ? Units, ending work in process 50,000 (25% complete for materials, 80% complete for conversion) Costs:                                     Materials         Conversion     Total beginning work in process     $ 6,080           $ 2,160           $ 8,240 current costs...
Explain how resource partitioning may lead to the following two processes : modification of a population's...
Explain how resource partitioning may lead to the following two processes : modification of a population's realized niche speciation.
Explain how resource partitioning may lead to the following two processes : modification of a population's...
Explain how resource partitioning may lead to the following two processes : modification of a population's realized niche speciation.
Leap Company manufactures a product that passes through two processes: Fabrication and Assembly. The following information...
Leap Company manufactures a product that passes through two processes: Fabrication and Assembly. The following information was obtained for the Fabrication Department for September: All materials are added at the beginning of the process. Beginning work in process had 18,000 units, 50 percent complete with respect to conversion costs. Ending work in process had 20,000 units, 25 percent complete with respect to conversion costs. Started in process, 65,000 units. Calculate the Units To Account for  and the Units Accounted For  (Physical Flow...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT