nhưng thậm chí không chứa bất kỳ mục. Đầu tiên có lẽ là một thiếu sót. Thứ hai chỉ ra rằng chúng ta có thể chụm lại mặt hàng của chúng tôi để tất cả chúng đều chạy vào = qua mã thông báo, như thế này: | Creating and Managing Processes Simpo PDF Merge and Split Unregistered Version - http Alternatively we can get manipulate and set a stat object as returned by the stat method in the same manner as IPC Msg objects. Name Action stat Generate an IPC Semaphore stat object we can manipulate and then use with set. For example semstat sem- stat semstat- mode 0722 sem- set semstat getpid Return the process ID of the last process to perform a semop operation on the semaphore set. getncnt Return the number of processes that have executed a semop and are blocked waiting for the value of the specified semaphore to increase in value. ncnt sem- getncnt getzcnt Return the number of processes that have executed a semop and are blocked waiting for the value of the specified semaphore to become zero. The real power of semaphores is bound up in the op method which performs one or more semaphore operations on a semaphore set. This is the mechanism by which processes can block and be unblocked by other processes. Each operation consists of three values the semaphore number to operate on an operation to perform and a flag value. The operation is actually a value to increment or decrement by and follows these rules If the value is positive the semaphore value is incremented by the supplied value. This always succeeds and never blocks. If the supplied value is zero and the semaphore value is zero the operation succeeds. If the semaphore value is not zero then the operation blocks until the semaphore value becomes zero. This increases the value returned by getzcnt. If the value is negative then the semaphore value is decremented by this value unless this would take the value of the semaphore negative. In this case the operation blocks until the semaphore becomes sufficiently positive enough to allow the decrement to happen. This increases the value returned by getncnt. We can choose to operate as many semaphores as we like. All operations must be able to complete before .