0
3.3kviews
Explain about inter task or inter process communication?

Subject : Microcontroller and Embedded Programming

Topic : Embedded/Real Time Operating System

Difficulty : Medium

1 Answer
0
43views

Inter task or inter process communication :

There are many cases when there is need of communication between different tasks or processes. There are various methods to implement the same like

1. Mailboxes:

● Mailbox is similar to postal mailbox. The mails of a particular task can be checked only by that task.

● Each task has its own mailbox. Other tasks, processes or an ISR can post messages for the task in its corresponding mailbox

● Fig 11.6.a shows the mailbox implementation

● The various functions required to implement the mailbox are listed below:

  • Create a mailbox
  • Delete a mailbox
  • Post a message in mailbox
  • Read a message from the mailbox
  • Query a mailbox

enter image description here

2. Message queues :

● Message queue is as good as an array of mailbox i.e. the mailbox can store only one message at a given time, while the message queue can store many message simultaneously.

● The application of a message queue can be like the taking of input from keyboard and displaying the output or taking input from sensors and transmitting the data over a network etc. Thus it is said that the message queue are mainly used for producer consumer applications i.e a task produces data and another consumes it.

● Fig 11.6.b shows the implementation of a message queue

enter image description here

● The various functions required to implement the message queue are listed below:

  • Create a message queue
  • Delete a message queue
  • Post a message in message queue
  • Post a message in the beginning of the queue
  • Broadcast a message
  • Read a message from message queue
  • Query a queue to give its info
  • Show queue waiting information
  • Flush the queue

3. Event registers:

● Event register can be used to keep track of the events that have been occurred. Each bit in the task register can be kept for particular event. Hence the task can keep a track of which events have occurred and accordingly the different operations to be performed. ● The different functions required to implement event registers are as given below:

  • Create an event register
  • Delete an event register
  • Set an event register
  • Clear an event register
  • Query an event register

4. Pipes:

● Pipes are also much like queues. Pipes are used to send messages from one task to another. The operation is demonstrated in fig 11.6.c

● Thus pipes are used for inter task communication i.e. from one task to another or from an ISR to a task

● A task can write into the pipe of another task and if required for other way communication there will be another pipe required. The other direction pipe may also be used to send acknowledgements to another task. This is shown in fig(f).

● The various functions required to implement the pipe are listed below:

  • Create a pipe
  • Delete a pipe
  • Write in the pipe
  • Read from the pipe
  • Close the pipe

5. Signals :

● Signals are simple indications from one task to another task to indicate the occurrence of an event. These indications may be used to trigger some task, or indicate the availability of a resource etc.

● The various functions required to implement the signals are listed below:

  • Create or install a signal handler
  • Delete or remove the signal handler
  • Send a signal from one task to another task
  • Ignore the received signal
  • Block the signal to be delivered
  • Unblock an already blocked signal

enter image description here

Please log in to add an answer.