Szakesz04
JCHJava Community | Help. Code. Learn.
•Created by Szakesz04 on 10/24/2024 in #java-help
Java Multi-Level Scheduler Simulation
Task: Create a Java program (OpenJDK 11) to simulate a multi-level scheduler.
Scheduler Details:
- High-Priority Level (priority > 0): Uses SJF (Shortest Job First) scheduling.
- Low-Priority Level (priority = 0): Uses RR (Round Robin) scheduling with a time slice of 2 units.
Input Format (Standard Input):
Each line describes a task (max. 10 tasks) in the following format (comma-separated):
- Task Identifier: (A, B, C, ...)
- Priority: (integer >= 0)
- Start Time: (integer >= 0)
- CPU Burst Time: (integer >= 1)
Example Input:
A,1,0,4
B,0,0,5
C,1,1,1
D,0,1,3
E,0,3,1
End of input is signaled by EOF, with possible newline characters and empty lines before it.
Output Format (Standard Output):
1. Execution Order: Tasks' identifiers in the order they run (letters only, no spaces).
2. Waiting Time: Total waiting time for each task, formatted as:
Task Identifier:Waiting Time, ...
Example Output:
ACBDEBDB
A:0,B:9,C:3,D:9,E:6
Submission Guidelines:
- Submit as a single Main.java file.
- The program must only use standard input and output (no file operations or network connections).
Evaluation:
- 3 extra points for passing all tests.
- Proportional points for partial correctness.
- A flawless solution earns 1 IMSc point.
Additional Test Case:
Check the following test case:
A,1,0,2
B,0,3,5
C,0,6,3
D,1,9,1
In this case, no output is required for certain steps due to the absence of runnable tasks.
10 replies