Re: reviewing the definition of semaphore in sem_overview.7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Ricardo,

On 04/18/2018 05:18 PM, Ricardo Biehl Pasquali wrote:
> Perhaps the current definition of a semaphore in
> sem_overview.7 could be clearer.
> 
>   A semaphore is an integer whose value is never allowed
>   to fall below zero.
> 
> What about the definition from the book [1]_ in the
> section (2.2.5 Semaphores)?
> 
>   [...] an integer variable to count the number of wakeups
>   saved for future use.
> 
> It is simple enough to be easy to understand. Kind of
> self-explanatory.
> 
> Also, the whole "semaphore description" paragraph could be
> rewritten. A proposal as an example:
>
>   Semaphore is a counter of its pending wakeups. A call to
>   sem_wait() consumes one wakeup (decrements counter). If
>   there is no wakeup to be consumed (counter equals zero)
>   sem_wait() blocks. sem_post() adds one wakeup (increments
>   counter).
> 
> or something like:
> 
>   A semaphore is represented by an integer that stores the
>   number of semaphore's pending wakeups (i.e., the number
>   of calls to sem_wait() that won't block). [...]
> 
> Maybe I'm talking bullshit, but at least it's worth to
> check it out.

FWIW, I find the above less clear than the existing text.
But, I did write that text. I'm open to more opinions on
the subject, but I'm not (so far) inclined to change the
text.

Cheers,

Michael
 
> .. [1] Operating systems: design and implementation; 1997;
>        Andrew S. Tanenbaum, Albert S. Woodhull; 2nd ed.
> 
> Cheers!
> 
> 	pasquali
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux