Hi Stes,
I answered this at length here earlier today. Just forwarded the message to you.
_,,,^..^,,,_ (phone)
On Apr 1, 2020, at 9:59 AM, stes stes@telenet.be wrote:
| proc sem | proc := [| n | n := 0. [(n := n + 1) even ifTrue: [n := n - 1]] repeat] newProcess. sem := Semaphore new. [(Delay forSeconds: 1) wait. proc terminate. sem signal] forkAt: Processor userInterruptPriority. proc resume. sem wait
If I select the above and choose "print it" it prints:
a Semaphore()
If put [] around it and print it , it prints 1002
I'm sorry this is a beginner's question but I don't quite see what the result of the program should be, and whether the answer is correct.
I ran the above code in the RT (real time) class
bash-4.4$ priocntl -d $$ REAL TIME PROCESSES: PID[/LWP] RTPRI TQNTM TQSIG 16991 0 1000 0
If I run the same code in the Timeshare (TS) or IA (interactive) class the results are the same:
it prints 1002 if I put [] around it and print it, and it prints "a Semaphore()" after about 1 second if I just print the code
Note that in the IA case (which is the default) the vm prints: pthread_setschedparam failed: Not owner This VM uses a separate heartbeat thread to update its internal clock and handle events. For best operation, this thread should run at a higher priority, however the VM was unable to change the priority. The effect is that heavily loaded systems may experience some latency issues. If this occurs, please create the appropriate configuration file in /etc/security/limits.d/ as shown below:
cat <<END | sudo tee /etc/security/limits.d/squeak.conf
hard rtprio 2
soft rtprio 2
END
and report to the squeak mailing list whether this improves behaviour.
You will need to log out and log back in for the limits to take effect. For more information please see https://github.com/OpenSmalltalk/opensmalltalk-vm/releases/tag/r3732#linux
If I put the vm in the RT class then it doesn't print this warning or error message.
But the behavior of the "test code" in Squeak seems to me the same ...
-- Sent from: http://forum.world.st/Squeak-VM-f104410.html