View Single Post
Old 10-12-2012, 07:12 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,752
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
godz1990 (10-13-2012)