Initialize and allocate semaphore. YOS allocates a semaphore and assigns it an identifier. YOS has exactly 20 semaphores, with identifiers ranging from 1 to 20. It is an error if a process requests a semaphore when all 20 are allocated. Semaphores may only be accessed by the allocating process or one of its descendents.
Semaphores belong to the allocating process.
The YOS semaphore must belong to the current process or to one of its ancestors. It is an error to perform a P operation on a semaphore that has not been allocated or on a semaphore that is not accessible to the calling process. V operation on semaphore. The comments as for P operation apply here as well. If the terminated process has any offspring, then YOS must first terminate the offspring and then terminate the specified process.