P/V using SysV semop(2)
Andrew Valencia
vandys at hpisoa1.HP.COM
Fri Aug 26 02:02:30 AEST 1988
/ hpisoa1:comp.unix.wizards / ckl at uwbln.UUCP (Christoph Kuenkel) / 6:45 am Aug 24, 1988 /
>As far as i understand, the documentations does not specify anything at all.
>i cant believe it. is it impossible to implement P/V without starvation?
On many UNICES, the sleep queue isn't FIFO, unlike the run queue. This
can result in real oddities of performance when just depending on sleep/wakeup
for fairness (which the Sys V semaphore code I saw did). I believe that 4.3
has changed the sleep queues to FIFO, as have I for HP-UX. Surprisingly,
nothing broke for either of us.
Lacking this, an obvious and simple technique is to use a semaphore
server process, accessed via messages. This process can then implement
whatever policies he sees fit. Of course, if his policies include
attributes like priority, he might have fun trying to figure out the
true priorities of his client processes when faced with message forgeries.
It goes.
Andy
More information about the Comp.unix.wizards
mailing list