Granville Barnett

CPUSS: Using the SJF Expert Rule

The SJF Expert Rule strategy is designed to elevate the priority of large processes based on a precondition defined by the user, that basically says if the current % of processes in the ready queue is greater than N then execute some of the large processes thus elevating their priorities.

SJF is as you will no doubt no unfair to large processes (that is they require greater CPU burst times). Having large processes always be low down in the stack is really not acceptable in any system, at least if it's not done in a healthy fashion. The reality is that no operating systems use one predefined algorithm, rather they use some dynamic selection policy based on the ready queue and further predictions.

Large Process Elevation

Rather than writing it out again, here is the expert rule definition (all strategies are well documented with advice where required to gain better performance).

CPU Scheduling Simulator 0.3

By using the expert rule you will be able to swap in large processes for execution based on a threshold defined by you, you will need to analyse the expected number of large processes you estimate at any time t in the ready queue to get the best out of the strategy.

Just like the other strategies it's easy to use and start analysing the data.

    1 using System;

    2 using Cpuss;

    3 using Cpuss.Strategies;

    4 

    5 namespace ConsoleApplication1

    6 {

    7     class Program

    8     {

    9         static void Main()

   10         {

   11             Runner runner = new Runner(12, 4, 34, new ShortestJobFirstExpert(10));

   12             runner.ProcessStarted += (o, e) => Console.WriteLine("PID: {0} Started", e.Id);

   13             runner.ProcessCompleted += (o, e) => Console.WriteLine("PID: {0} Completed", e.Id);

   14             runner.ProcessPreempted += (o, e) => Console.WriteLine("PID: {0} Preempted", e.Id);

   15             runner.Run();

   16         }

   17     }

   18 }

Note: N will be able to be determined by the user as well in the next release (this was an oversight by me in the last release).

CWindowssystem32cmd.exe

Yes, there is a lot more data available! Very simple demo, the code above uses a threshold of 10%.

Preemption support

In change set #9226 and later preemption support is active via events.

Something missing?

I am continuing to add a lot of data spots that can be used for analysis in strategy design and development so if you have any ideas you would like to see let me know!

Download CPUSS!

Comments

No Comments