M
Me
howdy.
Some of this will sound a bit platform specific and a few of you will feel
the need to yell "off-topic" but please refrain because the parts of the
problem I'm asking about are generic enough to be relevant.
I use c++ for embedded applications because my tasks are very complex but
I still need to be able to directly deal with hardware. I've been working
for the past couple of years with a really screwey robotics protocol
called JAUS and I've been violating the standard and doing things my own
way but I now need to investigate a higher level of compatibility with
other systems that more closely adhere to the architecture.
The standard calls for a series of software components that do different
robotics functions and also has very strict message routing rules. It is
these strict message routing rules that make it difficult and inefficient
to implement conforming systems in my POSIX runtime environment. Each
component is a separate process with separate address space. This means
that to follow the architecture I must use IPC to route messages to
applicable components. However, POSIX IPC introduces unacceptable latency
into the system. Depending upon system load I can see measurable 10 to
100ms round trip delay of routed messages when using named pipe IPC. That
isn't adequate when the data payloads are real-time audio/video or command
and control data.
To solve this problem I want to implement a shared memory priority queue
that is accessible by all component processes. The clencher is that I'd
like to be able to insert std::string objects into the queue. This is not
a simple case of multithreaded application since each component runs in
its own address space. What I'm asking is whether there is a relatively
safe way to make the std::string accessible by two or more separate
processes. If I knew that all internal string memory was handled thru new/
delete I presume that I could implement a custom handler to use my shared
memory pool...but if within the string class there are any pointers that
are initialized to process specific address space then the thing will most
certainly blow up.
Someone will undoubtedly bring up the syncronization issue. That is taken
care of by using a platform specific atomic operation on the shared
memory, thus guaranteeing mutually exclusive access as long as the lock is
properly acquired and released.
Thoughts? Has anyone done work that can shed some light on using custom
memory handlers or shared memory with the STL classes?
Some of this will sound a bit platform specific and a few of you will feel
the need to yell "off-topic" but please refrain because the parts of the
problem I'm asking about are generic enough to be relevant.
I use c++ for embedded applications because my tasks are very complex but
I still need to be able to directly deal with hardware. I've been working
for the past couple of years with a really screwey robotics protocol
called JAUS and I've been violating the standard and doing things my own
way but I now need to investigate a higher level of compatibility with
other systems that more closely adhere to the architecture.
The standard calls for a series of software components that do different
robotics functions and also has very strict message routing rules. It is
these strict message routing rules that make it difficult and inefficient
to implement conforming systems in my POSIX runtime environment. Each
component is a separate process with separate address space. This means
that to follow the architecture I must use IPC to route messages to
applicable components. However, POSIX IPC introduces unacceptable latency
into the system. Depending upon system load I can see measurable 10 to
100ms round trip delay of routed messages when using named pipe IPC. That
isn't adequate when the data payloads are real-time audio/video or command
and control data.
To solve this problem I want to implement a shared memory priority queue
that is accessible by all component processes. The clencher is that I'd
like to be able to insert std::string objects into the queue. This is not
a simple case of multithreaded application since each component runs in
its own address space. What I'm asking is whether there is a relatively
safe way to make the std::string accessible by two or more separate
processes. If I knew that all internal string memory was handled thru new/
delete I presume that I could implement a custom handler to use my shared
memory pool...but if within the string class there are any pointers that
are initialized to process specific address space then the thing will most
certainly blow up.
Someone will undoubtedly bring up the syncronization issue. That is taken
care of by using a platform specific atomic operation on the shared
memory, thus guaranteeing mutually exclusive access as long as the lock is
properly acquired and released.
Thoughts? Has anyone done work that can shed some light on using custom
memory handlers or shared memory with the STL classes?