SoupaMan Posted February 21, 2012 Share Posted February 21, 2012 I took a course in computers, and I have a slight background in PHP. I was not expecting programming to be apart of the actual class, and it has caught me off guard. I have spent the last weeks fighting with this, trying to understand how I can put it into code properly. Any ideas, code samples, or guidance would be GREATLY appreciated! Assume the following: a. Disk spooling is NOT being used. b. The printer does NOT have a hardware buffer to hold the output while the printer is printing (The theme music from Mission Impossible is playing faintly in the background). SIMULATE the following scenario A hypothetical program computes for three seconds then outputs a variable length record to be printed. The printer takes from 0.75 to 4.75 seconds (average time is 2.75 seconds) to print each output record. (Use a random number generator) The hypothetical program loops 500 times for each case of software buffers (0, 1, 2, 3, 4, 5, 10, 25, and 100 software output buffers). Calculate the AVERAGE time for the program to “virtually compute and print” a record from the 500 records, for EACH of the 9 choices of buffer. Thanks again! -Steve Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/ Share on other sites More sharing options...
ManiacDan Posted February 21, 2012 Share Posted February 21, 2012 This course is at a much lower level than PHP. Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/#findComment-1319544 Share on other sites More sharing options...
SoupaMan Posted February 21, 2012 Author Share Posted February 21, 2012 This course is at a much lower level than PHP. Then I suppose I'm not looking at this the right way. In the sense that, with an expansion of the number of buffers, how would I compute the overlap? I'm not even sure where to begin on that, I have and each attempt ended in some sort of strange failure. Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/#findComment-1319548 Share on other sites More sharing options...
ManiacDan Posted February 21, 2012 Share Posted February 21, 2012 What I'm saying is: this is a PHP forum. This question is more suited to a low-level programming language which would actually be expected to deal with things like buffers...or printers for that matter. PHP deals with neither. Also, your textbook probably defines "software output buffers," generally we don't know what to do with the information that the buffer is 5. 5 what? Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/#findComment-1319552 Share on other sites More sharing options...
SoupaMan Posted February 21, 2012 Author Share Posted February 21, 2012 I feel comfortable using PHP, and people have apparently used PHP for this. I don't see why it wouldn't be possible? I'm sorry if this wrong or something, I didn't come here to create any problems I just wanted some help. Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/#findComment-1319554 Share on other sites More sharing options...
SoupaMan Posted February 21, 2012 Author Share Posted February 21, 2012 The buffers represent the number of buffers available, so 0 would be 0 buffers, 1 for 1 buffer, and so on. My understanding is, if you have 2 buffers, and one is full, the other can begin processing even though the other is not complete. Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/#findComment-1319575 Share on other sites More sharing options...
spiderwell Posted February 21, 2012 Share Posted February 21, 2012 this isn't even programming is it, just plain old mathematics? Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/#findComment-1319577 Share on other sites More sharing options...
SoupaMan Posted February 21, 2012 Author Share Posted February 21, 2012 Has to be accomplished through a programming language though, which creates the problem for me. Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/#findComment-1319581 Share on other sites More sharing options...
spiderwell Posted February 21, 2012 Share Posted February 21, 2012 well i cant add much, other to say that this could be achieved in almost all scripting/programming languages, so I suggest you use the one you know best! Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/#findComment-1319585 Share on other sites More sharing options...
SoupaMan Posted February 21, 2012 Author Share Posted February 21, 2012 Yeah, but I'm still lost mate haha. Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/#findComment-1319588 Share on other sites More sharing options...
ManiacDan Posted February 21, 2012 Share Posted February 21, 2012 You have one constant "step": the execution time of the program. Every "Step," the program spits out another unit. When that happens, calculate how far the printer has gotten on the buffers. If there's a free buffer, put the unit in there and continue to the next step. If not, wait. Link to comment https://forums.phpfreaks.com/topic/257463-tough-programming-problem-help-greatly-appreciated/#findComment-1319593 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.