semncnt (the counter of processes waiting for this semaphore's value to increase) is incremented by one and the process sleeps until one of the following occurs: · semval becomes greater than or equal to the absolute value of sem_op, at which time the value of semncnt is decremented, the abso‐ lute value of sem_op is subtracted from semval and, if SEM_UNDO is specified for this operation, the system updates the process undo count (semadj) for this semaphore. · The semaphore set is removed from the system: semop() fails, with errno set to EIDRM. · The calling process catches a signal: the value of semncnt is decre‐ mented and semop() fails, with errno set to EINTR. · The time limit specified by timeout in a semtimedop() call expires: the system call fails, with errno set to EAGAIN. |
If there is no context switch(process currently executing V(bm) doesn't change to process with bm waiting), the process with waiting bm won't change anything and would keep waiting? |
,is it possible that if process that executed V(bm) keeps going and executes P(bm) and sets bm.semval=0 again, and then switches to process waiting it will find that process waiting doesn't fulfill the condition to stop waiting anymore and process will keep waiting? |