https://github.com/alaszmigiel/ipc-file-processor
Producer-Consumer system implemented with shared memory, semaphores, and signals for process synchronization.
https://github.com/alaszmigiel/ipc-file-processor
c ipc process-communication shared-memory signals
Last synced: over 1 year ago
JSON representation
Producer-Consumer system implemented with shared memory, semaphores, and signals for process synchronization.
- Host: GitHub
- URL: https://github.com/alaszmigiel/ipc-file-processor
- Owner: alaszmigiel
- Created: 2025-03-17T22:50:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-19T13:21:28.000Z (over 1 year ago)
- Last Synced: 2025-03-19T14:27:24.346Z (over 1 year ago)
- Topics: c, ipc, process-communication, shared-memory, signals
- Language: C
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IPC File Processor
This project demonstrates an **Inter-Process Communication (IPC) system** implementing a **Producer-Consumer** model utilizing **shared memory** and **semaphores** to enable communication between multiple processes.
Program consists of three main processes:
- **Process 1:** Reads a directory path from the user and sends file paths to Process 2.
- **Process 2:** Encodes received paths into a hexadecimal format and forwards them to Process 3.
- **Process 3:** Stores the received encoded paths in a file.
### Signal Controls
Through **signal handling**, the user can:
- **Terminate** the entire application (`SIGUSR1`) by sending it to **any process**.
- **Pause** (`SIGQUIT`) and **resume** (`SIGCONT`) execution, sent **to worker processes**.
- **Enable or disable encoding** (`SIGUSR2`), sent **to worker processes**.
## System Requirements
This program is designed to run on **Linux** or **macOS**.
If you are using **Windows**, you need to run it inside a **Linux virtual machine** (e.g. VirtualBox).
## Technical Requirements
- C compiler
## Installation & Usage
### 1. Clone the repository:
```sh
git clone https://github.com/alaszmigiel/IPC-File-Processor.git
cd IPC-File-Processor
```
### 2. Compile the program:
```sh
make
```
### 3. Run the program:
```sh
make run
```
### 4. Control execution with signals:
Open a **new terminal window** and use the following commands to control the process:
```sh
kill -SIGUSR1 # Terminate the entire application (can be sent to any process)
kill -SIGQUIT # Pause execution (sent to worker processes)
kill -SIGCONT # Resume execution (sent to worker processes)
kill -SIGUSR2 # Toggle encoding mode (sent to worker processes)
```
### 5. Clean up (Remove compiled files):
To remove all generated object files (`.o`) and binaries, run:
```sh
make clean
```