Thread View: comp.sys.transputer
2 messages
2 total messages
Started by Naranker Dulay
Tue, 23 Oct 1990 16:09
Changing process priorities?
Author: Naranker Dulay
Date: Tue, 23 Oct 1990 16:09
Date: Tue, 23 Oct 1990 16:09
15 lines
1182 bytes
1182 bytes
In transputer assembly code how does a low priority process become a high priority process? ------------------------------------------------------------------- Naranker Dulay Email: nd@doc.ic.ac.uk Dept. of Computing, nd%uk.ac.ic.doc@nsfnet-relay.ac.uk Imperial College, nd@icdoc.UUCP or ..!ukc!icdoc!nd 180 Queen's Gate, Phone: +44 71-589-5111 ext 5091 London SW7 2BZ, UK. Fax: +44 71-581-8024 -- ___________________________________________________________________ Naranker Dulay Email: nd@doc.ic.ac.uk Dept. of Computing, nd%uk.ac.ic.doc@nsfnet-relay.ac.uk Imperial College, nd@icdoc.UUCP or ..!ukc!icdoc!nd
Re: Changing process priorities?
Author: Rob Kurver
Date: Wed, 24 Oct 1990 21:21
Date: Wed, 24 Oct 1990 21:21
87 lines
3144 bytes
3144 bytes
Recently, Naranker Dulay wrote:
> In transputer assembly code how does a low priority process become a
> high priority process?
Try the following code. Unshar, edit to suit your favorite assembler,
assemble and link in with the rest of your code. Now, you can call
stpri() at any time with the priority you want to be at. It works both
ways, i.e. stpri (0) switches to high priority, and stpri (1) switches to
low.
Sorry, no man page... :-)
#!/bin/sh
# This is a shell archive (shar 3.47)
# made 10/24/1990 21:16 UTC by rob@pact
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 1333 -rw-r--r-- stpri.s
#
# ============= stpri.s ==============
if test -f 'stpri.s' -a X"$1" != X"-c"; then
echo 'x - skipping stpri.s (File already exists)'
else
echo 'x - extracting stpri.s (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'stpri.s' &&
; Set priority of current process to argument given.
; Actually, we start a new process at the requested priority, and stop
; the current one.
X
; Assembly, so edit for your favorite assembler...
X
X
; static int Dummy[10]
;
; Couple of words to use as dummy workspace for original process before
; it is stopped.
X
X .dseg
X .bword 0, 10 ; workspace for old process
X .cseg
X
;
; void stpri (int pri)
;
; Set priority to argument given (0 is hi, 1 is high)
X
X .public stpri
stpri:
X stl 0
X ldc stpri2-stpri1 ; start of high priority process
X ldpi
stpri1:
X stl -1 ; store IPtr (to switch to high priority)
X ldlp 0 ; get current WPtr
X ldl 2
X ldc 1
X and ; get priority (1st argument)
X or ; make process decriptor with requested priority
X ldl 1
X ldnlp Dummy+8 ; load Dummy workspace address
X gajw ; switch to Dummy workspace
X rev ; get process descriptor in Areg
X runp ; run process at new priority
X stopp ; stop current ('old') process
stpri2:
X ret ; new process continues here
SHAR_EOF
chmod 0644 stpri.s ||
echo 'restore of stpri.s failed'
Wc_c="`wc -c < 'stpri.s'`"
test 1333 -eq "$Wc_c" ||
echo 'stpri.s: original size 1333, current size' "$Wc_c"
fi
exit 0
Enjoy. - Rob
--
PACT Rob Kurver
Foulkeslaan 87 rob@pact.nl
2625 RB Delft
The Netherlands +31 15 616864
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads