TheAlgorithms/Java

[FEATURE REQUEST] <Implementation of SRTF Scheduling Algorithm>

mpousmali opened this issue · 1 comments

What would you like to Propose?

I would like to implement the Shortest Running time First Scheduling Algorithm (known also as Preemptive SJF).

Issue details

In the SRTF scheduling algorithm, the process with the smallest amount of time remaining until completion is selected to execute.

Additional Information

Example:
Consider the processes p1,p2 and the following table with info about their arrival and burst time:
Process | Burst Time | Arrival Time
P1 | 6 ms | 0 ms
P2 | 2 ms | 1 ms

In this example P1 will be executed at time= 0 until time= 1 when P2 arrives. At time= 2, P2 will be executed until time=4. At time 4 P2 is done and P1 is executed again in order to be done.
That's a simple example of how the algorithm works.

Pull Request #5011