A question is what you do if the answer is no? Also if the asking process is not alive.
If you have an OS process starting new processes it could solve some such cases. 2012/1/8 Ian Clark <earthspo...@gmail.com> > This is my eventual solution to the "are you alive?" problem: > > http://www.jsoftware.com/jwiki/Scripts/AliveDemo > > It doesn't use sockets, but a couple of mapped files instead. The > (identically coded) processes use them to play pat-a-cake. > > For demo simplicity I've coded a 'hard' duty cycle (a while.-loop.) > rather than one I find much more convenient: a "soft" duty cycle that > posts an event calling itself again after a given interval. > > A "soft" duty cycle has a lot of advantages. You have to play with the > alternatives to appreciate them, but the main ones are that it dies > gracefully if there's a code error, and it doesn't lock the session > window and any UI which the duty cycle happens to be managing. Indeed > the duty cycle runs in the background, keeping all displays up-to-date > and leaving you (almost) full use of J facilities. > > I'll place a "soft" duty cycle code sample on the wiki in a day or two. > > On Mon, Jan 2, 2012 at 6: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 > -- Björn Helgason, Verkfræðingur Fornustekkum II 781 Hornafirði, t-póst: gos...@gmail.com gsm: +3546985532 twitter: @flugfiskur http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .-----------------------------------. ,' .\ / | Með léttri lund verður | ,--' _,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. | `-----------------------------------' | ) | (\_ _/) (`-. '--.) (='.'=) ♖♘♗♕♔♙ `. )----' (")_(") ☃☠ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm