-
Notifications
You must be signed in to change notification settings - Fork 1
Processes 101
Dr. Nicola Mingotti edited this page Feb 4, 2022
·
7 revisions
- Open a Transcript window and a the ProcessBrowser, keep them open and run what's next.
- We create a process that every seconds print a random number in the Transcript window, like this:
pr1 _ [ [true] whileTrue: [
Transcript log: 'process runnning -- id: ', (100 atRandom asString) .
(Delay forDuration: (Duration seconds: 1)) wait.
] ] newProcess.
- You should see it already in the ProcessBrowser, but let's give it a name so you will see it better
pr1 name: 'test --- pr1'.
- You should also see in the ProcessBrowser, on the left side the priority of the process is 40. As the Morhipc UI. We don't like that, we want our processes to have inferior priority in general, just to be sure they are not going to starve our user interface.
- We change the priority process with:
pr1 priority: 30.
" or, with more readability and no magic numbers "
XXX
- In the Transcript window you still see no output, indeed the process is by default in a suspended state
pr1 isSuspended . "=> true "
- let's start the process sending it the
resume
message.
pr1 resume.
- now you see stuff in the transcript
- try to freeze it sending the
resume
message
pr1 resume.
- When you are sick of the thing and you want to get rid of the process, just kill it with:
pr1 terminate.
- Observe that after this you can't see the process in ProcessBrowser.
- Exercise. The 'bomb', a process that will make you loose control of Cuis. Be sure you save all what is important and try this.