In this project, we are proposed to design a simple process scheduler which be implemented with the function of jobs analysis with different parameters in .txt
file and involution of process creation, suspension, as well as termination. The programme includes three classes: Scheduler, Monitor and job. We realize 4 scheduling algorithms :
- FIFO
- Non-preemptive SJF
- Preemptive SJF
- RR
Attribute | Content |
---|---|
Operation System | ubuntu-20.04.1-desktop-amd64 |
Programming Language | C++11 |
Compiler | g++ version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) |
IDE Platform | Microsoft Visual Studio Community 2019 Version 16.8.3 (Linux Develop) |
For more specific information regarding the authoring
C++
code for Linux servers, desktops and devices, just click 🌵
git clone https://github.com/MUST-Quick-Fry/Process-Scheduler.git
The standard file format :
[arrive time]
\t
[Job]\t
[duration time]\n
if you can not open file with invalid error, but it is in standard format, you could use vim
or vi
to change the file format as below :
set ff=unix
You can easily compile the programme by ./Makefile
provided in root directory of this project using the command below :
make
To debug with programme using command below :
make ver=debug
To compile programme with optimization using command below :
make ver=release
And delete *.d
,*.o
files and the executable file using command below :
make clean
How to compile two independent Phases :
- Phase 1 (Monitor) : change the parameters
target
andEXEC
in./Makefile
as
target:=job monitor monitor_main EXEC:=Monitor
- Phase 2 (Scheduler) : change the parameters
target
andEXEC
in./Makefile
as
target:=utils job monitor scheduler scheduler_main EXEC:=Scheduler
For Phase 1, with parameters :
./Monitor [command string]
For Phase 2, with parameters :
./Scheduler [filename] [policy]
The second argument
[policy]
only allows 4 choices in upper-case : FIFO SJF1 SJF2 RRSJF1 : non-preemptive, SJF2 : preemptive
The Gantt Chart followed by job description file ./job_list_example/job4
as example.
Totally 8 jobs, Time using: 23 s
=======================================================================
Gantt Chart
=======================================================================
Time |0 1 2
|0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
Job 1 |. # # # # # #
Job 3 | . . . . . . # # # #
Job 2 | . . . . . . . . . # # # # #
Job 5 | . . . . . . . . . . . . . # #
Job 6 | . . . . . . . . . . . . . . . #
Job 4 | . . . . . . . . . . . . . . . #
Job 7 | . . . . . . . . . . . . . . # #
Job 8 | . . . . . . . . . . . . . . . . # #
Totally 8 jobs, Time using: 23 s
=======================================================================
Gantt Chart
=======================================================================
Time |0 1 2
|0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
Job 1 |. # # # # # #
Job 6 | . . . . #
Job 4 | . . . . #
Job 7 | . . . # #
Job 5 | . . . . . . . . # #
Job 8 | . . . . . . . # #
Job 3 | . . . . . . . . . . . . . . # # # #
Job 2 | . . . . . . . . . . . . . . . . . # # # # #
Totally 8 jobs, Time using: 23 s
=======================================================================
Gantt Chart
=======================================================================
Time |0 1 2
|0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
Job 1 |. #
Job 3 | . # #
Job 6 | . #
Job 4 | . #
Job 5 | . . . # #
Job 8 | . . # #
Job 3 | . . . . . . . # #
Job 7 | . . . . . . # #
Job 2 | . . . . . . . . . . . . # # # # #
Job 1 | . . . . . . . . . . . . . . . . . . # # # # #
Totally 8 jobs, Time using: 23 s
=======================================================================
Gantt Chart
=======================================================================
Time |0 1 2
|0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
Job 1 |. # #
Job 3 | . . # #
Job 2 | . . . # #
Job 5 | . . . . # #
Job 6 | . . . . . . #
Job 4 | . . . . . . #
Job 7 | . . . . . # #
Job 8 | . . . . . . . # #
Job 1 | . # #
Job 3 | . # #
Job 2 | . # #
Job 1 | . # #
Job 2 | . #
@goodkillerchen, @KennardWang, @Tim-eyes
Tasks completed by each person are documented below:
Name | Task |
---|---|
Chen, Yuxuan (1809853J-I011-0011) | Design the main framework , part of implementation of algorithms |
Wang, Yuyang (1809853Z-I011-0045) | Implementation of four scheduling algorithms, signal-handler and normalization check of job file |
He, Peilin (1809853U-I011-0078) | Implementation of monitor time control, pretreat job description file and part of design the framework, report writing |
Sincerely thank our team for the great support, understandings and involvements.
@Tim-eyes 🌍 |
@KennardWang |
@goodkillerchen 💻 |
Feel free to open an issue or submit PRs.