That's a good question, Bill, and I don't know the answer. I have not tried it under Windows: maybe it doesn't work there? It works on the Mac.
At the end of a run, both processes show similar displays with: showmap_jmf_'' : showmap_jmf_'' ┌──────────┬───────────────────────────────────────┬───────────────────────────────────────┬──┬────┬─────────┬─────────┬──┬─────┬──────┐ │name │fn │sn │fh│mh │address │header │ts│msize│refs │ ├──────────┼───────────────────────────────────────┼───────────────────────────────────────┼──┼────┼─────────┼─────────┼──┼─────┼──────┤ │CTL0_base_│/Users/ianclark/j602-user/temp/ctl0.jmf│/Users/ianclark/j602-user/temp/ctl0.jmf│44│1284│549224448│549224448│ │1000 │200029│ ├──────────┼───────────────────────────────────────┼───────────────────────────────────────┼──┼────┼─────────┼─────────┼──┼─────┼──────┤ │CTL1_base_│/Users/ianclark/j602-user/temp/ctl1.jmf│/Users/ianclark/j602-user/temp/ctl1.jmf│45│1284│559734784│559734784│ │1000 │200029│ └──────────┴───────────────────────────────────────┴───────────────────────────────────────┴──┴────┴─────────┴─────────┴──┴─────┴──────┘ I shall try generalizing it to more than 2 processes. That would be diagnostic. I observe in passing that each process <n> writes to its own CTL<n> and no other does. If more than one process wrote to a given CTL<n>, I'd anticipate a crash. Maybe all processes should access via share_jmf_ instead of map_jmf_, else vital protection is lost? The system is disturbingly symmetrical, with no one process apparently "owning" any of the mapped nouns (whatever that really means). Even if it finds CTL<n> absent and creates it with create_jmf_ -that still does not give it any noticeable "ownership". On Sun, Jan 8, 2012 at 7:17 AM, bill lam <bbill....@gmail.com> wrote: > Ian, > > I have not study the source carefully, but at the first glance, it seemed > that two running J processes accessing the same mapped file. Why > share_jmf_ was not needed? Please correct me if I missed anything. > > Вск, 08 Янв 2012, Ian Clark писал(а): >> 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 > > -- > regards, > ==================================================== > GPG key 1024D/4434BAB3 2008-08-24 > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm