[Vm-dev] Unix heartbeat thread vs itimer

Ben Coman btc at openinworld.com
Wed Apr 12 05:45:23 UTC 2017


On Wed, Apr 12, 2017 at 9:18 AM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
> Hi Ben,
>
> On Sat, Apr 8, 2017 at 6:39 PM, Ben Coman <btc at openinworld.com> wrote:
>>
>>
>>
>>
>> On Fri, Jan 6, 2017 at 10:44 PM, Guillermo Polito <guillermopolito at gmail.com> wrote:
>>>
>>>
>>> Hi,
>>>
>>> I was checking the code in sqUnixHeartbeat.c to see how the heartbeat thread/itimer worked. It somehow bothers me that there are different compiled artifacts, one per option.
>>>
>>> What do you think about having a VM that manages that as an argument provided when we launch the VM? This would add some flexibility that we don't have right now because we make the decision at compile time.
>>>
>>
>> Can someone advise how to create a new VM setting and read/write to it from the Image?
>
>
> Give me an example of the kind of setting and I'll make you through it.

Thanks.  I'll ask further when I've got something more concrete to work with.

> The kinds of settings I know about are:
>
> 1. has a command line keyword and argument to set it
>
> 2. has a persistent value stored in the image header and is set via vmParameterAt:[put:]

[2.] is the one I was asking about, but I should also pay attention to [1.].

>
> 3. 1 + 2
>
>> As a challenge, I'd actually like to play with dynamically switching the heatbeat between threaded & timer while the Image is running.
>>
>> Also it would be nice for the Image to be able to inspect what priorities the heatbeat thread is running at.
>
>
> Ugh :-(  That's a lot of plumbing.  Much easier to just put a printf in a custom version of the VM somewhere?

Where's the challenge in that?  ;)
Whether it should be default part of the VM is different question.

>
>
>> As well, what is the simplest reliably crashing example of signal conflict with the timer-beat VM?
>
>
> There isn't a way that reliably crashes the Vm (it doesn't crash).  Instead I posted an example which should demonstrate the problem.  Here it is again.
>
> [| infiniteLoop |
> infiniteLoop := [| sum | sum := 0. [sum < 10] whileTrue: [sum := sum + (sum even ifTrue: [1] ifFalse: [-1])]] newProcess.
> infiniteLoop resume.
> Processor activeProcess priority: Processor activePriority + 1.
> (Delay forSeconds: 1) wait.
> infiniteLoop terminate.
> Processor activeProcess priority: Processor activePriority - 1] timeToRun 1001

IIUC, that tests the thread-beat VM.
Sorry I switched topics.
I was looking for examples where OSProcess(?) or otherwise fails due
to (presumed) conflict with the itimer-beat signals.

cheers -ben


More information about the Vm-dev mailing list