It's UWAweek 8

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying selected article
Showing 1 of 1168 articles.
Currently 2 other people reading this forum.


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
4:02am Thu 14th Sep, Christopher M.

ANONYMOUS wrote:
> Hi, > > I have a working solution but I've just confused myself with why it works. > > Could someone explain, for a simple command file as below with a time quantum of 5 > # > shortsleep > 5usecs exit > # > > Why the output is as below? Particularly, after further thought I've confused myself as to why this process ever makes it from running back to ready. The process completes its computation of 5usecs within the time quantum allowance so wouldn't it just exit, making the total time since reboot 10?
After the process has spent 5usecs on the CPU performing some computation, its time-quantum expires and it's removed from the CPU. It does not "look into the future" to see what system-call is coming next, and then perform it if it happens to be an exit.
> Also if the transition from running to exit takes 0usecs, why does the time since reboot advance to 26usecs in the sample solution. Should it not be 25?
The transition takes 5usecs 21,22,23,24,25 - t=25 is part of the transitioning time. After those 5usecs, at t=26, the process resumes its execution with exit. The transition for the exit does take 0secs - the clock has not advanced to 27...

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy