When I was working on one Linux based project I came across POSIX semaphores and Shared Memory. That time I developed example code to understand the basic concepts. You can find it in below mentioned my github link. When I find time I will update this post by explain the concepts in much more details.
1. Semaphore – POSIX_semaphore
2. Shared memory – POSIX_SharedMemory
3. Both Combined – POSIX_SHaredMemory_Semaphore
While compiling give -lrt for shared memory example and -lpthread for semaphore example and give both for combination