On 1/14/07, Perry Taylor <[EMAIL PROTECTED]> wrote:
I have several BASIC processes that are quite CPU intensive which I
would like to "slow" themselves down a bit so the don't take so much
processor time.  Is anyone aware of way for a UniVerse BASIC program to
change it's own processing priority?  Something akin to
getpriority()/setpriority() is C?

Perry,

Not sure of your platform but if you are on Unix/Linux then look at nice/renice.

They key advantage is it becomes an OS solution, you don't have to
manually tune your code with sleeps and pauses.  If you renice to a
higher value and your machine is doing nothing else, it will let your
intensive process have all the cpu it needs but as soon as a process
with a lower nice value requires cpu, your intensive process goes to
the back of the queue.  Tuning with sleeps seems like trying to
re-invent the wheel when the kernel has its own scheduler.  No idea if
you are on windows sorry.

A couple of gotchas...

With nice the lower the value, the higher the priority so -19 is going
to get everything it needs and +20 comes last.  IIRC a standard
foreground process like a telnet session defaults to 0.

You can only renice any process below 0 to speed them up if you are
the root user but IIRC you can renice all your own processes to slow
them down.

HTH

Adrian
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to