Rahul
Rahul

Reputation: 11669

How to perform Job scheduling algorithms using python?

Well , i want to test out which scheduling algorithm is suitable for my application , but unable to figure out on how to go about testing. i have a set of jobs to be executed , for SMP (Symmetric Multi Process ) execution i used Parallel Python , but not able to apply Job Scheduling algorithm .

For ex: if i want to implement SJF (Shortest Job First) how will know that the job i am submitting is the shortest compared to others , it may also happen that eventually a larger job submitted may become smaller than a relative smaller job submitted at that time.

Upvotes: 0

Views: 4337

Answers (1)

nmichaels
nmichaels

Reputation: 50943

You can only tell if the job you're submitting is the shortest if you know the runtime of all your jobs in advance. This is not an easy thing to know without first running the jobs. SJF is rarely used for this reason. Scheduling in a FIFO is much easier; you stick the jobs in a list as they come in (with lst.append()) and lst.pop(0) one off whenever you need a new job to run.

Upvotes: 3

Related Questions