Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/d4vidsha/process-manager

A process manager written in C.
https://github.com/d4vidsha/process-manager

Last synced: 1 day ago
JSON representation

A process manager written in C.

Awesome Lists containing this project

README

        

# Process Manager

In this project, we implement a _process manager_ capable of allocating memory to processes and scheduling them for execution. The process scheduling and memory allocation are simulated. There is a _challenge task_ that requires controlling real processes and relies on interprocess communication system calls such as `pipe`, `fork`, `dup2` and `exec`. We will assume only one process is running at a time, i.e. a single-core CPU.

Both the memory manager and the process queues are implemented as linked lists. More specifically, the memory manager is implemented as a linked list of _memory blocks_ (`block_t`) and the process queues are implemented as linked lists of _process control blocks_ (`pcb_t`).

## Modules

- `main`: the main program including the process manager
- `process`: used to simulate real processes
- `linkedlist`: implementation for storing any data type
- `memorymanager`: the memory manager API
- `pcb`: the process control block API
- `process-api`: API that controls `process`

## How to compile

```bash
make # compile the main program
make process # compile process executable, used to simulate real processes
```

## Options

All options are required.

- `-f `: the file containing the processes to be managed
- `-s `: the scheduler to use. Can be `SJF` or `RR`
- `-m `: the memory allocation algorithm to use. Can be `infinite` or `best-fit`
- `-q `: the quantum of each cycle

## Run test cases

Copy and paste any or all commands into the terminal to run the test cases. No output indicates that the test case/s passed.

```bash
./allocate -f tests/task1/simple.txt -s SJF -m infinite -q 1 | diff - tests/task1/simple-sjf.out
./allocate -f tests/task1/more-processes.txt -s SJF -m infinite -q 3 | diff - tests/task1/more-processes.out

./allocate -f tests/task2/simple.txt -s RR -m infinite -q 3 | diff - tests/task2/simple-rr.out
./allocate -f tests/task2/two-processes.txt -s RR -m infinite -q 1 | diff - tests/task2/two-processes-1.out
./allocate -f tests/task2/two-processes.txt -s RR -m infinite -q 3 | diff - tests/task2/two-processes-3.out

./allocate -f tests/task3/simple.txt -s SJF -m best-fit -q 3 | diff - tests/task3/simple-bestfit.out
./allocate -f tests/task3/non-fit.txt -s SJF -m best-fit -q 3 | diff - tests/task3/non-fit-sjf.out
./allocate -f tests/task3/non-fit.txt -s RR -m best-fit -q 3 | diff - tests/task3/non-fit-rr.out

./allocate -f tests/task4/spec.txt -s SJF -m infinite -q 3 | diff - tests/task4/spec.out
./allocate -f tests/task1/more-processes.txt -s SJF -m infinite -q 3 | diff - tests/task1/more-processes.out
./allocate -f tests/task2/simple.txt -s RR -m infinite -q 3 | diff - tests/task2/simple-rr.out

./allocate -f tests/task1/simple.txt -s SJF -m infinite -q 1 | diff - tests/task1/simple-sjf.out
./allocate -f tests/task2/two-processes.txt -s RR -m infinite -q 3 | diff - tests/task2/two-processes-3.out
```