Assume the writepending semaphore was omitted from Figure. Describe a simple sequence of reader and writer activity
Question:
Assume the writepending semaphore was omitted from Figure. Describe a simple sequence of reader and writer activity that causes the solution to fail for the second readers-writerspolicy.
Transcribed Image Text:
writer () { reader () { while (TRUE) { while (TRUE) {
writer () { reader () { while (TRUE) { while (TRUE) { ; P(mutex2); writecount=writeCount+l; if (writeCount==1) P(readBlock); V (mutex2); P(writeBlock); access (resource); V (writeBlock); P(mutex2); writeCount=writeCount-1; ; P(writePending); P(readBlock); P(mutex1); readCount = readCount+1; if(readCount == 1) P(writeBlock); V (mutexl); V(readBlock); V (writePending); access (resource); if (writeCount=30) V(readBlock); P(mutex1); readCount = readCount-1; if(readCount == 0) V(writeBlock); V (mutex1); V ( mutex2); resourceType *resource; int readCount semaphore mutex1 semaphore readBlock = 1; semaphore writePending = 1; semaphore writeBlock = 0, writeCount = 0; 1, mutex2 = 1; /* Start the readers and writers */ fork(reader, 0); /* Could be many */ fork (writer, 0); /* Could be many */
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 66% (12 reviews)
Here is a solution Time Action Result 0 Reader 1 arrives 1 Reader 1 exec...View the full answer
Answered By
Charles mwangi
I am a postgraduate in chemistry (Industrial chemistry with management),with writing experience for more than 3 years.I have specialized in content development,questions,term papers and assignments.Majoring in chemistry,information science,management,human resource management,accounting,business law,marketing,psychology,excl expert ,education and engineering.I have tutored in other different platforms where my DNA includes three key aspects i.e,quality papers,timely and free from any academic malpractices.I frequently engage clients in each and every step to ensure quality service delivery.This is to ensure sustainability of the tutoring aspects as well as the credibility of the platform.
4.30+
2+ Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer Engineering questions
-
Describe a sequence of events similar to that of Figure 17.5 for a. A call from a mobile unit to a fixed subscriber b. A call from a fixed subscriber to a mobile unit
-
Figure 13.28(a) gives the residuals from the simple linear regression model describing the service time data in Exercise 13.5. a. In this exercise we construct a normal plot of the residuals from the...
-
Assume that breaking news causes bond portfolio managers to suddenly expect much higher economic growth. How might bond prices be affected by this expectation? Explain. Now assume that breaking news...
-
The bank portion of the bank reconciliation for Langer Company at November 30, 2017, was as follows. The bank statement contained two memoranda: 1. A credit of $5,285 for the collection of a $5,140...
-
If a U-238 nucleus splits into two even pieces, and each piece emits an alpha particle, what elements are produced?
-
What is the significance of the cutting ratio in machining?
-
The past half century has seen dramatic changes in families in the United States. List some of the changes, tell whether you think they will continue in the future, and speculate on the cultural...
-
The Porsche Club of America sponsors driver education events that provide high-performance driving instruction on actual racetracks. Because safety is a primary consideration at such events, many...
-
Ruby Ltd provides a defined benefit superannuation plan for its senior managers. The following information is available in relation to the plan. Present value of the defined benefit obligation 1 July...
-
Dwayne Johnson refinances his current home mortgage with Rock Mortgage Corp. At the closing, he compares his Closing Disclosure to the Loan Estimate he was given shortly after he applied for the...
-
In the solution to the bounded buffer problem (Figure), consider the ordering of the first two P operations in the producer and the consumer. Suppose the order of the p(full) and the p(mutex)...
-
Two processes, P 1 and P 2 , have been designed so that P 2 prints a byre stream produced by P 1 . Write a skeleton for the procedures executed by P 1 and P 2 to illustrate how they synchronize with...
-
In Chord, assume that the successor of node N12 is N17. Find whether node N12 is the predecessor of any of the following keys. a. K12 b. K15 c. K17 d. K22
-
Rewrite Exercise 5, making MergeLists a linked member function of the Sorted List ADT. Exercise 5 Rewrite Exercise 4, making MergeLists an array-based member function of the Sorted List ADT. Exercise...
-
A merge sort is used to sort an array of 1,000 test scores in descending order. Which of the following statements is true? 1. The sort is fastest if the original test scores are sorted from smallest...
-
How do we tell if a Find operation on a map was successful?
-
Give arguments for and against using functions (such as Swap) to encapsulate frequently used code in a sorting routine.
-
A priority queue is implemented as a heap: 1. Show how the heap would look after this series of operations: 2. What would the values of x, y, and z be after the series of operations in part (a)? 25...
-
(a) Demonstrate that Eq. (6.10) defines a generator of \(\mathrm{SO}(2)\) by examining the \(2 \mathrm{D}\) rotation matrix (6.3) for an infinitesimal rotation \(d \phi\). (b) Show that Eqs. (6.3)...
-
d) For die casting processes: 1. What are the most common metals processed using die casting and discuss why other metals are not commonly die casted? 2. Which die casting machines usually have a...
-
Examine the following material and summarize how its conclusions apply to leadership effectiveness. Francoeur, K. A. 2008. The Relationship Between the FiveFactor Model of Personality and Leadership...
-
To a programmer, a system call looks like any other call to a library procedure. Is it important that a programmer know which library procedures result in system calls? Under what circumstances and...
-
Figure 1-23 shows that a number of UNIX system calls have no Win32 API equivalents. For each of the calls listed as having no Win32 equivalent, what are the consequences for a programmer of...
-
What is the difference between timesharing and multiprogramming systems?
-
You will make a post giving your point-of-view (PoV) on a brand's activities and/or marketing campaign. Give your PoV on what brands can and should do to ensure they are creating a great digital...
-
IM.83 A distribution center for a sporting goods retailer places orders with manufacturers for a variety of items. Among these is a popular standard skateboard, targeted to first-time skate boarders....
-
[5] 5. Determine the area of the shaded region, if the radius of each circle is 5 cm.
Study smarter with the SolutionInn App