[comp.sys.next] "nice" or "sleep" for NeXT PostScript?

wiml@milton.u.washington.edu (William Lewis) (08/07/90)

 A possibly NeXT-specific postscript question ... is there any way to
"nice" or otherwise reduce the priority/speed of a running PS context?
For instance, I have a program that just draws lines bouncing around
the screen ... but if I leave it running in a loop, it loads the machine
down too much. Some equivalent of "nice" to reduce the priority, or
"sleep"s that I could slip in here and there, would be quite useful ...
any postscript gurus out there know if there's a way to do this?


-- 
wiml@blake.acs.washington.edu       Seattle, Washington  | No sig under
(William Lewis)  |  47 41' 15" N   122 42' 58" W  |||||||| construction

glenn@heaven.woodside.ca.us (Glenn Reid) (08/07/90)

In article <5972@milton.u.washington.edu> wiml@milton.u.washington.edu (William Lewis) writes:
> A possibly NeXT-specific postscript question ... is there any way to
>"nice" or otherwise reduce the priority/speed of a running PS context?
>For instance, I have a program that just draws lines bouncing around
>the screen ... but if I leave it running in a loop, it loads the machine
>down too much. Some equivalent of "nice" to reduce the priority, or
>"sleep"s that I could slip in here and there, would be quite useful ...
>any postscript gurus out there know if there's a way to do this?

There is a scheduler built into the DPS server that executes a little bit
of each context if there are several of them.  This doesn't really load
the machine down, but it seems that way, because the processes' drawing
to the window server gets done a lot less often.

There is a PostScript operator called "yield" that is supposed to yield to
other running contexts.  I don't really know if this will work, but you
might try sprinkling "yield" throughout your running loop to see if it
helps.

Here is the definition of "yield" from the DPS manual:

yield
	suspends the current context until all other contexts sharing
	the same space have had a chance to execute. This should not
	be used as a synchronization primitive, since there is no way
	to predict how much execution the other contexts will be able
	to accomplish. The purpose of "yield" is to break up long-
	running computations that might lock out other contexts.

On the other hand, a "space" is defined as belonging to a single application,
so this probably won't help you that much.  You might explore the
multiple execution operators like "monitor" and "lock" and "wait" to see
if they can help you, but you would need at least one other cooperating
application to interact with your loop.

There isn't any other way to reduce the priority, as far as I know.

-- 
 Glenn Reid				PostScript/NeXT consultant
 glenn@heaven.woodside.ca.us		Independent Software Developer
 ..{adobe,next}!heaven!glenn		415-851-1785