#class(#pointer) Process(Object) { #dcl initial active state prev next. #method new { "instantiation is not allowed" ^nil. "TODO: raise an exception" } #method prev { ^self.prev. } #method next { ^self.next. } #method next: aProcess { self.next := aProcess. } #method prev: aProcess { self.prev := aProcess. } #method resume { ^Scheduler resume: self. } } #class ProcessScheduler(Object) { #dcl tally head tail active. #method new { "instantiation is not allowed" ^nil. "TODO: raise an exception" } #method activeProcess { ^self.active. } #method add: aProcess { self primitiveFailed. "The primitive does something like the following. (self.tally = 0) ifTrue: [ self.head := aProcess. self.tail := aProcess. self.tally := 1. ] ifFalse: [ aProcess next: self.head. self.head prev: aProcess. self.head := aProcess. self.tally := self.tally + 1. ]." } #method resume: aProcess { self primitiveFailed. "self add: aProcess. TODO: need to change state of a Process??? self.active := aProcess." } #method remove: aProcess { "" "TODO: " } #method suspendActive { " TODO: .........." } " #method yield { self primitiveFailed } #method enter: aContext { self primitiveFailed } " }