[Vm-dev] pthread_setschedparam failed: Not owner

Eliot Miranda eliot.miranda at gmail.com
Wed Apr 1 14:16:56 UTC 2020


Hi Stes,

> On Mar 30, 2020, at 1:27 AM, stes <stes at telenet.be> wrote:
> 
> 
> 
> Because I have meanwhile a 64 bit version, I continue to look into this.
> 
> First of all, the 64 bit version executable seems to work excellent,
> the system is running very responsively, very smoothly.
> 
> I run it in RT (realtime class):
> 
> bash-4.4$ priocntl -d $$
> REAL TIME PROCESSES:
>   PID[/LWP]         RTPRI       TQNTM      TQSIG
>   8514                0          1000         0
> bash-4.4$ bin/squeak Squeak5.3-19431-64bit.image 
> 
> 
> There's no printf() warning when starting bin/squeak as such.  So there's no
> "pthread_setschedparam failed" message , provided I run the process in the
> RT class.
> 
> The Squeak image works perfectly fine.
> 
> I have tried to copied the following code (that was posted by Eliot Miranda
> in this discussion thread).
> 
> I copied the following in a Transcript window:
> 
>        | 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
> 
> Then I select the above and choose from Control-d  "do it" from the menu
> 
> Nothing happens.   How is the above code exactly supposed to test anything,
> please ??

The code creates one process proc that consumes all available cpu (in a single thread) but does not invoke garbage collection because all it does is loop setting n to 1 or 2.  So if the heartbeat thread is not running at a higher priority then it will be prevented from running by proc shutting it out (ignoring issues of thread processor affinity and multi core, but the vm is essentially a single Smalltalk execution thread so let’s keep within that model). And if the heartbeat thread is prevented from running then the spin loop proc will not break out to check for the delay timer expiring and so proc will not stop after a second.  Instead the system may lock up.

So the fact that nothing happens (in fact something does happen, the system is unresponsive for 1 second; try print it instead of doit, or surround the example in [ ... ] timeToRun) shows that the heartbeat thread is working correctly.

> 
> I don't quite understand the code and how it relates to the heart-beat
> thread.
> 
> At the UNIX level I can see there are 2 threads or LWP ( light weight
> processes) where one is running at a higher priority than the other.
> 
> 
> 
> 
> 
> --
> Sent from: http://forum.world.st/Squeak-VM-f104410.html


More information about the Vm-dev mailing list