ProcessorScheduler.st
branchjv
changeset 23071 77ad9497363c
parent 20080 093324d7a47c
child 23072 0402b3e0d43b
--- a/ProcessorScheduler.st	Wed Oct 12 07:05:13 2016 +0200
+++ b/ProcessorScheduler.st	Wed Oct 19 09:22:53 2016 +0100
@@ -31,7 +31,7 @@
 		UserSchedulingPriority UserInterruptPriority TimingPriority
 		HighestPriority SchedulingPriority MaxNumberOfProcesses
 		InvalidProcessSignal TimeSlicingPriorityLimit TimeSliceInterval
-		EventPollingInterval MaxProcessId'
+		EventPollingInterval MinProcessId MaxProcessId SysProcessId'
 	poolDictionaries:''
 	category:'Kernel-Processes'
 !
@@ -263,6 +263,8 @@
     HighestPriority := 30.
     SchedulingPriority := 31.
 
+    self initializeVMProcessIdConstants.
+
     InvalidProcessSignal isNil ifTrue:[
 	InvalidProcessSignal := Error newSignalMayProceed:true.
 	InvalidProcessSignal nameClass:self message:#invalidProcessSignal.
@@ -283,30 +285,27 @@
     PureEventDriven ifTrue:[
 	'Processor [error]: no process support - running event driven' errorPrintCR
     ].
-    self initializeVMMaxProcessId
+    
 
     "Modified: / 23-09-1996 / 14:24:50 / stefan"
     "Modified: / 10-01-1997 / 18:03:03 / cg"
     "Modified: / 19-09-2014 / 12:47:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-initializeVMMaxProcessId
+initializeVMProcessIdConstants
 
     "/ for java locks, the VM may reserve some bits
     "/ and reduce the maximum processID to be able to
     "/ encode the id in an object's header field.
 %{
 #ifndef __SCHTEAM__
-
-# ifndef MAX_PROCESS_ID
-#  define MAX_PROCESS_ID _MAX_INT
-# endif
-
+    @global(ProcessorScheduler:MinProcessId) = __MKSMALLINT(MIN_PROCESS_ID);
     @global(ProcessorScheduler:MaxProcessId) = __MKSMALLINT(MAX_PROCESS_ID);
+    @global(ProcessorScheduler:SysProcessId) = __MKSMALLINT(SYS_PROCESS_ID);
     RETURN (self);
 #endif /* not SCHTEAM */
 %}.
-    MaxProcessId := SmallInteger maxVal.
+    self primitiveFailed
 ! !
 
 !ProcessorScheduler class methodsFor:'instance creation'!
@@ -959,13 +958,13 @@
     currentPriority := SchedulingPriority.
     p := Process basicNew.
     p
-	setId:0 state:#run;
+	setId:SysProcessId state:#run;
 	setPriority:currentPriority;
 	name:'scheduler';
-	beSystemProcess.
+	beSystemProcess.	
 
     scheduler := activeProcess := p.
-    activeProcessId := 0.
+    activeProcessId := SysProcessId.    
 
     quiescentProcessLists at:currentPriority put:(l := LinkedList new).
     l add:p.
@@ -1319,7 +1318,7 @@
 	 - a halted process cannot execute its interrupt
 	   actions (win32 only)
 	"
-	(id := p id) ~~ 0 ifTrue:[
+	(id := p id) ~~ SysProcessId ifTrue:[
 	    id notNil ifTrue:[
 		'Processor [warning]: problem with process ' errorPrint.
 		id errorPrint.