{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

p7-hemmendinger - Comments on"A correct and unrestrictive...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Comments on "A correct and unrestrictive implementation of general semaphores" David Hemmendinger Department of Computer Science and Engineering Wright State University Dayton, Ohio 45435 [email protected] CS.wright.edu Kearns [4] offers an implementation of general semaphores from binary semaphores that he argues is better than the one I gave in [3], which I have since found in [1, pp. 56-57] and in [5]. First, he has misquoted my solution in his Figure 1 by adding a spurious else in the code for P, making it quite erroneous. Second, his proposed solution is incorrect. It restores the bug that my version eliminates and adds a new one as well. If two processes are in the midst of a P operation but have not actually suspended yet, his version permits two processes to execute V and do two VB's on an unlocked binary semaphore, with undefined result. Furthermore, Kearns uses a counter, s.wakecount to record the number of pending wakeup signals not yet consumed by the processes that are in the midst of executing P operations. However, since each increment of s.wakecount by a V does a VB(s.delay), and each pro- cess engaged in the P also does VB(s.delay) when s.wakecount > 0, if there are N suspended processes when N V's are done, there will be 2N-1 VB's executed. Both mistakes can be corrected by adding the italicized line to his code for V: Procedure V (var s : semaphore); begin PB(s.mutex); s.count := s.count + 1; if s.count < 0
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern