message passing
Download
Skip this Video
Download Presentation
Message Passing

Loading in 2 Seconds...

play fullscreen
1 / 8

Message Passing - PowerPoint PPT Presentation


  • 117 Views
  • Uploaded on

Message Passing. Akos Ledeczi EECE 354, Fall 2012 Vanderbilt University. Message Queues. Inter-task communication Usually better practice than using global variables Message queues are used to manage messages Standalone queues Each task has a built-in queue

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Message Passing' - shelley


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
message passing

Message Passing

Akos Ledeczi

EECE 354, Fall 2012

Vanderbilt University

message queues
Message Queues
  • Inter-task communication
  • Usually better practice than using global variables
  • Message queues are used to manage messages
    • Standalone queues
    • Each task has a built-in queue
  • Messages are passed by reference, that is, no copy is ever made!!! Must remain in scope!!!
  • Default is FIFO, but optionally LIFO can be used for important messaged to bypass waiting messages in the queue
  • Multiple tasks can Pend() on a queue. Post() can optionally broadcast to all waiting tasks
bilateral rendezvous
Bilateral Rendezvous
  • Using tasks queues in this case
  • Just like semaphores, but can pass data as well
flow control
Flow Control
  • Message producer may produce faster than consumer can consume
  • To prevent overflowing the message queue, a semaphore helps manage the resource
  • Using a task semaphore and a task queue in this case
clients and servers
Clients and servers
  • Different tasks/ISRs (clients) report different error conditions
  • Single error handler (“server”) processes the reports
example
Example
  • Measure RPM using a hole in the disk
  • A free running counter is used to measure the time between two hole detections
  • ISR shouldn’t be used to compute average, maximum, etc.
  • Task may be low priority in the system, so a message queue is used to store measurements until they can be processed
usage
Usage

OS_Q MyQ;

MyMsgDataMyMsg;

OSQCreate(&MyQ,

“My Queue”,

10, /* max queue size */

&err);

OSQPost(&MyQ,

(void *)&MyMsg, /* actual data to send */

/* DANGER: using a global */

sizeof(MyMsg),

OS_OPT_POST_FIFO,

&err);

OSQPend(&MyQ,

1000, /* timeout */

OS_OPT_PEND_BLOCKING,

&size,

&ts,

&err);

if (err == OS_ERR_TIMEOUT) {

API:

OSQCreate()

OSQPend()

OSQPost()

OSQFlush()

OSQPendAbort()

OSQDel()

ad