Post by John Doppke
I've been playing with some inter-process communication via Basic using
a global section. It all works very well except for one thing - data
in an array. Everything else comes across nicely - strings, longs,
etc. But anything in an array written by one process never shows up in
Is there something inherent in the structure of a Basic array that
doesn't work in a global section?
I've also tried an installed shared psect image and that works OK.
Without using the debugger to look at what's been written into the
section, I'd guess that you've used a position-independent section and
have that section mapped into to different virtual address ranges and
the data structures you've then written data structures (e.g. string
and array descriptors) containing virtual addresses from one process
context that are mismatched with the virtual addresses from the other
process(es) accessing that same section.
BASIC doesn't do base-relative memory access, which means you'll have
to map the section at the same virtual address range in each process
(commons tend to be mapped at fixed addresses), or use only data and
not addresses, or do some work to wrap base-relative access for use
C, C++, and ilk do better here than does BASIC, as pointers and pointer
math and pointer dereferencing are language-integrated, and as
base-relative memory addressing can be implemented with what's
available within the language. BASIC LOC() only gets you so far.
Mapping the section into an address range up in 64-bit P2 space can be
an alternative to the usually-more-crowded P0 space, but BASIC is again
less than useful there being a 32-bit language. BASIC LOC() returns a
longword, not a quadword.
One other wrinkle you'll encounter as you proceed: you will want to
understand and use interlocked queue instructions and interlocked
bitlocks just as soon as you start using a multiprocessor system, as
now you're fully exposed to processor caching. This detail and other
parts of resource coordination and locking are discussed in the
Programming Concepts manual. Some of that material starts around here:
In aggregate, using IP sockets, mailboxes, ICC, or other APIs, can be
preferable for all but the highest-performance requirements, as these
existing APIs deal with this low-level memory and cache stuff and
back-pressure and with notification support already available. Even
local DECnet, for the few of you that have that set up—though ICC is
patterned on DECnet, and requires no license on host or within a
cluster, and requires no network configuration and no startup.
Pure Personal Opinion | HoffmanLabs LLC