---
# System prepended metadata

title: Inter Process Communication

---

# Inter Process Communication

This project is an implementation of Inter Process Communication using Pipes, Fifos and Shared Memory written in the C language for the Linux operating system.

## Motivation

This project was built as part of the coursework for CS3003D: Operating Systems taught by the Computer Science Engineering Department, National Institute of Technology, Calicut. The aim of the project was to implement Inter process communication for the given questions using pipes, fifos and shared memory.

## Requirements
vim, gvim , neovim or any text editor to implement the c code. gcc to build and compile the c code.


## Usage

The steps to implement inter process communication and test it are detailed below:

## Using pipes
Inter process communication using unnamed pipes method.
### Files
```c
program_1.c  //contains code to three processes linked using 3 pipes
```

### Build and compile 

Run the following command to build and compile the program_1.c file to implement pipes.

```bash
gcc program_1.c -o program -lm
```
Make sure to include math.h library header file in the c program and then use -lm command to build it.

### Run
Run the program using the following command
```bash
./program_1
```
## Using fifo
Inter process communication using named pipes method.
### Files

```bash
process_1.c  // writes temperature values into process 2 and reads categories from process 3 and prints the revised temperature.
process2.c  // reads the temperature values from process 1 calculates the average and standard deviation and writes it into process 3.
process3.c // reads the average , standard deviation and temperature values from process 2 and calculates the category and writes it into process 1.
```
### Create the fifo file
Run the following command to create the fifo file in the working directory.

### Build and Compile
Run the following commands to build and compile the files.
```bash
gcc process_1.c -o process_1 
gcc process2.c -o process2 -lm
gcc process3.c -o process3 
```

### Run
Run the following commands in three separate terminals to run the 3 programs.
```bash
./process_1
./process2
./process3
```
## Using shared memory
Inter process communication using shared memory method.
### Files
```bash
1_process.c // Reads the password and displays password strength
2_process.c // counts the characters
3_process.c // writes password strength
```
### Build And Compile
Run the following commands to build and compile the files.
```bash
gcc 1_process.c -o 1_process 
gcc 2_process.c -o 2_process -lm
gcc 3_process.c -o 3_process 
 ```
 ### Run
Run the following commands in three separate terminals to run the 3 programs.
```bash
./1_process
./2_process
./3_process
```
## Author
Kannan Mangalathil (kannan_b180554cs@nitc.ac.in)
## License
This software may be restributed and/or modified under the terms of the GNU General Public License, version 3 or later, as published by the Free Software Foundation.