This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Message boxes - good/bad practices
- From: Pete Barrie <peter at cis dot strath dot ac dot uk>
- To: ecos-discuss at sources dot redhat dot com
- Date: Thu, 18 Jul 2002 12:02:12 +0100
- Subject: [ECOS] Message boxes - good/bad practices
Message boxes in eCos allow the transmission
of simple (byte up to 32 bits) messages via the
buffered message queue.
Some other OS's deliver more sophisticated (with more overheads)
buffered message schemes where the messages can be any
(parameterised) size.
Obviously a pointer can be sent from one thread to another, for the receiver
to access larger data structures This is clearly not a robust route to data
sharing.
On on asynchronous basis the buffer space may be clobbered before
the receiver accesses it.
However, the following scenario is probably more robust. What do people
think about the robustness of this one? It implements trivial
synchronous message passing:
Thread_Tx
----------------
malloc space for bufMessage
fill buffer <size_tag><bytes..........>
send message to thread_Rx with buffer ptr
----
----
wait for reply_message from thread_Rx
fill buffer <size_tag><bytes..........>
send message to thread_Rx with buffer ptr
etc
Thread_Rx
----------------
wait for message
access buf via pointer and size_tag
send reply_message
Pete
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss