Object subclass: TerminationExperiment [ busyLoop [ | ptr count | count := 0. [ 'a' printNl. 'b' printNl. 'c' printNl. count := count + 1. (count \\ 100) = 0 ifTrue: [ Transcript << 'count: ' << count; nl. Processor yield]. ] repeat. ] run [ | p | p := Processor activeProcess. p printNl. [ Processor activeProcess printNl. [ (Delay forMilliseconds: 1000) wait. p terminate. ] repeat. ] fork. self busyLoop. ] run2 [ | p s | s := Semaphore new. p := [ [self busyLoop] ensure: [s signal] ] fork. p printNl. [ Processor activeProcess printNl. [ (Delay forMilliseconds: 1000) wait. p terminate. ] repeat. ] fork. s wait. ] ]. TerminationExperiment new run. "TerminationExperiment new run2."