An open API service indexing awesome lists of open source software.

https://github.com/alaszmigiel/ipc-path-encoder

Producer-Consumer system for encoding file paths, implemented with shared memory and semaphores for process synchronization, using signals for process control.
https://github.com/alaszmigiel/ipc-path-encoder

c encoding ipc process-communication shared-memory signals

Last synced: 3 months ago
JSON representation

Producer-Consumer system for encoding file paths, implemented with shared memory and semaphores for process synchronization, using signals for process control.

Awesome Lists containing this project

README

          

# IPC Path Encoder

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
```