Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A producer and a consumer threads are sharing a buffer as shown below. The buffer is initialized with blank characters in each position. Semaphores A,

A producer and a consumer threads are sharing a buffer as shown below. The buffer is initialized with blank characters in each position. Semaphores A, B, and C are used to protect the buffer and are initialized properly. After the threads have been running for a while, the buffer appears as shown below and the threads are executing at the location shown by the arrows below. If the last character placed in the buffer was d and the value of semaphore A is 4, answer the questions below.

a t x y j c b f u d w q
Consumer Producer
Do other calculations <---------- P(B)
P(A) P(C)
P(C) Place item in buffer
Read item from buffer V(C)
V(C) do other caclulations <---------
V(B) V(A)

a)What was the value of semaphore B when it was initialized? ______________

b)What is the value of semaphore B now? ________________

c)What was the value of semaphore C when it was initialized? _______________

d)Which specific characters, those are still in the buffer, HAVE BEEN READ by the consumer? _________________

Please please not just anwser -- really looking for explanation!

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago