|duration benchmarkResult sem backgroundProcess| backgroundProcess := nil. sem := nil. 100 timesRepeat: [ Monitor new critical: [ backgroundProcess ifNotNil: [ backgroundProcess terminate. backgroundProcess := nil]. sem ifNotNil: [ sem terminateProcess. sem := nil]. sem := Semaphore new. [ sem notNil ifTrue: [ sem waitTimeoutSeconds: 10 onCompletion: [ 'done' logCr ] onTimeout: [ 'timeout' logCr ] ] ] forkAt: Processor activePriority. backgroundProcess := [ "10000 timesRepeat: [ 1000 factorial ]." sem signal ] forkAt: Processor userBackgroundPriority ] ]. backgroundProcess ifNotNil: [ backgroundProcess terminate. backgroundProcess := nil]. sem ifNotNil: [ sem terminateProcess. sem := nil]. duration := 100 milliSeconds. benchmarkResult := [ 100 factorial ] benchFor: duration.