So, ...

Here is my understanding of these mechanisms in the context of Linux:

JDo is designed to work within a single process. You should be able to have
several J interpreters loaded in the same process, but when running one,
you wouldn’t be running the other(s).

You might be able to work around this using clone() instead of fork, but:

(1) you still need to ensure sequential operation (locks or semaphores or
whatever) when using JDo() or accessing another instance’s variables
(unless you don’t mind inconsistent results and/or crashes).

(2) There might be other, similar issues (perhaps revolving around
input/output). This isn’t something that has had a lot of testing.

If I were tackling a project like what you have described, I would use
sockets to communicate between processes (and I think the socket listeners
would essentially be the J interactive prompt).

Thanks,

—
Raul

On Tuesday, July 24, 2018, Raul Miller <[email protected]> wrote:

> Does JDo work at all in this setup, that’s what I was wanting to see...
>
> Thanks,
>
> —
> Raul
>
> On Tuesday, July 24, 2018, Sergey Kamenev <[email protected]> wrote:
>
>> On 24.07.2018 21:32, Raul Miller wrote:
>>
>>> On Tue, Jul 24, 2018 at 2:10 PM Sergey Kamenev <[email protected]>
>>> wrote:
>>>
>>>> I working under Gentoo linux based distributive (Calculate Linux)
>>>>
>>> I have not built any working examples of calling a j sub-process under
>>> linux.
>>>
>>> Can you point me at something illustrative and simple, but complete?
>>>
>>
>> I'm forking j process by using shared c library. It's no clear. It would
>> be better if J has received support for linux *fork* function.
>>
>> #!/usr/bin/env jc
>>
>> fork =: adverb : 0
>>   pid =: > '/lib/libc.so.6 __fork x' cd ''
>>   if. pid < 0 do.
>>     echo 'Error'
>>     0:
>>   elseif. pid > 0 do.
>>     echo 'Child'
>>     x
>>   elseif. do.
>>     echo 'Parent'
>>     0:
>>   end.
>> )
>>
>> child_work =: monad : 0
>>   NB. Sleep 4 second
>>   6!:3 ]4
>>   echo i.5
>>   1
>> )
>>
>> (exit @ 0: @ child_work) fork ''
>>
>> echo 'Return to parent'
>>
>> exit ''
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to