cpu scheduling problem

J

Jerry Khoo

My problem is this:
i am currently in taking OS course, and my lecturer would like us to
find ways to construct a CPU algorithm such as SJF(shortest Job
First), SRTF (Shortest Remaining Time First), and since i know not
much about the construction is there anyone who can help me to built
such algorithm? Thankz!
 
O

osmium

Jerry said:
My problem is this:
i am currently in taking OS course, and my lecturer would like us to
find ways to construct a CPU algorithm such as SJF(shortest Job
First), SRTF (Shortest Remaining Time First), and since i know not
much about the construction is there anyone who can help me to built
such algorithm? Thankz!

I wouldn't dignify such a thing by calling it an algorithm. Are you sure
you haven't sanitized the exercise too much? From what I see you simply
have a pool of jobs that keeps changing. When you are ready for a new job
you select the best candidate.

BTW, algorithm questions belong in comp.programming, not here.
 
A

Alan Johnson

Jerry said:
My problem is this:
i am currently in taking OS course, and my lecturer would like us to
find ways to construct a CPU algorithm such as SJF(shortest Job
First), SRTF (Shortest Remaining Time First), and since i know not
much about the construction is there anyone who can help me to built
such algorithm? Thankz!

You need to define the problem a bit better, and perhaps post any work
you've done so far.

I would argue that it isn't possible to implement SJF for a general
case(though it is still useful as a theoretically optimal lower bound on
average waiting time). To implement SJF, you need to know for how long
a process is going to run. The only way you can know this (in the
general case) is to run the process and see, but that defeats the point
of trying to schedule when it will run. The same is true for SRTF.

Are you somehow given the running time/remaining time for each process,
or do you have to estimate them? If you must estimate, what information
is available to your algorithm?

If you already have the values available, the algorithm seems as simple
as sorting a list the processes by running time/remaining time, then
sequentially executing each.

Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top