restart of restartableProcesses must be done after
reinitialization of the event dispatcher.
--- a/ProcSched.st Sat Jun 06 20:38:24 1998 +0200
+++ b/ProcSched.st Sun Jun 07 02:08:56 1998 +0200
@@ -18,7 +18,7 @@
idleActions anyTimeouts dispatching interruptedProcess
useIOInterrupts gotIOInterrupt osChildExitActions
gotChildSignalInterrupt exitWhenNoMoreUserProcesses
- suspendScheduler timeSliceProcess'
+ suspendScheduler timeSliceProcess processesToRestart'
classVariableNames:'KnownProcesses KnownProcessIds PureEventDriven
UserSchedulingPriority UserInterruptPriority TimingPriority
HighestPriority SchedulingPriority MaxNumberOfProcesses
@@ -747,6 +747,136 @@
exitWhenNoMoreUserProcesses := aBoolean
! !
+!ProcessorScheduler methodsFor:'initializing'!
+
+initialize
+ "initialize the one-and-only ProcessorScheduler"
+
+ |nPrios "{ Class: SmallInteger }"
+ p l|
+
+ KnownProcesses isNil ifTrue:[
+ KnownProcesses := WeakArray new:30.
+ KnownProcesses addDependent:self class.
+ KnownProcessIds := OrderedCollection new.
+ ].
+
+ "
+ create a collection with process lists; accessed using the priority as key
+ "
+ nPrios := SchedulingPriority.
+ quiescentProcessLists := Array new:nPrios.
+"/ 1 to:nPrios do:[:pri |
+"/ quiescentProcessLists at:pri put:(LinkedList new)
+"/ ].
+
+ readFdArray := Array with:nil.
+ readCheckArray := Array with:nil.
+ readSemaphoreArray := Array with:nil.
+ writeFdArray := Array with:nil.
+ writeSemaphoreArray := Array with:nil.
+ timeoutArray := Array with:nil.
+ timeoutSemaphoreArray := Array with:nil.
+ timeoutActionArray := Array with:nil.
+ timeoutProcessArray := Array with:nil.
+ anyTimeouts := false.
+ dispatching := false.
+ exitWhenNoMoreUserProcesses := false. "/ mhmh - how about true ?
+ useIOInterrupts := OperatingSystem supportsIOInterrupts.
+ gotIOInterrupt := false.
+ osChildExitActions := Dictionary new.
+ gotChildSignalInterrupt := false.
+
+ "
+ handcraft the first (dispatcher-) process - this one will never
+ block, but go into a select if there is nothing to do.
+ Also, it has a prio of max+1 - thus, it comes first when looking
+ for a runnable process.
+ "
+ currentPriority := SchedulingPriority.
+ p := Process basicNew.
+ p setId:0 state:#run.
+ p setPriority:currentPriority.
+ p name:'scheduler'.
+
+ scheduler := activeProcess := p.
+ activeProcessId := 0.
+
+ quiescentProcessLists at:currentPriority put:(l := LinkedList new).
+ l add:p.
+
+ "
+ let me handle IO and timer interrupts
+ "
+ ObjectMemory ioInterruptHandler:self.
+ ObjectMemory timerInterruptHandler:self.
+ ObjectMemory childSignalInterruptHandler:self.
+
+ "Modified: 29.7.1996 / 12:10:59 / cg"
+ "Modified: 7.1.1997 / 16:48:26 / stefan"
+!
+
+reinitialize
+ "all previous processes (except those marked as restartable) are made dead
+ - each object should reinstall its process(s) upon restart;
+ especially, windowgroups have to.
+ In contrast to ST-80, restartable processes are restarted at the beginning
+ NOT continued where left. This is a consequence of the portable implementation
+ of ST/X, since in order to continue a process, we needed to know the
+ internals of the machines (and C-compilers) stack layout.
+ This was not done, favouring portability for process continuation.
+ In praxis, this is not much of a problem, since in almost every case,
+ the computation state can be saved in some object, and processing be
+ restarted from scratch, reinitializing things from this saved state."
+
+ "
+ lay all processes to rest, collect restartable ones
+ "
+ processesToRestart := OrderedCollection new.
+ KnownProcesses do:[:p |
+ (p notNil and:[p ~~ 0]) ifTrue:[
+ "how, exactly should this be done ?"
+
+ p isRestartable == true ifTrue:[
+ p nextLink:nil.
+ processesToRestart add:p
+ ] ifFalse:[
+ p setId:nil state:#dead
+ ]
+ ].
+ ].
+ scheduler setId:nil state:#dead.
+
+ "
+ now, start from scratch
+ "
+ KnownProcesses := nil.
+ self initialize.
+
+ "Modified: / 7.6.1998 / 02:05:47 / cg"
+!
+
+restartRestartableProcesses
+ "restart those that can be.
+ This must be done as a second step, to make certain that all
+ of the GUI classes are intitialized first (and, especially the
+ event dispatching mechanism is running)"
+
+ |procs|
+
+ procs := processesToRestart.
+ procs notNil ifTrue:[
+ processesToRestart := nil.
+
+ procs do:[:p |
+ p imageRestart
+ ]
+ ]
+
+ "Created: / 7.6.1998 / 02:06:52 / cg"
+ "Modified: / 7.6.1998 / 02:07:59 / cg"
+! !
+
!ProcessorScheduler methodsFor:'os process handling'!
childSignalInterrupt
@@ -1142,124 +1272,6 @@
wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
! !
-!ProcessorScheduler methodsFor:'private initializing'!
-
-initialize
- "initialize the one-and-only ProcessorScheduler"
-
- |nPrios "{ Class: SmallInteger }"
- p l|
-
- KnownProcesses isNil ifTrue:[
- KnownProcesses := WeakArray new:30.
- KnownProcesses addDependent:self class.
- KnownProcessIds := OrderedCollection new.
- ].
-
- "
- create a collection with process lists; accessed using the priority as key
- "
- nPrios := SchedulingPriority.
- quiescentProcessLists := Array new:nPrios.
-"/ 1 to:nPrios do:[:pri |
-"/ quiescentProcessLists at:pri put:(LinkedList new)
-"/ ].
-
- readFdArray := Array with:nil.
- readCheckArray := Array with:nil.
- readSemaphoreArray := Array with:nil.
- writeFdArray := Array with:nil.
- writeSemaphoreArray := Array with:nil.
- timeoutArray := Array with:nil.
- timeoutSemaphoreArray := Array with:nil.
- timeoutActionArray := Array with:nil.
- timeoutProcessArray := Array with:nil.
- anyTimeouts := false.
- dispatching := false.
- exitWhenNoMoreUserProcesses := false. "/ mhmh - how about true ?
- useIOInterrupts := OperatingSystem supportsIOInterrupts.
- gotIOInterrupt := false.
- osChildExitActions := Dictionary new.
- gotChildSignalInterrupt := false.
-
- "
- handcraft the first (dispatcher-) process - this one will never
- block, but go into a select if there is nothing to do.
- Also, it has a prio of max+1 - thus, it comes first when looking
- for a runnable process.
- "
- currentPriority := SchedulingPriority.
- p := Process basicNew.
- p setId:0 state:#run.
- p setPriority:currentPriority.
- p name:'scheduler'.
-
- scheduler := activeProcess := p.
- activeProcessId := 0.
-
- quiescentProcessLists at:currentPriority put:(l := LinkedList new).
- l add:p.
-
- "
- let me handle IO and timer interrupts
- "
- ObjectMemory ioInterruptHandler:self.
- ObjectMemory timerInterruptHandler:self.
- ObjectMemory childSignalInterruptHandler:self.
-
- "Modified: 29.7.1996 / 12:10:59 / cg"
- "Modified: 7.1.1997 / 16:48:26 / stefan"
-!
-
-reinitialize
- "all previous processes (except those marked as restartable) are made dead
- - each object should reinstall its process(s) upon restart;
- especially, windowgroups have to.
- In contrast to ST-80, restartable processes are restarted at the beginning
- NOT continued where left. This is a consequence of the portable implementation
- of ST/X, since in order to continue a process, we needed to know the
- internals of the machines (and C-compilers) stack layout.
- This was not done, favouring portability for process continuation.
- In praxis, this is not much of a problem, since in almost every case,
- the computation state can be saved in some object, and processing be
- restarted from scratch, reinitializing things from this saved state."
-
- |processesToRestart|
-
- "
- lay all processes to rest, collect restartable ones
- "
- processesToRestart := OrderedCollection new.
- KnownProcesses do:[:p |
- (p notNil and:[p ~~ 0]) ifTrue:[
- "how, exactly should this be done ?"
-
- p isRestartable == true ifTrue:[
- p nextLink:nil.
- processesToRestart add:p
- ] ifFalse:[
- p setId:nil state:#dead
- ]
- ].
- ].
- scheduler setId:nil state:#dead.
-
- "
- now, start from scratch
- "
- KnownProcesses := nil.
- self initialize.
-
- "
- ... and restart those that can be.
- "
- processesToRestart do:[:p |
- p imageRestart
- ]
-
- "Modified: 28.10.1996 / 20:45:54 / cg"
-! !
-
!ProcessorScheduler methodsFor:'process creation'!
newProcessFor:aProcess
@@ -2678,6 +2690,6 @@
!ProcessorScheduler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.147 1998-03-04 19:07:14 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.148 1998-06-07 00:08:56 cg Exp $'
! !
ProcessorScheduler initialize!
--- a/ProcessorScheduler.st Sat Jun 06 20:38:24 1998 +0200
+++ b/ProcessorScheduler.st Sun Jun 07 02:08:56 1998 +0200
@@ -18,7 +18,7 @@
idleActions anyTimeouts dispatching interruptedProcess
useIOInterrupts gotIOInterrupt osChildExitActions
gotChildSignalInterrupt exitWhenNoMoreUserProcesses
- suspendScheduler timeSliceProcess'
+ suspendScheduler timeSliceProcess processesToRestart'
classVariableNames:'KnownProcesses KnownProcessIds PureEventDriven
UserSchedulingPriority UserInterruptPriority TimingPriority
HighestPriority SchedulingPriority MaxNumberOfProcesses
@@ -747,6 +747,136 @@
exitWhenNoMoreUserProcesses := aBoolean
! !
+!ProcessorScheduler methodsFor:'initializing'!
+
+initialize
+ "initialize the one-and-only ProcessorScheduler"
+
+ |nPrios "{ Class: SmallInteger }"
+ p l|
+
+ KnownProcesses isNil ifTrue:[
+ KnownProcesses := WeakArray new:30.
+ KnownProcesses addDependent:self class.
+ KnownProcessIds := OrderedCollection new.
+ ].
+
+ "
+ create a collection with process lists; accessed using the priority as key
+ "
+ nPrios := SchedulingPriority.
+ quiescentProcessLists := Array new:nPrios.
+"/ 1 to:nPrios do:[:pri |
+"/ quiescentProcessLists at:pri put:(LinkedList new)
+"/ ].
+
+ readFdArray := Array with:nil.
+ readCheckArray := Array with:nil.
+ readSemaphoreArray := Array with:nil.
+ writeFdArray := Array with:nil.
+ writeSemaphoreArray := Array with:nil.
+ timeoutArray := Array with:nil.
+ timeoutSemaphoreArray := Array with:nil.
+ timeoutActionArray := Array with:nil.
+ timeoutProcessArray := Array with:nil.
+ anyTimeouts := false.
+ dispatching := false.
+ exitWhenNoMoreUserProcesses := false. "/ mhmh - how about true ?
+ useIOInterrupts := OperatingSystem supportsIOInterrupts.
+ gotIOInterrupt := false.
+ osChildExitActions := Dictionary new.
+ gotChildSignalInterrupt := false.
+
+ "
+ handcraft the first (dispatcher-) process - this one will never
+ block, but go into a select if there is nothing to do.
+ Also, it has a prio of max+1 - thus, it comes first when looking
+ for a runnable process.
+ "
+ currentPriority := SchedulingPriority.
+ p := Process basicNew.
+ p setId:0 state:#run.
+ p setPriority:currentPriority.
+ p name:'scheduler'.
+
+ scheduler := activeProcess := p.
+ activeProcessId := 0.
+
+ quiescentProcessLists at:currentPriority put:(l := LinkedList new).
+ l add:p.
+
+ "
+ let me handle IO and timer interrupts
+ "
+ ObjectMemory ioInterruptHandler:self.
+ ObjectMemory timerInterruptHandler:self.
+ ObjectMemory childSignalInterruptHandler:self.
+
+ "Modified: 29.7.1996 / 12:10:59 / cg"
+ "Modified: 7.1.1997 / 16:48:26 / stefan"
+!
+
+reinitialize
+ "all previous processes (except those marked as restartable) are made dead
+ - each object should reinstall its process(s) upon restart;
+ especially, windowgroups have to.
+ In contrast to ST-80, restartable processes are restarted at the beginning
+ NOT continued where left. This is a consequence of the portable implementation
+ of ST/X, since in order to continue a process, we needed to know the
+ internals of the machines (and C-compilers) stack layout.
+ This was not done, favouring portability for process continuation.
+ In praxis, this is not much of a problem, since in almost every case,
+ the computation state can be saved in some object, and processing be
+ restarted from scratch, reinitializing things from this saved state."
+
+ "
+ lay all processes to rest, collect restartable ones
+ "
+ processesToRestart := OrderedCollection new.
+ KnownProcesses do:[:p |
+ (p notNil and:[p ~~ 0]) ifTrue:[
+ "how, exactly should this be done ?"
+
+ p isRestartable == true ifTrue:[
+ p nextLink:nil.
+ processesToRestart add:p
+ ] ifFalse:[
+ p setId:nil state:#dead
+ ]
+ ].
+ ].
+ scheduler setId:nil state:#dead.
+
+ "
+ now, start from scratch
+ "
+ KnownProcesses := nil.
+ self initialize.
+
+ "Modified: / 7.6.1998 / 02:05:47 / cg"
+!
+
+restartRestartableProcesses
+ "restart those that can be.
+ This must be done as a second step, to make certain that all
+ of the GUI classes are intitialized first (and, especially the
+ event dispatching mechanism is running)"
+
+ |procs|
+
+ procs := processesToRestart.
+ procs notNil ifTrue:[
+ processesToRestart := nil.
+
+ procs do:[:p |
+ p imageRestart
+ ]
+ ]
+
+ "Created: / 7.6.1998 / 02:06:52 / cg"
+ "Modified: / 7.6.1998 / 02:07:59 / cg"
+! !
+
!ProcessorScheduler methodsFor:'os process handling'!
childSignalInterrupt
@@ -1142,124 +1272,6 @@
wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
! !
-!ProcessorScheduler methodsFor:'private initializing'!
-
-initialize
- "initialize the one-and-only ProcessorScheduler"
-
- |nPrios "{ Class: SmallInteger }"
- p l|
-
- KnownProcesses isNil ifTrue:[
- KnownProcesses := WeakArray new:30.
- KnownProcesses addDependent:self class.
- KnownProcessIds := OrderedCollection new.
- ].
-
- "
- create a collection with process lists; accessed using the priority as key
- "
- nPrios := SchedulingPriority.
- quiescentProcessLists := Array new:nPrios.
-"/ 1 to:nPrios do:[:pri |
-"/ quiescentProcessLists at:pri put:(LinkedList new)
-"/ ].
-
- readFdArray := Array with:nil.
- readCheckArray := Array with:nil.
- readSemaphoreArray := Array with:nil.
- writeFdArray := Array with:nil.
- writeSemaphoreArray := Array with:nil.
- timeoutArray := Array with:nil.
- timeoutSemaphoreArray := Array with:nil.
- timeoutActionArray := Array with:nil.
- timeoutProcessArray := Array with:nil.
- anyTimeouts := false.
- dispatching := false.
- exitWhenNoMoreUserProcesses := false. "/ mhmh - how about true ?
- useIOInterrupts := OperatingSystem supportsIOInterrupts.
- gotIOInterrupt := false.
- osChildExitActions := Dictionary new.
- gotChildSignalInterrupt := false.
-
- "
- handcraft the first (dispatcher-) process - this one will never
- block, but go into a select if there is nothing to do.
- Also, it has a prio of max+1 - thus, it comes first when looking
- for a runnable process.
- "
- currentPriority := SchedulingPriority.
- p := Process basicNew.
- p setId:0 state:#run.
- p setPriority:currentPriority.
- p name:'scheduler'.
-
- scheduler := activeProcess := p.
- activeProcessId := 0.
-
- quiescentProcessLists at:currentPriority put:(l := LinkedList new).
- l add:p.
-
- "
- let me handle IO and timer interrupts
- "
- ObjectMemory ioInterruptHandler:self.
- ObjectMemory timerInterruptHandler:self.
- ObjectMemory childSignalInterruptHandler:self.
-
- "Modified: 29.7.1996 / 12:10:59 / cg"
- "Modified: 7.1.1997 / 16:48:26 / stefan"
-!
-
-reinitialize
- "all previous processes (except those marked as restartable) are made dead
- - each object should reinstall its process(s) upon restart;
- especially, windowgroups have to.
- In contrast to ST-80, restartable processes are restarted at the beginning
- NOT continued where left. This is a consequence of the portable implementation
- of ST/X, since in order to continue a process, we needed to know the
- internals of the machines (and C-compilers) stack layout.
- This was not done, favouring portability for process continuation.
- In praxis, this is not much of a problem, since in almost every case,
- the computation state can be saved in some object, and processing be
- restarted from scratch, reinitializing things from this saved state."
-
- |processesToRestart|
-
- "
- lay all processes to rest, collect restartable ones
- "
- processesToRestart := OrderedCollection new.
- KnownProcesses do:[:p |
- (p notNil and:[p ~~ 0]) ifTrue:[
- "how, exactly should this be done ?"
-
- p isRestartable == true ifTrue:[
- p nextLink:nil.
- processesToRestart add:p
- ] ifFalse:[
- p setId:nil state:#dead
- ]
- ].
- ].
- scheduler setId:nil state:#dead.
-
- "
- now, start from scratch
- "
- KnownProcesses := nil.
- self initialize.
-
- "
- ... and restart those that can be.
- "
- processesToRestart do:[:p |
- p imageRestart
- ]
-
- "Modified: 28.10.1996 / 20:45:54 / cg"
-! !
-
!ProcessorScheduler methodsFor:'process creation'!
newProcessFor:aProcess
@@ -2678,6 +2690,6 @@
!ProcessorScheduler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.147 1998-03-04 19:07:14 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.148 1998-06-07 00:08:56 cg Exp $'
! !
ProcessorScheduler initialize!