CO527 Anonymous Questions and Answers |
This page lists the various questions and answers. To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.
We have taken the liberty of making some minor typographical corrections to some of the questions as originally put. Although most of the questions here will have been submitted anonymously, this page also serves to answer some questions of general interest to those on the course.
Submission reference: IN1041
Hi, do these outputs look ok?
FIFO: Average block service time: 3389.1 (stddev 978.0 , min 30.0 , max 4665.0) Minimum block service time: 30.0 (average 1221.9, stddev 608.5 ) Maximum block service time: 19330.0 (average 10098.5, stddev 6690.3) SCAN: Average block service time: 1578.3 (stddev 294.7 , min 730.0 , max 2120.0) Minimum block service time: 30.0 (average 364.1 , stddev 392.4 ) Maximum block service time: 4110.0 (average 3000.4, stddev 616.6 ) SSTF: Average block service time: 1498.1 (stddev 371.0 , min 180.0 , max 1934.2) Minimum block service time: 50.0 (average 301.1 , stddev 158.1 ) Maximum block service time: 5950.0 (average 3498.9, stddev 1191.8)
I only ask as the minimum block service time is more, despite the average being less?
Also does this do what I think it should in my head?
[snip System.arraycopy() line]
Essentially remove an item out an array and move the remaining slots up? What happens to the end one? I assume it's left in place but I don't suppose that is an issue as the count is kept elsewhere? Thanks very much.
Looking at the numbers, it seems that the minimum time achieved for FIFO and SCAN is oddly low, whereas the other values are comparable with what I get from mine. So yes, the minimum service time of 50ms for SSTF is fine. It's more likely that the absolute min and max values will flutuate more than the average, since these are outright single values of the sample set. The given average and standard-deviation allow some comparison in the overall set of minimum values, etc. As can be seen, the SSTF minimum service time average is less than that for FIFO or SCAN (and has much less deviation from the average).
For your second point, yes, that code does do what you think it does. If you're not sure, draw out an array of N values on paper, invent some values for rq_count and nextSlot, and engineer from that the values you're passing to System.arraycopy() — they should be the same.
As you correctly point out, a request gets left at the end of the array, but yes, since the count is kept elsewhere that doesn't matter (it won't ever be used and will probably be overwritten by the next incoming request). The only thing for which we might care about removing the dud entry is garbage collection — the memory occupied by that request structure won't be freed immediately.
Keywords: coursework
Referrers: Question 162 (2006) , Question 176 (2006) , Question 177 (2006)
Submission reference: IN1042
I have assessment 5 working and was just wondering if these are acceptable values for SSTF compared with SCAN:
SCAN: Average block service time: 1626.4 (stddev 221.7 , min 1194.6, max 1989.0) Minimum block service time: 50.0 (average 355.2 , stddev 336.5 ) Maximum block service time: 3980.0 (average 3075.6, stddev 622.5 ) SSTF: Average block service time: 1585.1 (stddev 232.2 , min 1272.3, max 2230.0) Minimum block service time: 80.0 (average 373.3 , stddev 334.3 ) Maximum block service time: 6420.0 (average 4057.4, stddev 1193.0)
The average block service time is lower which is what the assessment is 'particularly' interested in...but the minimum is higher for SSTF. Is this ok or should I keep playing with it to try and make the minimum block servies time less then SCAN? At the moment I can't see a way of decreasing this...
Looking at those output, nope, that's not ok (unlike Question 161 (2006)). The SSTF average minimum service time is higher than that for SCAN. The maximum block service time for SSTF also seems quite high, compared with the values I get in my model solution.
Randomly changing the code might not be the best approach — consider what your code needs to do (probably involving pencil and paper), and work from that. If you know the position of the last dispatched request (which is something you add to the scheduleRequestNow() method), then the problem essentially becomes picking the next closest block inside completedRequest(). If there's a bug in the scheduleRequestNow() addition then that could also cause problems (irrespective of the code in completedRequest()).
Keywords: coursework
Submission reference: IN1067
Am I correct in assuming this is how you get hold of the request queue?
DSRequest[] request_queue = super.request_queue;
Because all I get is null for the request queue... What am I doing wrong here?! Thanks.
You don't need to get hold of the request_queue, since it is already visible through inheritance. If you add something like the above as an initialised attribute of the DiskSchedulerSSTF class, it will indeed be null — because request_queue in the superclass is not allocated in the superclass's constructor. However, as stated in the assessment description, you should not modify anything outside the methods already there; this includes adding fields/attributes and other methods to the class.
As far as request_queue is concerned, it will be allocated, initialised and visible in your completedRequest() method.
The inheritance/overriding used here is pretty basic [1] — the SSTF scheduler is mostly the same as the FIFO scheduler (as is the SCAN scheduler). You can think of the inheritance as starting with the contents of DiskSchedulerFIFO, and then adding/replacing the methods and fields from DiskSchedulerSSTF. Where an overridden method in DiskSchedulerSSTF calls the corresponding super.XYZ() method, simply substitute that method-call for the same-named original method body from DiskSchedulerFIFO.
[1] I say pretty basic, but in my opinion, the effects of inheritance and overriding are not the most easily understood at the best of times.
Keywords: coursework
Referrers: Question 180 (2006)
Submission reference: IN1063
Hiya, I am currently getting the following values:
FIFO: Average block service time: 3811.2 (stddev 981.8 , min 30.0 , max 4433.3) Minimum block service time: 30.0 (average 2405.2, stddev 1233.8) Maximum block service time: 4960.0 (average 4404.4, stddev 1101.6) SCAN: Average block service time: 1624.5 (stddev 223.9 , min 1194.6, max 1989.0) Minimum block service time: 50.0 (average 349.6 , stddev 332.8 ) Maximum block service time: 3980.0 (average 3075.6, stddev 629.7 ) SSTF: Average block service time: 1514.7 (stddev 369.8 , min 30.0 , max 2027.8) Minimum block service time: 30.0 (average 237.8 , stddev 214.4 ) Maximum block service time: 4670.0 (average 3363.0, stddev 937.6 )
However, running the same thing 4 seconds later gave me:
SSTF: Average block service time: 1556.3 (stddev 242.9 , min 1080.0, max 2016.7) Minimum block service time: 100.0 (average 278.5 , stddev 269.0 ) Maximum block service time: 4670.0 (average 3400.0, stddev 807.2 )
The average seems good, but the minimum block service time is pretty much consistently between 80-100. I am pretty certain that my algorithm is working correctly. 2 calls of the method (with debugging statements) give this output:
[snip debug output]
Would the efficiency of the code we use effect the results in this way? Or is there likely to be a problem elsewhere? Or no problem at all? I have been trying for almost an hour to get consistently low results but to no avail. Thanks for your help.
Although the absolute minimum value fluctuates quite a lot (as it will tend to), the average minimum service time is definitely lower, and with less deviation. This gives you an indication of the distribution of minimum service times — they are definitely lower for SSTF here. I've added a note to the assessment description along these lines.
The test harness uses a number of Java threads in order to perform concurrent file reads (so that there are multiple requests from which to choose). JVMs typically map these onto operating-system threads, for which the OS is responsible for scheduling. Hence, the behaviour of the test harness may rely somewhat on how your particular OS schedules threads, which will in turn depend on what else is running on your system. Running the program on an otherwise idle system (at least for Linux) produces moderately consistent results.
As far as the time values reported are concerned, this is fake time (if you enable the visualisation you'll get an idea of how long these things actually take, and probably more stable results than without visualisation).
Keywords: coursework
Referrers: Question 166 (2006) , Question 175 (2006) , Question 176 (2006)
Submission reference: IN1064
Hi, I know that you're not a debugger, but I've spent ages on this and I think that I understand what to do — but when I run my code, it just hangs. I've tried doing System.out.println() statements to see what parts of the code are doing, but I still can't understand why my code doesn't work. Could you give me any pointers? Here's my code:
[snip code]
The fact it hangs is indicative of a particular problem: the contents of the request_queue get mucked up. In particular, some request is being removed from the queue before being serviced — hence some thread trying to read blocks from a file just ends up getting stuck. Check your code that removes a request from the queue (in particular, you should remove the request which was just dispatched to the disk).
Keywords: coursework
Referrers: Question 182 (2006)
Submission reference: IN1069
I have compiled and run the project and when giving the args for FIFO and SCAN which are both classes that are not modified by any means — the results are very different to the ones you have produced — thus I cannot effectively test my solution for SSTF:
FIFO: Average block service time: 4008.6 (stddev 561.3 , min 1670.0, max 4497.0) Minimum block service time: 410.0 (average 2252.2, stddev 946.1 ) Maximum block service time: 5590.0 (average 5103.0, stddev 767.1 ) SCAN: Average block service time: 1537.8 (stddev 358.2 , min 80.0 , max 2014.0) Minimum block service time: 50.0 (average 328.5 , stddev 258.9 ) Maximum block service time: 4260.0 (average 3010.7, stddev 817.4 )
What do you think might be wrong — I have tried running it on different systems with similar results — from disk and from USB, still same? Cheers.
See question Question 164 (2006). Particularly with respect to the average minimum block service time. The fact that you get different values on different systems is no surprise — it's at the mercy of thread scheduling within the JVM and OS. However, it you look at the averages and standard deviations, you'll see that they're not substantially different from the values I get.
Keywords: coursework
Submission reference: IN1073
For the first question, do we just need to add this line?:
[snip code]
it seems a bit simple :S
Pretty much, yes. See Question 158 (2006).
Keywords: coursework
Referrers: Question 169 (2006) , Question 178 (2006) , Question 186 (2006)
Submission reference: IN1075
In Question 2, do I simply need:
[snip code]
To find the last cylinder, assuming the line of code already there is needed? If not, where am I going wrong?
Yes, pretty much. It's fairly simple, but it's only worth 10% of the assessment (however, it is fairly crucial in terms of getting the overall solution right). As to whether or not the line of code already there is needed, you need to determine that for yourself. Two questions: does the existing scheduleRequestNow() in DiskSchedulerSSTF method actually schedule a request to the disk? And if it does not, does the same method in DiskSchedulerFIFO? (which is called with super.)?
Keywords: coursework
Referrers: Question 173 (2006)
Submission reference: IN1076
In reference to Question 167 (2006), what else do I need if you're saying "pretty much"? Should I add in some sort of null value check?
You should decide for yourself whether what you've done is enough — I'll tell you for sure when I come to mark them. As a null value check, no, this isn't necessary (there is no failure action defined for the method — it won't ever be called with a null device).
Keywords: coursework
Submission reference: IN1093
Can you give a list of ranges of values which are correct for example:
SSTF Average Block serv time = 1000-1500 Max block..... = 500-1000 min block ...= 30-80
so we can have an idea if our answers are right instead of people keep checking with you on Q+A.
I would like to, maybe, but it's not practical really.. Different JVMs and different OSs will tend to produce different numbers, and the ranges overlap in good and bad ways. I only have Sun's JVM on Linux and Solaris, so testing the whole range of JVMs to get values is not really practical.
In a real-world situation, you may end up with statistics such as this for some code you have written, and be expected to deduce (by comparison with similar statistics for other algorithms), whether your implementation is "good".
Keywords: coursework
Submission reference: IN1101
Does the WebCT test cover only the architecture (Monday lectures) part of the course?
Yes; that's why it's called "architecture quiz" :-).
Keywords: coursework
Submission reference: IN1110
Hey Fred, I'm having trouble not so much with the assignment but with figuring out if my solution is okay or not. I'm pretty sure it's doing what I want it to, and the overall average and minimum's standard deviation are consistently lower than the SCAN method.
However, the minimum average is being a bit tricky. It's generally lower than SCAN — ranging from about 300 to 400 as opposed to SCAN's 350 - 420. But as you can see from those numbers that means SCAN can be virtually the same, or occasionally faster than SSTF.
Is this acceptable? Or perhaps I've done something wrong somewhere. Or maybe I'm doing it right but inefficiently - perhaps I need a faster way of finding the nearest cylinder. Hints would be appreciated!
Here's my code if you want to run a few tests (maybe my computer just hates me?)...
[snip code]
The algorithm is essentially correct, but there is a problem with your code (I think). The loop you've got could be simplified somewhat, that seems a good place to start looking (the code you've currently got is not entirely easy to follow).
Keywords: coursework
Submission reference: IN1081
I have implemented the first 2 methods like these:
[snip code]
But my completedRequest() method doesn't work as expected. Is it because I am calling the super.initScheduler(ddev) and the super.scheduleRequestNow(req) methods?
There is something wrong with the code you've got in 'scheduleRequestNow()'. As for calling the superclass methods, see Question 168 (2006).
Keywords: coursework
Submission reference: IN1117
I've written some code for the current assignment, and when I try to run it I get this error:
java.lang.AbstractMethodError: SmallFS.fsDumpRoot() at Harness.main(Harness.java:125)
any ideas why, I've tried to see whats going on, but I can't see how this error relates to the scheduler.
It seems this error occurs even when not putting the --sstf flag in the command line.
Something would appear to have gone wrong somewhere.. The error (was there anymore message than the above?) is saying that some method is missing in the SmallFS implementation, which it ought not to be! (it works for myself and others..). Try deleting all the .class files and recompiling, and check that you've not damaged any of the files in the distribution. Also make sure that you use that packaged SmallFS.java, not your solution to the previous assessment (some things have changed).
Keywords: coursework
Submission reference: IN1127
Hi, I'm not quite sure, but I don't think my SSTF::completedRequest() algorithm works as expected. Is this the kind of thing you're after? If, so then can you give suggestions as to why it isn't performing as fast as FIFO in some circumstances?
[snip code]
The algorithm looks pretty much ok, in terms of finding the closest block. Check that the block you choose is actually the one dispatched to the disk device. In terms of the numbers reported, expect some variation; see Question 164 (2006).
Keywords: coursework
Submission reference: IN1135
Hello. I am trying to test my code, but it sometimes beats SCAN ... sometimes doesn't. What I have is this:
[snip code]
As far as I can tell this works fine, but the arraycopy confuses me. Is it doing what its meant to or am I getting lost? Many thanks
In terms of timing, see Question 164 (2006). Your code looks fine however. In regards to the arraycopy line, see Question 161 (2006).
Keywords: coursework
Submission reference: IN1144
Hello. I've looked at the various questions about arraycopy (Question 161 (2006)), and I think I get that it puts the block last serviced to the end of the array...right? But looking at the arraycopy in DiskSchedulerSCAN.java, I don't get how this is done. Or am I just getting confused? Thanks.
Nope, the array-copy does not put the block last serviced to the end of the array. The request_queue from indices 0 to rq_count-1 inclusive contains unscheduled requests. When one of these is scheduled (as completedRequest() will sometimes initiate), it needs to be removed from the queue. This is what the arraycopy code is doing (in FIFO and SCAN).
Keywords: coursework
Referrers: Question 180 (2006)
Submission reference: IN1145
Is this it for the first 2 methods.....?
[snip code]
and for the last part should the approach be... (1). sort the queue in order of 'H' from the getCHS. (2). calculate the difference between the current head position and all the head positions in the queue. (3). choose head with smallest difference.
For the first two methods, pretty much, yes. See Question 167 (2006). As for your approach to the SSTF algorithm, that's mostly it, but consider what advantage sorting the requests has? You talk about head values, which is wrong. See various OS textbooks for details of CHS geometry, and how the various cylinder, head or sector values relate to the SSTF algorithm.
Keywords: coursework
Referrers: Question 185 (2006)
Submission reference: IN1146
Hi, I've got a problem with part three of the assessment. The code I've written doesn't seem to ever be run, because rq_count is never greater than zero, and therefore always runs the else. Do I have to edit something in DiskSchedulerFIFO to get rq_count working properly? Here is my code:
[snip code]
Nope, you don't have to edit anything in DiskSchedulerFIFO. The assessment description clearly states this! There is something broken in your completedRequest() method, outside of any if/else, which is causing the problem.
Keywords: coursework
Referrers: Question 180 (2006)
Submission reference: IN1147
This is my code for the last part of the assessment 5:
[snip code]
I'm having problems with the arraycopy, because no matter what request it deals with it will always remove the first from the queue, am I along the right lines?
You're right in that the array-copy always removes the first item from the queue. However, if it wasn't the first item in the queue which was dispatched to the disk, then things will go wrong! See also Question 177 (2006). Your code also suffers a similar problem to Question 179 (2006) which will stop it from working properly. Question 163 (2006) is relevant reading.
Keywords: coursework
Referrers: Question 181 (2006)
Maintained by Fred Barnes, last modified Thu May 8 12:58:00 2014 |