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).
main: the main program including the process managerprocess: used to simulate real processeslinkedlist: implementation for storing any data typememorymanager: the memory manager APIpcb: the process control block APIprocess-api: API that controlsprocess
make # compile the main program
make process # compile process executable, used to simulate real processesAll options are required.
-f <file>: the file containing the processes to be managed-s <scheduler>: the scheduler to use. Can beSJForRR-m <memory>: the memory allocation algorithm to use. Can beinfiniteorbest-fit-q <quantum>: the quantum of each cycle
Copy and paste any or all commands into the terminal to run the test cases. No output indicates that the test case/s passed.
./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