Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A.Describe the sequence of event that would lead to the condition where both threads are stuck forever. B.How would you change the above program to

A.Describe the sequence of event that would lead to the condition where both threads are stuck forever.
B.How would you change the above program to prevent the deadlock? image text in transcribed
(7) Semaphores can be used to limit access to resources. The following system uses two threads. Both threads need access to a printer and an SPI (a communication port) port at the same time. The binary semaphore sprint provides mutual exclusive access to the printer, and the binary semaphore sSPI provides mutual exclusive access to the SPI port (the Outs would open a port for communication). The following scenario has a serious flaw: PI function Thread 1 P(&sprint): P(&sSPI); printf ece554 bye"); OutSPI(25); V(&sSPI); V(&sprint); Thread 2 P(&sSPI); P(&sprint); printf("ece554 welcome"); OutSPI(50); V(&sprint); V(&sSPI): Describe the sequence of events that would lead to the condition where both threads are stuck forever. a- b- How would you change the above program to prevent the deadlock

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

Step: 3

blur-text-image

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

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions