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.
7 Replies
⌛ This post has been reserved for your question.
Hey @Szakesz04! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
I have this assignment I did some work on that, but suddenly its not working properly and I can not see whats wrong.
What happens and how is that different from your expectations?
Does not calculate proper the times and does not do the schedule but I do not know why
I tried my best implementing the algorithm but I'm not that kind of succesful programmer
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.