Question
Describe the ignored race condition mentioned in the fragment of code below. What threads are involved in the race? The race is over what exactly?
Describe the ignored race condition mentioned in the fragment of code below. What threads are involved in the race? The race is over what exactly? What condition of the CS problem might be violated, explain? while (true) // wait to be notified, not interrupted try { OKtoBuy.wait(); break; } // notify() after interrupt() race condition ignored catch (InterruptedException e) { continue; } The following code is for a Signal and Continue monitor. There are many customers, and one clerk. Customers randomly pick a lottery ticket from a bag; the clerk replenishes the bag when the bag becomes empty. a. What will be the outcome(s) having instead of while(numTickets != 0)wait(noTickets) just wait(noTickets)? If any condition(s) is(are) not satisfied clearly give the (code) execution sequence(s) that show(s) it. . Customer Bank Clerk pickTickets( ) { replenish( ) { while( numTickets == 0) { signal(noTickets); while(numTickets != 0)wait(noTickets); wait(moreTickets); numTickets = 10; } while(moreTickets.NotEmpty())signal(moreTickets); numTickets--; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started