subject

Given the following code, where id indicates a process number or ID), launch() indicates concurrent start of the processes passed on its parameters, and N is an integer representing the number of processes that will be launched (i. e. processes that will run on that system).

boolean blocked[N];

for(int i = 0; i < N;i++)
blocked[i] = false.
int turn = 0;
int other;

P(int id)
while(true)
blocked[id] = true;

while(turn != id)
if(id == 0 || id == 2)
other = 1;
else other = 0;

while(blocked[other])
{ turn = other;}
turn = id;

/* <<<< CRITICAL SECTION IS EXECUTED HERE>>>>>> */
blocked[id] = false;

a. Will the above code work (achieves mutual execution, good progress and deadlock-free) if launch is called as: launch(P(0), P(1)). Explain your answer in full details and in terms of each of mutual exclusion, good progress and deadlock-free.
b. Will the above code work (achieves mutual execution, good progress and deadlock-free) if launch is called as: launch(P(0), P(1), P(2)). Explain your answer in full details and in terms of each of mutual exclusion, good progress and deadlock-free.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:30
Gerard is currently working as an entry-level customer support technician, but he would like to someday become a software developer. what is the best first step to understand what he should do? ask his manager for a new job or at least a job recommendation study graphic design in order to obtain the necessary skills use career resources to investigate what skills and education are required work part-time as an entry-level web developer question 13 (true/false worth 6 points) (08.03 lc) career resources are used to explore career options and find career information. true false question 14(multiple choice worth 6 points) (08.01 mc) classify the following skills: writing html code, evaluating color theory, using design principles. hard skills interpersonal skills people skills soft skills question 15 (true/false worth 6 points) (08.03 lc) a mentor is a person who is advised, trained, or counseled by a trusted mentee. true false
Answers: 2
question
Computers and Technology, 23.06.2019 00:10
Write a function so that the main0 code below can be replaced by the simpler code that calls function mphandminutes tomiles0. original main0 int main) l double milesperhour-70.0; double minutestraveled = 100.0; double hourstraveled; double milestraveled; hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; cout < "miles" 2 using namespace std; 4 /* your solution goes here/ 6 int maino 1 test passed 7 double milesperhour 70.0 all tests passed 8 double minutestraveled 100.0; 10 cout < < "miles: " < < mphandminutestomiles(milesper-hour, minutestraveled) < < endl; 12 return 0; 13
Answers: 1
question
Computers and Technology, 23.06.2019 01:00
Complete the sentence about a presentation delivery method
Answers: 2
question
Computers and Technology, 23.06.2019 15:30
Hey so i was just trying out some game hacks so i took a paste from online and built it in my visual studio and then suddenly my computer was working or clicking on stuff on its own am i hacked?
Answers: 1
You know the right answer?
Given the following code, where id indicates a process number or ID), launch() indicates concurrent...
Questions
question
Mathematics, 18.05.2021 19:20
question
Mathematics, 18.05.2021 19:20
question
Mathematics, 18.05.2021 19:20