Skip to content

Operating System - Implementing Multilevel Feedback Queue algorithm to simulate the CPU schedule

Notifications You must be signed in to change notification settings

Makiato1999/MLFQ-CPU-Scheduling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MLFQ-CPU-Scheduling

  • how to compile all files: make
  • how to clean all obj files: make clean

How to run

  • ./a3q1 numOfCPUs boostTimeS fileName.txt
  • Such as ./a3q1 4 5000 tasks.txt
  • I have put the tasks.txt and taskmaker.py in this folder, you can use python taskmaker.py to create new task data and overwrite the tasks.txt.

When S is 3000

Using mlfq with 1 CPUs.

Type Average turnaround time
Type 0 25584 usec
Type 1 85146 usec
Type 2 543337 usec
Type 3 492922 usec
Type Average response time
Type 0 795 usec
Type 1 1032 usec
Type 2 906 usec
Type 3 5515 usec

Using mlfq with 2 CPUs.

Type Average turnaround time
Type 0 13494 usec
Type 1 43936 usec
Type 2 276411 usec
Type 3 524925 usec
Type Average response time
Type 0 486 usec
Type 1 611 usec
Type 2 546 usec
Type 3 2902 usec

Using mlfq with 4 CPUs.

Type Average turnaround time
Type 0 7352 usec
Type 1 23699 usec
Type 2 139871 usec
Type 3 268386 usec
Type Average response time
Type 0 310 usec
Type 1 400 usec
Type 2 352 usec
Type 3 1660 usec

Using mlfq with 8 CPUs.

Type Average turnaround time
Type 0 4189 usec
Type 1 13255 usec
Type 2 81975 usec
Type 3 152573 usec
Type Average response time
Type 0 230 usec
Type 1 287 usec
Type 2 273 usec
Type 3 1021 usec

When S is 5000

Using mlfq with 1 CPUs.

Type Average turnaround time
Type 0 24892 usec
Type 1 90945 usec
Type 2 458478 usec
Type 3 465523 usec
Type Average response time
Type 0 719 usec
Type 1 937 usec
Type 2 819 usec
Type 3 4876 usec

Using mlfq with 2 CPUs.

Type Average turnaround time
Type 0 13708 usec
Type 1 49608 usec
Type 2 400741 usec
Type 3 627348 usec
Type Average response time
Type 0 397 usec
Type 1 516 usec
Type 2 453 usec
Type 3 2707 usec

Using mlfq with 4 CPUs.

Type Average turnaround time
Type 0 7706 usec
Type 1 26136 usec
Type 2 195780 usec
Type 3 304613 usec
Type Average response time
Type 0 303 usec
Type 1 379 usec
Type 2 335 usec
Type 3 1571 usec

Using mlfq with 8 CPUs.

Type Average turnaround time
Type 0 4381 usec
Type 1 15256 usec
Type 2 109740 usec
Type 3 168750 usec
Type Average response time
Type 0 226 usec
Type 1 295 usec
Type 2 300 usec
Type 3 972 usec

When S is 7000

Using mlfq with 1 CPUs.

Type Average turnaround time
Type 0 31795 usec
Type 1 125748 usec
Type 2 591036 usec
Type 3 470875 usec
Type Average response time
Type 0 789 usec
Type 1 1022 usec
Type 2 897 usec
Type 3 5541 usec

Using mlfq with 2 CPUs.

Type Average turnaround time
Type 0 16519 usec
Type 1 67892 usec
Type 2 457017 usec
Type 3 606210 usec
Type Average response time
Type 0 455 usec
Type 1 592 usec
Type 2 525 usec
Type 3 2934 usec

Using mlfq with 4 CPUs.

Type Average turnaround time
Type 0 8790 usec
Type 1 35549 usec
Type 2 244018 usec
Type 3 321621 usec
Type Average response time
Type 0 233 usec
Type 1 300 usec
Type 2 268 usec
Type 3 1500 usec

Using mlfq with 8 CPUs.

Type Average turnaround time
Type 0 1209 usec
Type 1 4744 usec
Type 2 30452 usec
Type 3 40260 usec
Type Average response time
Type 0 42 usec
Type 1 48 usec
Type 2 47 usec
Type 3 227 usec

When S is 10000

Using mlfq with 1 CPUs.

Type Average turnaround time
Type 0 46161 usec
Type 1 144447 usec
Type 2 536867 usec
Type 3 543779 usec
Type Average response time
Type 0 852 usec
Type 1 1107 usec
Type 2 977 usec
Type 3 4234 usec

Using mlfq with 2 CPUs.

Type Average turnaround time
Type 0 24908 usec
Type 1 78392 usec
Type 2 480086 usec
Type 3 616967 usec
Type Average response time
Type 0 461 usec
Type 1 584 usec
Type 2 538 usec
Type 3 2174 usec

Using mlfq with 4 CPUs.

Type Average turnaround time
Type 0 13155 usec
Type 1 40940 usec
Type 2 254038 usec
Type 3 326789 usec
Type Average response time
Type 0 264 usec
Type 1 320 usec
Type 2 282 usec
Type 3 1159 usec

Using mlfq with 8 CPUs.

Type Average turnaround time
Type 0 7303 usec
Type 1 22775 usec
Type 2 138676 usec
Type 3 178560 usec
Type Average response time
Type 0 251 usec
Type 1 256 usec
Type 2 226 usec
Type 3 755 usec

Is the difference in turnaround time and response time you expected to see as S and the number of CPUs change? Why or why not?

  • Yes, the difference in turnaround time and response time will be affected as S and the number of CPUs change. According to my report. For my perspective, when S doesn't change, if we use more CPUs, the turnaround time and response time will decrease. When S increases, under the same number of CPUs condition, the turnaround time will increase, but the response time change is not sure, which may increase or decrease.

How does adjusting the S value in the system affect the turnaround time or response time for long-running tasks? Does it appear to be highly correlated?

  • According to my report. For long-running tasks, when S is more longer, under the same number of CPUs, the response time and the turnaround time may increase, but it is not sure. Thus, i think that S value in the system is not highly correlated to affect the turnaround time or response time for long-running tasks. This problem needs to be divided into different situations for analysis.

About

Operating System - Implementing Multilevel Feedback Queue algorithm to simulate the CPU schedule

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published