VP: a new operation for semaphores

  • Authors:
  • K. C. Tai;Richard H. Carver

  • Affiliations:
  • Department of Computer Science, North Carolina State University, Raleigh, NC;Department of Computer Science, George Mason University, Fairfax, VA

  • Venue:
  • ACM SIGOPS Operating Systems Review
  • Year:
  • 1996

Quantified Score

Hi-index 0.00

Visualization

Abstract

A semaphore is a non-negative integer variable on which only operations P and V are allowed. The semaphore construct (with various extensions) is supported by many operating systems and is often used to implement other synchronization constructs. Since the semaphore construct is low-level, a semaphore-based program may contain synchronization errors that are very difficult to detect. In this paper, we propose a new operation VP (s1,s2), where s1 and s2 are distinct or identical semaphores. An execution of VP(s1,s2) by a process T is equivalent to that of "V (s1); P(s2)" except that when T starts the V (s1) operation, T is guaranteed to be the next process to access s2 (i.e., T will execute the P(s2) operation before another process executes a P(s2) or V(s2) operation.) Section 2 shows several examples to illustrate the advantages of the VP operation. Section 3 concludes this paper. In this paper, we assume that the queue for a semaphore is first-in-first-out and that the order of processes blocked in a semaphore queue is the same order in which they executed P operations on the semaphore. We also assume that the scheduling of processes in a concurrent program is fair, i.e., each process ready for execution will eventually be selected as the running process. Programs in this paper use Ada-like syntax.