Question

In: Computer Science

14) Fill in the three blanks in the following such that two processes executing the code cannot enter the critical section at the same time. key is a local Boolean variable.

Operating System Questions

14) Fill in the three blanks in the following such that two processes executing the code cannot enter the critical section at the same time. key is a local Boolean variable. The swap function swaps the contents of the two arguments.

do {
key = ______________;

while (key == FALSE) Swap (&lock, &key);

/* critical section */

lock = _____________;

/* remainder section */ } while (TRUE);

lock is a shared Boolean variable initialized to ___________.

15) signal(mutex) without a corresponding wait(mutex) on a binary semaphore mutex can potentially lead to a deadlock. [ TRUE / FALSE ]


Solutions

Expert Solution

Question 14:

do {
key = ____FALSE__________;

while (key == FALSE) Swap (&lock, &key);

/* critical section */

lock = FALSE_____________;

/* remainder section */ } while (TRUE);

lock is a shared Boolean variable initialized to __FALSE_________.

15) signal(mutex) without a corresponding wait(mutex) on a binary semaphore mutex can potentially lead to a deadlock

Answer: Its true with out binary semaphore mutex can lead to deadlock.


Related Solutions

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT