P/V using SysV semop(2)

R.HUTCHISON hutch at lzaz.ATT.COM
Tue Aug 30 01:08:23 AEST 1988


>From article <2200029 at hpisoa1.HP.COM>, by vandys at hpisoa1.HP.COM (Andrew Valencia):
] / hpisoa1:comp.unix.wizards / hutch at lzaz.ATT.COM (R.HUTCHISON) /  5:45 am  Aug 25, 1988 /
]>The order is predictable - it is Last-In-First-Out.  This is because
]>processes waiting for semaphores move back and forth between the run
]>queue and sleep queues each time there is a possibility that a process
]>can be awakened.
] 
]     I don't know about your implementation, but on ours user processes change
] priority as they consume (and over-consume :->) CPU and then fall idle.  So
] when a batch of processes move from the sleep queue to the run queue, there's
] no simple way (from a user's perspective) to say who's going to run.
] 
...
] 					Andy

Ah, but all processes sleeping awaiting a semaphore "unblock" sleep with the
same priority (PSEMN)- the CPU consumption factor (p_cpu) is not taken into
consideration when assigning priorities to sleeping processes.  Processes
are removed from the run queue using the following rules:

1) select the process with the highest priority
2) if there is a tie, select the one nearest the end of the queue

All processes sleeping on a semaphore sleep at priority PSEMN.  WHen
they are put on the run queue, they will have the same priority.  In
this case, their ordering is important.


Bob Hutchison
att!lzaz!hutch



More information about the Comp.unix.wizards mailing list