How could i simulate the SJF(Shortest Job First) CPU Scheduling in Java?

Recommended Answers

All 2 Replies

Implement a Priority Queue, the Jobs can be the elements in the Queue and the priority of your Job element could be determined by some property example 'jobLength', So that whenever you try to remove an element from the queue, the element with the least value of 'jobLength' would be returned.

How could i implement a priority queue in java?

I also have to calculate waiting time for each process, average waiting time, turn around time, and average turn around time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.