On Mon, Apr 19, 2010 at 08:27:10AM +0800, Aaron Lewis wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 04/19/2010 12:55 AM, Ted Unangst wrote:
> 
> > You measure how long it took to finish its previous time slices.
> 
> Yes , that's an Real Time OS , it use CPU time slices.
> 
> I don't know if Process total running time is recorded in the PCB.
> 
> Once a process acquired the CPU time slices , it can choose to use it up
> at one time or a few times , as long as it did finish that slice.
> 
> So i should measure the total running time of previous time slice ?
> That will be kept as a statistics , am i close ?

Time slices are also used on non-real time systems, like OpenBSD.

Many scheduling algorithms use the fact if a timeslice has been used
up (as opposed to not used up because a process entered a state waiting
for some event like user input to happen) as an indication to decide
if the process is cpu bound or IO/user (interactive) bound. 

That information is used (indirectly) the pick the next process to
schedule, how that information is used is a matter of policy, there is
no general rule to decide what is the best scheduling method. But
often batch processes get a lower priority, to favor interactive
processes. 

There is a load of information on this available. Scheduling
algorithms are well-studied. I suggest you take a book on OS design
and study that.

        -Otto

Reply via email to