[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Real" Multitasking (Re: GNO questions...)



vandry@CAM.ORG (Phillip Vandry) writes:

>Could you explain? I just checked out the manpage and select(3C) looks like
>it's got nothing to do with multitasking. It just tells you, given a bunch
>of file descriptors, which ones are ready for reading/writing/"other"

The important part is that select blocks your process until something happens
or it times out. This performs the same basic function as GetNextEvent and
the Run Queue (for the timeout mechanism).

>Besides, why would cooperative multitasking be necesary to prevent daemons
>from pegging the load average?

Because if the daemons don't do something that blocks, they have to sit in a
busy loop constantly checking to see if any data is ready for them to process.
This results in an always ready-to-run process and a contribution of 1 to the
load average for every such daemon.

>If there is cooperative multitasking, that means something runs and returns
>control to the system when IT wants, not when the system wants. So which are
>the processes that UNIX won't automatically switch?

Sorry. When I said cooperative multitasking I was not talking about pure
coop like everyone's brain seems to click into when they hear the term. I
meant that unix processes like daemons are expected to voluntarily give up
control of the system in order to prevent undesirable things like high load
averages. unix does not _rely_ on the daemons calling select, but the machine
runs a lot more efficiently when they do.

Todd Whitesel
toddpw @ cco.caltech.edu