Dekker’s Algorithm, testAndSet, swap, and the semaphore operations P and V may all be used to enforce mutual exclusion. Compare and contrast these various schemes. Consider their respective advantages and disadvantages.

What will be an ideal response?

Dekker’s Algorithm can be implemented without hardware support, but it only provides mutual exclusion for two threads. testAndSet and swap require hardware support, so they might not be as portable. However, using testAndSet or swap to implement mutual exclusion requires much less code than Dekker’s Algorithm. The difference between testAndSet and swap is extremely subtle. Both testAndSet and swap take in two arguments. However, testAndSet always sets the second variable to be true after execution while swap sets the second variable to be the value of the first argument before the call. These two are interchangeable when used for mutual exclusion. Semaphore operations P and V are higher-level mutually exclusive primitives.They require mutual exclusion to already be performed by another primitive that is used in the implementation of P and V.

Computer Science & Information Technology

You might also like to view...

When you drag a center sizing handle to resize an object, both the height and width are adjusted simultaneously

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following properties creates a 3D shadow effect like the kind in the accompanying figure?

A. 3D-shadow B. box-shadow C. drop-shadow D. h-shadow

Computer Science & Information Technology