-
struct.h
: This has structure of the process which has process ID, arrival time, burst time and struct object. Create struct object in this file if you need more process objects. -
generatepid.c
: This generates and assigns process ids, arrival time, burst time. -
main.c
: This file is used to let the user provide the number of processes which is later used in other files. -
graphics.c
: This has basic implementation of visualization using C graphics library graphics.h. To add implementation of any new CPU scheduling algorithm:- Change the name of the algorithm
- Manipulate the sorting algorithm
To use this code you need to install some packages and libraries which will enable you to compile graphics.h program in Linux.
-
sudo apt-get install build-essential
-
For Ubuntu 16.04:
sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-2.0 guile-2.0-dev libsdl1.2debian-all libart-2.0-dev libaudiofile-dev libesd0-dev libdirectfb-dev libdirectfb-extra libfreetype6-dev libxext-dev x11proto-xext-dev libfreetype6 libaa1 libaa1-dev libslang2-dev libasound2 libasound2-dev
-
Download libgraph.
tar -xvzf libgraph-1.0.2 cd libgraph-1.0.2 ./configure sudo make sudo make install sudo cp /usr/local/lib/libgraph.* /usr/lib
-
Compile and run the source code files.
gcc generatepid.c struct.h graphics.c main.c -lgraph ./a.out
-
Enter the number of process and view how these CPU scheduling algorithm works. Everything will be genrated randomly.