- CPU Scheduling of Operating System
- 23.05.06일 - 23.05.13일
- 23.05.17일 - 23.05.21일
- 23.06.19일 - 23.06.21일 [FIX & Latest Upload]
- Language : Java(jdk 1.8(Zulu Open JDK 11.04), Java 11)
- Tool : JetBrain IntelliJ IDEA CE
- 작업이 도착한 순서대로 처리되는 방식으로 동작.
- 먼저 도착한 작업이 먼저 실행되고, 작업이 완료될 때까지 다른 작업은 대기. [호위효과 - Convoy effect]
- 도착한 순서와 상관없이 실행 시간이 가장 짧은 작업이 먼저 실행되는 특징.
- 평균 대기 시간을 최소화할 수 있는 알고리즘
- 우선순위 큐로 구현
- 각 작업에 동일한 시간 할당량을 부여 (Quantum)
- 할당된 시간 동안 작업을 실행한 후 다음 작업으로 전환하는 방식으로 동작
- (Process 1)의 CPU Burst가 실행한 뒤 I/O가 진행된다면 (Process 1)이외의 다른 프로세스에게 CPU를 할당하여 스케줄링하는 방식
- Open the terminal
- git clone https://github.com/WellshCorgi/implement-cpu-scheduling-java.git
- cd implement-cpu-scheduling-java/src
- javac Main.java
- [
Let's run the Java file]- java Main data.txt FCFS 0
- java Main data.txt SJF 0
- java Main data.txt RoundRobin 1
- java Main data.txt RoundRobin 10
- java Main data.txt RoundRobin 100
- n (A,C,B,IO)
- n is count of processes
- The time when the process arrived is A
- Let C be the total CPU time required until the process ends.
- Turnaround Time(Finishing Time - @param A)
- CPU burst time is the unique distributed random integer between 0 and any number B.
- IO burst time is the unique distributed random integer between 0 and any number IO.
-
1 (0 5 1 1)
-
3 (0 5 1 1)(0 5 1 1)(3 5 1 1)
-
5 (0 200 3 3)(0 500 9 3)(0 500 20 3)(100 100 1 0)(100 500 100 3)
- Case 1 [어떤 출력이든 고정된 값]
============= [ Summary of Scheduler ] =============
Scheduler Finishing Time : 9
Average turnaround time : 9.00
Average waiting time : 0.00
CPU Utilization : 55.56 %
I/O Utilization : 44.44 %
Throughput in processes completed per hundred time units : 11.11 %
- Case 2 [어떤 출력이든 고정된 값]
============= [ Summary of Scheduler ] =============
Scheduler Finishing Time : 15
Average turnaround time : 12.67
Average waiting time : 3.67
CPU Utilization : 100.00 %
I/O Utilization : 80.00 %
Throughput in processes completed per hundred time units : 20.00 %
- Other Case
Cpu Burst , Io Burst가 Random값으로 오차범위의 값 이내의 결과 출력
- 5/22 -> Fixed SJF, RoundRobin Improved the way logic works.
- 6/21 -> I got feedback from the professor in charge and redesigned all the working methods.
- 자바 디자인 패턴 (SRP,DIP)를 적용하기 및 OCP 규칙 위반 수정하기. [Applying Java design patterns and implementing SRP, correcting OCP rule violations]