Hardware Solutions

  1. One can change the "Test and Set" solution such that is meets the bounded waiting condition, using two shared data structures: boolean lock and boolean waiting[N], where N is the number of processes wanting to execute their critical sections (see pseudocode on the next slide.)

    The key feature of this method is that when exiting a critical section, the exiting process does not just unlock the critical section and allows any other process execute the section. Rather, it first looks in an orderly progression (starting with the next process on the list) for a process that has been waiting, and if it finds one, then it releases that particular process from its waiting state, without unlocking the critical section, thereby allowing a specific process into the critical section while continuing to block all the others.

    Unfortunately, hardware level locks are especially difficult to implement in multi-processor architectures.