By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,233 Members | 1,825 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,233 IT Pros & Developers. It's quick & easy.

cpu scheduling problem

P: n/a
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!
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Jerry Khoo writes:
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.
Jul 22 '05 #2

P: n/a
Jerry Khoo wrote:
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
Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.