Difference between revisions of "Mailbox"

From Embedded Xinu
Jump to navigation Jump to search
(Explanation of mailboxes)
 
 
Line 1: Line 1:
A mailbox is a messaging queue used for interprocess communication.  Mailboxes should not to be confused with the single message capability built into the process control block which uses <code>send</code> and <code>receive</code>.   
+
A mailbox is a messaging queue used for interprocess communication.  Mailboxes should not to be confused with the single [[message passing]] capability built into the thread control block which uses <code>send</code> and <code>receive</code>.   
  
 
XINU allows for a finite number of mailboxes to be created.  Each mailbox is identified by a number.  Any number of processes can send and receive messages from the mailbox, provided the processes know the correct mailbox number.   
 
XINU allows for a finite number of mailboxes to be created.  Each mailbox is identified by a number.  Any number of processes can send and receive messages from the mailbox, provided the processes know the correct mailbox number.   
  
When a new mailbox is created (allocated) a maximum number of messages allowed in the queue must be specified.  Memory for the messages is allocated when the mailbox is created.  Once the mailbox message queue is full, processes that attempt to send a message must wait for space in the queue.  If the queue is empty, processes that attempt to receive a message must wait for a message to be enqueued.  A message is 4 bytes long.
+
When a new mailbox is created (allocated) a maximum number of messages allowed in the queue must be specified.  Memory for the messages is allocated when the mailbox is created.  Once the mailbox message queue is full, processes that attempt to send a message must wait for space in the queue.  If the queue is empty, processes that attempt to receive a message must wait for a message to be enqueued.  A message is 4 bytes long (<code>int</code> type).
  
 
When a mailbox is deleted all remaining messages in the queue are destroyed.  Processes waiting to send or receive are released from the wait state.
 
When a mailbox is deleted all remaining messages in the queue are destroyed.  Processes waiting to send or receive are released from the wait state.

Latest revision as of 22:25, 9 June 2008

A mailbox is a messaging queue used for interprocess communication. Mailboxes should not to be confused with the single message passing capability built into the thread control block which uses send and receive.

XINU allows for a finite number of mailboxes to be created. Each mailbox is identified by a number. Any number of processes can send and receive messages from the mailbox, provided the processes know the correct mailbox number.

When a new mailbox is created (allocated) a maximum number of messages allowed in the queue must be specified. Memory for the messages is allocated when the mailbox is created. Once the mailbox message queue is full, processes that attempt to send a message must wait for space in the queue. If the queue is empty, processes that attempt to receive a message must wait for a message to be enqueued. A message is 4 bytes long (int type).

When a mailbox is deleted all remaining messages in the queue are destroyed. Processes waiting to send or receive are released from the wait state.