--- a/ProcessorScheduler.st Wed Feb 08 04:10:51 1995 +0100
+++ b/ProcessorScheduler.st Wed Feb 08 04:11:17 1995 +0100
@@ -23,6 +23,7 @@
UserSchedulingPriority
UserInterruptPriority
TimingPriority
+ HighestPriority
SchedulingPriority'
poolDictionaries:''
category:'Kernel-Processes'
@@ -32,7 +33,7 @@
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.27 1995-02-05 21:33:24 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.28 1995-02-08 03:11:03 claus Exp $
'!
Smalltalk at:#Processor put:nil!
@@ -55,7 +56,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.27 1995-02-05 21:33:24 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.28 1995-02-08 03:11:03 claus Exp $
"
!
@@ -91,19 +92,26 @@
KnownProcesses <Collection> all known processes
KnownProcessIds <Collection> and their IDs
+
PureEventDriven <Boolean> true, if no process support
is available
+
UserSchedulingPriority <Integer> the priority at which normal
user interfaces run
+
UserInterruptPriority the priority at which user-
interrupts (Cntl-C) processing
takes place. Processes with
a greater or equal priority are
not interruptable.
+
TimingPriority the priority used for timing.
Processes with a greater or
equal priority are not interrupted
by timers.
+
+ HighestPriority The highest allowed prio for processes
+
SchedulingPriority The priority of the scheduler (must
me higher than any other).
@@ -134,6 +142,7 @@
UserInterruptPriority := 24.
TimingPriority := 16.
SchedulingPriority := 31.
+ HighestPriority := 30.
Processor isNil ifTrue:[
"create the one and only processor"
@@ -306,12 +315,9 @@
activeProcess := aProcess.
currentPriority := pri.
%{
- extern OBJ __threadSwitch(), __threadSwitchWithSingleStep();
+ extern OBJ ___threadSwitch();
- if (singleStep == true)
- ok = __threadSwitchWithSingleStep(__context, _intVal(id));
- else
- ok = __threadSwitch(__context, _intVal(id));
+ ok = ___threadSwitch(__context, _intVal(id), (singleStep == true) ? 1 : 0);
%}.
"time passes spent in some other process ...
... here again"
@@ -368,7 +374,7 @@
"must be below schedulingPriority -
otherwise scheduler could be blocked ...
"
- ^ SchedulingPriority - 1
+ ^ HighestPriority
!
schedulingPriority
@@ -602,16 +608,16 @@
check if the running process is not the only one
"
l size ~~ 1 ifTrue:[
- "
- bring running process to the end
- "
- l removeFirst.
- l addLast:activeProcess.
+ "
+ bring running process to the end
+ "
+ l removeFirst.
+ l addLast:activeProcess.
- "
- and switch to first in the list
- "
- self threadSwitch:(l first).
+ "
+ and switch to first in the list
+ "
+ self threadSwitch:(l first).
].
wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
!
@@ -877,8 +883,8 @@
newPrio := 1.
] ifFalse:[
aProcess == scheduler ifTrue:[^ self].
- newPrio >= SchedulingPriority ifTrue:[
- newPrio := SchedulingPriority - 1
+ newPrio > HighestPriority ifTrue:[
+ newPrio := HighestPriority
]
].
@@ -954,17 +960,18 @@
highestPriorityRunnableProcess
"return the highest prio runnable process"
- |l p maxPri "{ Class: SmallInteger }" |
+ |listArray l p maxPri "{ Class: SmallInteger }" |
- maxPri := self highestPriority.
+ maxPri := HighestPriority.
+ listArray := quiescentProcessLists.
maxPri to:1 by:-1 do:[:prio |
- l := quiescentProcessLists at:prio.
+ l := listArray at:prio.
l notNil ifTrue:[
l isEmpty ifTrue:[
"
on the fly clear out empty lists
"
- quiescentProcessLists at:prio put:nil
+ listArray at:prio put:nil
] ifFalse:[
p := l first.
"
@@ -982,18 +989,27 @@
^ nil
!
+isSystemProcess:aProcess
+ "return true if aProcess is a system process,
+ which should not be suspended/terminated etc.."
+
+ (self class isPureEventDriven
+ or:[aProcess id == 0
+ or:[aProcess nameOrId endsWith:'dispatcher']]) ifTrue:[
+ ^ true
+ ].
+ ^ false
+
+ "
+ Processor activeProcessIsSystemProcess
+ "
+!
+
activeProcessIsSystemProcess
"return true if the active process is a system process,
which should not be suspended."
- |active|
-
- (self class isPureEventDriven
- or:[(active := self activeProcess) id == 0
- or:[active nameOrId endsWith:'dispatcher']]) ifTrue:[
- ^ true
- ].
- ^ false
+ ^ self isSystemProcess:activeProcess
"
Processor activeProcessIsSystemProcess