"FORK" "Nem elozik meg egymast, csak ha az egyik atadja a vezerlest vagy magasabb prioritasu van" [10 timesRepeat: [Transcript show: '1']] fork. [10 timesRepeat: [Transcript show: '2']] fork. "Valtakoznak osszevissza" [10 timesRepeat: [Transcript show: '1'. (Delay forMilliseconds: 1) wait]] fork. [10 timesRepeat: [Transcript show: '2'. (Delay forMilliseconds: 1) wait]] fork. "Scheduler donti el melyik kovetkezzen (yield parancs)" [10 timesRepeat: [Transcript show: '1'. Processor yield]] fork. [10 timesRepeat: [Transcript show: '2'. Processor yield]] fork. "Prioritassal elmeletileg =>112222222222111111111" [10 timesRepeat: [Transcript show: '1']] forkAt: 10. "(Delay forMilliseconds: 1) wait." [10 timesRepeat: [Transcript show: '2']] forkAt: 51. "Process leallitasa" |process| process := [[Transcript cr; show: 'Hi there'. (Delay forSeconds: 1) wait] repeat] fork. (Delay forSeconds: 5) wait. process terminate. Transcript cr; show: 'All Done'. "Suspend" "Vigyazat a suspend-el, legjobb ha a szal sajat maga suspendeli magat, ne hogy valami fontos dolog kozben alljon le" |process| process := [1 to: 10 do: [:index | Transcript cr; show: Time now printString. index = 5 ifTrue: [Processor activeProcess suspend]]] fork. (Delay forSeconds: 5) wait. process resume. "Shared queue" "figyeljuk meg, forkAt :99 -el mas eredmeny" |sharedQueue readProcess| sharedQueue := SharedQueue new. readProcess := [[Transcript show: ' R', sharedQueue next printString] repeat] fork. [1 to: 5 do: [:index | Transcript show: ' W', index printString. sharedQueue nextPut: index. Processor yield]] fork. (Delay forSeconds: 5) wait. readProcess terminate. "Semaphore" | semaphore | semaphore := Semaphore new. [Transcript cr; show: 'About to wait'. semaphore wait. Transcript cr; show: 'Semaphore signaled'] fork. (Delay forSeconds: 5) wait. semaphore signal