How to share semaphores between processes using shared memory
问题 I have to synchronize N client processes with one server. These processes are forked by a main function in which I declared 3 semaphores. I decided to use POSIX semaphores but I don\'t know how to share them between these processes. I thought that shared memory should work correctly, but I have some questions: How can I allocate the right space of memory in my segment? Can I use sizeof(sem_t) in size_t field of shmget in order to allocate exactly the space I need? Does anyone have some