<p></p>
<p>Hi David, you say</p>
<p>"Another thing to consider is whether calling pthread_setschedparam()<br>
should be the default ...</p>
<p>My impression is that if I just ignore the warning</p>
<p>"pthread_setschedparam failed: Not owner"</p>
<p>the programs still run fine.</p>
<p>So perhaps the default could be changed NOT to issue a pthread_setschedparam()<br>
and make it optional."</p>
<p>This is not the right solution, but it's a little non-obvious.</p>
<p>What the setschedparam call does is raise the priority of the heartbeat thread relative to the main Smalltalk thread.  Leaving it out means that the heartbeat thread runs at the same priority as the main Smalltalk thread.  The effect of this is that if the main Smalltalk thread runs continuously, for example is in some compute-intensive loop, then the heartbeat thread will be prevented from running, and hence events such as Delay expiry will not be checked for, and the main thread will never be interrupted.  Try something like the following with a heartbeat thread running at the same priority as the main thread running on a single core machine and you'll manifest the issue:</p>
<pre lang="|" data-meta="p |"><code>p := [| i | i := 0. [(i := i + 1) odd ifTrue: [i := i - 1]] repeat] newProcess.
p forkAt: Processor activePriority - 1.
(Delay forSeconds: 1) wait.
p terminate```

without the heartbeat thread running at a higher priority process p consumes all the processor and the heartbeat thread never gets to run, consequently the Delay forSeconds: 1) wait does not complete and p continues running.
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/540#issuecomment-749130827">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AIJPEW2YOWFKWXQTJUDD5J3SV6JDJANCNFSM4URSFW6Q">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AIJPEW2XRAWMO32JKX5YFU3SV6JDJA5CNFSM4URSFW62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFSTNISY.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/540#issuecomment-749130827",
"url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/540#issuecomment-749130827",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>