This repository contains three programs that demonstrate inter-process communication using different mechanisms: FIFOs, Unix Sockets, and Shared Memory. Each mechanism involves sending and receiving strings between two programs.
-
FIFO: This program implements inter-process communication using FIFOs (named pipes). It consists of two programs,fifop1andfifop2, which communicate with each other by sending and receiving strings. -
Socket: This program demonstrates inter-process communication using Unix Sockets. Similar to FIFO IPC, it also consists of two programs,socketp1andsocketp2, that exchange strings between each other. -
SharedMem: This program showcases inter-process communication using Shared Memory. It includes two programs,sharedmemp1andsharedmemp2, that share strings by utilizing shared memory segments.
To run the programs, follow these steps:
-
Clone the entire repository and navigate to the respective folders.
-
Compile the programs by running
makein the corresponding directories:-
For FIFO IPC:
cd FIFO make -
For Socket IPC:
cd Socket make -
For Shared Memory IPC:
cd SharedMem make
-
-
Open two separate terminals for each mechanism and navigate to the respective directories.
-
In one terminal, run the receiving program (P2). In the other terminal, run the sending program (P1). Execute the following commands in the respective terminals:
-
For FIFO IPC:
Terminal 1: ./fifop1 Terminal 2: ./fifop2 -
For Socket IPC:
Terminal 1: ./socketp2 Terminal 2: ./socketp1 -
For Shared Memory IPC:
Terminal 1: ./sharedmemp2 Terminal 2: ./sharedmemp1
Make sure to start the receiving program (P2) before the sending program (P1) to establish proper communication.
-
-
Observe the inter-process communication results in the terminals.