a) Consider four concurrent processes A, B, C, and D, synchronized by two semaphores ‘s1’…

Ace your studies with our custom writing services! We've got your back for top grades and timely submissions, so you can say goodbye to the stress. Trust us to get you there!


Order a Similar Paper Order a Different Paper

a) Consider four concurrent processes A, B, C, and D, synchronized by two

semaphores 's1' and 's2'. Initially, s1 = 1 and s2 = 0.

process A = process B = process C = process D =

wait ( s1 ) wait ( s1 ) wait ( s2 ) wait ( s1 )

print 'a' print 'b' print 'c' print 'd'

signal( s1 ) signal( s2 ) signal( s1 ) signal( s1 )

i) Suppose 'a' is printed first. List the characters that can be printed

as the last character of the string. Justify your answer.

ii) Suppose 'b' is printed first. List the characters that can be printed

as the last character of the string. Justify your answer.

b) Consider a different example. Initially, atom = 1 and goB = 0.

process A = process B =

'do' j := 1 to m —> 'do' j := 1 to n —>

wait (atom) wait (atom)

… …

signal (goB) wait (goB)

… …

signal (atom) signal (atom)

'od' 'od'

i) Let m > n. In this case, does there exist an execution scenario in

which both processes block permanently? Does there exist an execution

scenario in which neither process blocks permanently? Justify your answers.

ii) Let m

which both processes block permanently? Does there exist an execution

scenario in which neither process blocks permanently? Justify your answers.

Writerbay.net

Looking for top-notch essay writing services? We've got you covered! Connect with our writing experts today. Placing your order is easy, taking less than 5 minutes. Click below to get started.


Order a Similar Paper Order a Different Paper