Semaphores

Many modern computer systems therefore provide special hardware instructions that allow us either to test and modify the content of a word or to swap the contents of two words atomically—that is, as one uninterruptible unit.

A semaphore S is an integer variable that, apart from initialization, is accessed only through two standard atomic operations: wait() and signal().

wait(S) {
    while (S <= 0)
        ; // busy wait
    S--;
}

signal(S) { 
    S++;
}

results matching ""

    No results matching ""