Examples of IPC Systems
- Shared Memory : POSIX Shared Memory
- POSIX : Portable Operating System Interface (for UNIX)
- Message Passing : Pipes
- One of the earliest IPC mechanisms on UNIX systems.
Posix shared memory
-
using memory-mapped files(hdd, ssd가 아닌 memory에 파일 저장)
→ which associate the region of shared memory with a file
-
Producer


Producer process illustrating POSIX shared-memory API
Producer와 차이
- ftruncate(shm_fd, SIZE) → 공유 메모리의 크기를 결정하는 코드가 없다.
- sprintf → 메모리에 쓰지 않고 / printf → 메모리에서 읽어들인다.
- shm_unlink → 공유메모리를 제거한다.


Consumer process illustrating POSIX shared-memory API
Pipes Message Passing
- A pipe acts as a conduit allowing two processes to communicate