Question: Based on what you studied in this chapter, explain how to change the code fragment in Figure so that deadlock cannotoccur. shared boolean lockl =

Based on what you studied in this chapter, explain how to change the code fragment in Figure so that deadlock cannotoccur.

shared boolean lockl = FALSE; /* Shared variables */ shared boolean lock2

shared boolean lockl = FALSE; /* Shared variables */ shared boolean lock2 = FALSE; shared list L; Program for p, Program for p. /* Enter crit section to /* Enter crit section to * delete elt from list */ enter (lockl); ; /* Exit critical section */ exit(lock1); ; /* Enter crit section to * update length */ enter (lock2); ; /* Exit critical section */ exit(lock2); * update length / enter (lock2); ; /* Exit critical section */ exit(lock2); ; /* Enter crit section to * add elt to list */ enter (lockl); ; /* Exit critical section */ exit (lockl);

Step by Step Solution

3.43 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This deadlock can be prevented by forcing all processes ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

34-E-CE-OS (482).docx

120 KBs Word File

Students Have Also Explored These Related Computer Engineering Questions!