You are on page 1of 4

MAILBO

X
• A message – mailbox is for an IPC message that can be used only by a single
destined task.
• The mailbox message is a message-pointer or can be a message.
• The source (mail sender) is the task that sends the message pointer to
a
created (initialized) mailbox (the box initially has the NULL pointer before the
message posts into the box).
• The destination is the place where the OSMBoxPend function waits for the
mailbox message and reads it when received.
Example
• Amobile phone LCD display task is an example that uses the
message
mailboxes as an IPC. In the mailbox, when the time and date message from a
clock-process arrives, the time is displayed at side corner on top line.
• When the message from another task to display the signal strength at antenna,
• Another example of using a mailbox is the mailbox for an error-
handling task, which handles the different error logins from other tasks.
• The below figure shows three mailbox-types at the different RTOSes.

• The below figure shows the initialization and other functions for
a mailbox at an OS.
• The following may be the provisions at an OS for IPC functions when
using the mailbox.
1. A task may put into the mailbox, only a pointer to the message-block
or number of message bytes as per the OS provisioning.
2. There are three types of the mailbox provisions.
• A queue may be assumed a special case of a mailbox with provision for
multiple messages or message pointers.
• An OS can provide for queue from which a read (deletion) can be on a
FIFO basis or alternatively an OS can provide for the multiple mailbox
messages with each message having a priority parameter.
• The read (deletion) can then only be on priority basis in case mailbox
message has multiple messages with priority assigned to high priority
ones.
• Even if the messages are inserted in a different priority, the deletion is
as per the assigned priority parameter.
• An OS may provision for mailbox and queue separately.
• A mailbox will permit one message pointer per box and the queue will
permit multiple messages or message pointers.
• µCOS-II RTOS is an example of such an OS.
• The RTOS functions for mailbox for the use by the tasks can be
the following:
1. OSMBoxCreate creates a box and initializes the mailbox
contents with a NULL pointer.
2. OSMBoxPost sends (writes) a message to the box.
3. OSMBoxWait (pend) waits for a mailbox message, which is read when
received.
4. OSMBoxAccept reads the current message pointer after checking the
presence yes or no (no wait). Deletes the mailbox when read.
5.OSMBoxQuery queries the mailbox when read and not needed later.
An ISR can post (but not wait) into the mailbox of a task.

You might also like