Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
10-12-2012, 06:22 AM #1
- Join Date
- Oct 2012
- Thanked 0 Times in 0 Posts
Round Robin and Shortest Process Next Algorithm for OS
Last edited by godz1990; 10-13-2012 at 09:03 PM.
10-12-2012, 08:12 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,662 Times in 2,631 Posts
This is way too much code to go through without having an actual question associated with this. Just saying its buggy won't help unless you've done some debugging of your own to determine the cause.
Needless to say, I think you are going way to complicated here. Taking a vector of a Process instead of integer would make more sense to me. Finding shortest runtime would be as simple as sorting it by the process run duration (haven't a clue what that is since there's no definition for Process) descending, and picking the first item. Make use of a linked list built as a priority queue for queuing up the next set of processes that are ready based off of the run information. I assume the full run duration would effectively consume cpu. Unknown is if the example runtime includes or excludes the required time used to access the harddisk. In that first example, that could be 5000 including all access (which will be deficient, but makes sense for some of the assignment criteria), or it could be 5000 excluding access to disk (for a total of 800x4+5000 or 8200).
This is a neat and complicated assignment. I think this would be easier if used in a threaded model (with synchronized lists of course), but there is no mention here to use threading which is why I think its more complex than it needs to be.
If you can come up with some more specific issues to identify, then that would be much better. There is just too much here to go through in order to point out an ah-hah! relating to a cause.
Users who have thanked Fou-Lu for this post: