Thanks, Raul. I'll look again at the sockets solution.

Some time since I ran that lab, but I seem to recall it had a timer to
poll the link hidden somewhere, so I think I dismissed it from my mind
for that reason. IMO it's as clunky as my other solutions: certainly
clunkier than the yellow-J approach. One good thing was the ability of
one process to send a "message" triggering a callback in the other
process. Specifically to execute a given J sentence. That would solve
most things. But is it a proper message, placed in the system's event
queue, or something the other process has to poll for?

A message "are you alive?" sent via a socket would surely need a
timeout to register the answer "no"?

A pair of mapped files might provide the nearest thing to my
recollection of 1970's-style "common memory". In the days before it
was deemed vital to build Chinese walls between asynchronous
processes. If each process updates a timestamp in its mapped file,
then a simple match (-:) would verify the other process is (still)
running. You wouldn't even need mapped files: just read the directory
timestamps.

Both process, I might add, are already having to run their own
timer-driven duty-cycles for other purposes. Oh for a system
"heartbeat", which could trigger an "Idle" event in any given process!

On Mon, Jan 2, 2012 at 6:59 PM, Raul Miller <rauldmil...@gmail.com> wrote:
> I think I would use (non-blocking) sockets for this.
>
> If you are using j6, I'd point you at the socket labs, which
> demonstrate their use.  I am not sure what state those labs are in for
> j7.
>
> --
> Raul
>
> On Mon, Jan 2, 2012 at 1:51 PM, Ian Clark <earthspo...@gmail.com> wrote:
>> Please forgive these questions I post to the list to which I know the
>> answer. Or rather: *an* answer. I learn a lot from others' responses.
>> Even if it's "my way is best after all" -- that's a valuable thing to
>> know.
>>
>> I have two separate J processes running (assume Linux / Darwin, though
>> I'm keen on cross-platform solutions). They communicate by each
>> writing a text file which is read by the other
>> (keep-it-simple-stupid). Is there a neat, robust way of one process
>> asking the other: "are you there?" or "are you still alive?"
>>
>> I'm au-fait with how the yellow-J works, all the solutions involving
>> timer-driven duty-cycles, timeouts, and reading files written by the
>> sister process, Or the files' timestamps, or permissions. But these
>> all seem so clunky. I guess what I want is something that was so easy
>> in the 1970s but is so awkward on today's machines: just reserve a
>> pair of bits in absolute memory -- or a pair of pixels on the screen
>> -- or some inessential system flags -- and play pat-a-cake with them.
>>
>> Once upon a time there was such a thing as "common memory".
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> 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