Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2nd image is textbook figure. Answer only if u know it is correct and complete. Problems 1. Read the explanation of Table 5.4 on textbook

image text in transcribed

image text in transcribed

2nd image is textbook figure. Answer only if u know it is correct and complete.

Problems 1. Read the explanation of Table 5.4 on textbook page 224 or the notes of slides page 65. First, understand the possible scenario that the consumer consumes an item from the buffer that does not exist. You don't need to explain it in the assignment. Then explain why "It would not do simply to move the conditional statement inside the critical section of the consumer because this could lead to deadlock The modified code that "move the conditional statement inside the critical section" is shown in Fig. 1. Show the scenario that causes deadlock. (30 points) program producereonnum Ent n binary semaphore a day void producer while (true) produce semwait append memsonale delay) semana vold consumen WEBday while tue WALEBO Lake & -semwalde delay SORA vo ALAN Pembe producer one Fig. 1 A modified version of binary semaphores solution with infinite outer produchy Consumen Oconsumer problem A Possible Scenario for the Binary Semaphores solution Producer Consumer S n 1 1 Delay 0 0 semwaits) 0 0 1 1 B 0 0 0 n++ 0 1 if (n=1) (semSignalB (delay)) semsignall(s) 5 Producer adds an item before Consumer checks the buffer The consumer is NOT forced to wait 1 1 semwaitB (delay) 0 1 1 0 0 gemwaitB(3) 1 1 0 8 --- 0 9 semSignalB (s) 1 0 O semwaitB (3) 0 0 0 10 11 n++ 0 0 1 1 0 1 if(n==1) (semSignalB (delay)) semSignalB(s) if (0) (semwaitB (delay)) semwaitB () 1 1 0 1 1 1 0 1 1 1 1 1 0 n-- 0 16 17 18 19 20 21 semSignalB (3) if (n==0) (semwaitB (delay) ) semwait (3) 1 1 0 elo 0 0 n- 0 Note: White areas represent the critical section controlled by semaphores -1 0 semsignalB (3) 1 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

7. Discuss the implications of a skill-based pay plan for training.

Answered: 1 week ago

Question

4. Make recommendations on steps to take to melt the glass ceiling.

Answered: 1 week ago