Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 [Choose

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_2

Step: 3

blur-text-image_step3

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

ISBN: 0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

1. Diagnose and solve a transfer of training problem.

Answered: 1 week ago