markpasc (markpasc) wrote,

  • Music:


It only just occurs to me that, yes, I'm doing multithreading in winget and, yes, I have to think a lot less about it because recently departed E.W. Dijkstra thought so much about it. It only occurred to me when I was looking through my CS261 Intro to OS lab manual and reading:

There are four types of kernel objects explicitly intended to perform different forms of [thread] synchronization [in Windows NT].... The behavior of each of these synchronization objects is inspired by Dijkstra's semaphores (explained more fully in your textbook). Briefly, a Dijkstra semaphore behaves like an abstract data type. It is made up of a private integer variable, s, that can be manipulated only by using the abstract data type's P and V member functions. P and V behave as follows.

P(s): [while(s == 0) wait(); s--;]
V(s): [s++;]

The square braces around the P and V code are meant to emphasize that P and V are atomic operations, meaning that once they start they cannot be interrupted until they have completed. The wait operation in the P selectively breaks this uninterruptable assumption by allowing other threads to execute while s is equal to zero.

And, of course, being Dutch, he named his P and V functions with names cryptic to Anglophones: proberen meaning to test, and verhogen meaning to increment. In case you wondered.

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened