Newsgroups: comp.sys.transputer
From: peterb@dcs.st-andrews.ac.uk (Peter Burgess)
Subject: Re: Best way to deschedule?
Organization: St Andrews University, Computational Science Department
Date: 18 Mar 1994 12:05:25 GMT
Message-ID: <peterb-180394114539@dalwhinnie.dcs.st-and.ac.uk>

In article <1994Mar16.165830.1341@buck.ac.uk>, brendan@buck.ac.uk (Brendan
Murphy) wrote:

> We were wondering about the best way to force a high priority process to
> deschedule itself.  A colleague of mine looked through the transputer 
> reference manual and came up with the following:
> 
> GUY
>   LDLP 0
>   RUNP
>   STOPP
> 
> Is this correct, and if so, is it optimal?

I assume that the effect you are trying to get is to put the current
process at the back of the queue?  In that case I think if you want to do
it with RUNP, you'll need to put the address of the first instruction to be
run when the process gets to the head of the queue again into workspace[-1]
first.  Something like:

   LDC offset
   LDPI
   STL -1
   LDLP 0
   RUNP
   STOPP

where offset is the offset to the next instruction after the STOPP.  A
better way might be to use the STARTP instruction, which takes the
workspace pointer and the offset from the current instruction of the iptr
of the new process as parameters in the a and b registers:

   LDC 1   -- STOPP is a 1 byte instruction.
   LDLP 0
   STARTP
   STOPP

Disclaimer: I haven't tried either of these.

---
Peter Burgess.

