Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 questions please!! (Mark all that apply) Which of the following may occur when a process calls broadcast on a condition variable? Assume a single-core
2 questions please!!
(Mark all that apply) Which of the following may occur when a process calls broadcast on a condition variable? Assume a single-core system. D more than one process wake up but only one of them immediately runs no process wakes up more than one process wake up and all of them immediately run one process wakes up and immediately runs Done process wakes up and stays in the ready queue Dmore than one process wake up and all of them stay in the ready queue Question 4 1 pts Consider the following implementation at an array-based stack data structure for a multi-threaded application. 1: const HaxSlackSize = 100; 7: 3: class Stack { 4: 1/ throws an exception wien popping an empty stock, 5: // and when pushing into a full slack 6; //Shared variables 7: private int S[MoxStack Size); //stack array private int stockp: // stock top private Seraphore sem; // For Mulual exclusion 10: 11: public Stack ! 12: stackp - ; 13: se = nen Senophore(1): 14:3 15: 16public int Stack::pop() { 17 sen.down: 18: if(stackp -- ) { 19: throw new EmptyStockExceptionempty stack"); 20 } 21 sem upo: 77: return $[-stacks 23:3 24: 25: public void push(int iten) 76: sendo; 27: if(stackp - MaxStackSize) { 28 throw new FullStackexception('full stock"); 29: ] S[stackn-+] - item; 31: sem upo); 32: 33: ) The implementation has three synchronization bugs. Match each line of code with the bug that it has. This question is adapted from https://www.cs.utexas.edu/lorenzo/corsi/cs372/06F/. Line 19 [Choose1 Line 22 Choose1 Line 28 [ChooseStep 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