If a process needs to access some resource such as a buffer cache buffer that is currently in use, it will issue a sleep() call specifying the address of the resource it requires. A swtch() call is made to relinquish control of the CPU, allowing another process to run. For example, to wait on a busy buffer, the following code sequence is made: if (bp->b_flags & B_BUSY) { bp->b_flags |= B_WANTED; sleep(bp, PRIBIO); } The address of the structure on which the process is waiting (called the wait channel) is stored in the p_wchan field of the proc structure. The priority argument passed to sleep() will be described in more detail later in the chapter. Note for now though that if the priority is greater than or equal to zero, the process may be awoken from a sleep by a signal. A value of less than zero prevents this from happening. When a process is about to relinquish control of a specific resource, it looks to see if another process is waiting on the resource and issues a corresponding wakeup() call to signal to the process that the resource is now available. In this case, the following code sequence is invoked: if (bp->b_flags & B_WANTED) wakeup(bp); To determine which process is sleeping on the resource, a scan is made through the proc table issuing a wakeup() call for each process whose p_wchan field is set to 'bp'. -- Steve D. Pate /Unix Filesystems: Evolution, Design, and Implementation/ Wiley, 2003