Inter-Thread Communication (ITC)
==============================================================================
XMK does *not* provide any ITC primitives/APIs such as mailboxes, message 
queues, events flags, etc.  The main reasons for this are: 
    1. There is no one-size-fits-all ITC mechanism.
    2. Generic ITC mechanisms have sizeable 'footprints' with respect to the 
       resources of an 8Bit MCU.  
    3. XMK currently provides sufficient kernel primitives to build robust ITC 
       mechanisms. 
    4. It is the belief of XMK's authors that the ITC interface is not a core 
       kernel interface and belongs in an upper OS/kernel independent layer.
           
See 'General ITC Discussion' below for a more detailed looked at the issues 
invovled when creating an ITC mechanism.  All that said, there is a companion 
project 'yet (A)nother (P)latform Independent (L)ibray' that does provide 
various ITC interfaces and/or primitives as well as other kernel independent 
infra-structure.

                
General ITC Discussion
------------------------------------------------------------------------------

Terms
-----
Client      - The orginator (i.e. source) of an ITC transaction.
Server      - The recipient (i.e. destination) of an ITC transaction.
Transaction - An ITC transaction starts with a client issued request to
              a server and ends when the server has received the request.


Memory Management
-----------------
All ITC requires some sort of message, request, or communication identifier.
In addition most ITC forms support a 'payload' of some kind that is delivered
to the server.  Memory is required for the message/request and for the
payload. Since there is finite amount of memory, there is a finite number of
outstanding/in-process ITC transactions.

Issues:
    o Who allocates the message/paylod memory?  The client? The ITC engine
      upon request?  If the allocation is done by the ITC engine, what are
      the limits of its memory allocation?
      - Ideal Answer: It all depends on the requirements of the application.
        The goal is to ensure that memory is available when client intiates 
        the transaction.  The simplest way to does is have the client 
        responsible for the memory, but this is not always possible.

    o How is memory allocated? Statically? Dynamically? Combination of both?
      - Ideal Answer: It all depends (see above).  The goal is to always have
        sufficient memory.  There are several solutions, ranging from the anal
        retentive pure static allocation approach to the dynamic-ostrich 
        approach (i.e. the app will never consume/fragment all of the heap 
        before it ends, or it does matter if it crashes).

    o When does the client and when does the server have access 'rights' to 
      the message/payload memory? What safeguards (if any) exist to ensure
      that the data integrity of the message/payload is not violated by
      'un-authorized' access by the client and/or server?
      - Ideal Answer: Conceptual this is very simple - the client has access
        when building the message and the server has access upon receiving
        the message.  In pratice this policy is only enforced by convention
        and hopefully by a clear/intuitive API.

    o When is it 'safe' to free/release the message/payload memory? Who is 
      responsible for freeing?  What safeguards exist to prevent memory leaks? 
      - Ideal Answer: The memory is freed/released ONLY after the transaction
        has completed and it is freed/released by the SAME entity that 
        allocated it.  Any thing else and you are going to have memory leaks!


Synchronization
---------------
Communication between clients and servers can be do synchronously or
asynchronously.  In synchronous communications, the client waits until the 
server has acknowledged the communciation request.  In asynchronous
communications, the clients does not wait for the server to receive and/or
process the communications request.  If the client requires an acknowledgement 
to its request, then a second ITC transaction is required where the original 
server becomes a client and sends a 'response' communication to the client 
(who is now the server for the response transaction).

Issues:
    o Is it safe/legal (i.e. won't deadlock the system) for a synchronous 
      transaction to occur where the client and server are in the same
      thread (i.e does the synchronous mechanism degenerate to function
      call sematics when the client and server are in the same thread)?
      - Ideal Answer: Yes.

    o Can a client initiate a asynchronous transaction to itself? To a server
      in the same thread?    
      - Ideal Answer: Yes and Yes.

    o Does the server handle synchronous and asynchronous communications
      requests differently? 
      - Ideal Answer: No.

    
Message Semantics
-----------------
How communications between clients and servers are 'delivered' has significant
impact on the desing the ITC engine.  There are there basic deliver semantics:
    o Request/Response.  This requires that for every client communication
      request, the server provides a response and/or acknowledgement.  This
      means that a complete request/response sequence invovles two ITC 
      transactions, one for the request and one for the response.

    o Datagram.  The client initiates ITC transactions and receives zero
      feedback about the receipt by or processing status of the server(s)

    o Broadcast.  This is derivative of the Datagram semantics where a single
      client communications request is sent/delivered to multiple destinations
      and/or servers. 

Issues:
    o What message semantics are required by the application?  

    o What is the 'cost' of the desired message semantics with respect to 
      memory management and synchronization?  If the costs are too high, are
      there any work-arounds?
 
    - Ideal Answers: It all depends on the application!
