Unformatted text preview:

EECE 276 – Embedded Systems1EECE 276Embedded SystemsTask communication:Queues, mailboxes, pipesEECE 276 – Embedded Systems2Task communicationO Tasks need to communicate:O Shared data structure: QueueO Operations: (RTOS services)» Queue Initialize(int size): create and set up for size» Void Enqueue(Queue q,void* item): block if full, else put» Void* Dequeue(Queue q): block if empty, else getO Multiple tasks use it: mutual exclusion is enforcedProducerTaskConsumerTaskEECE 276 – Embedded Systems3Task communicationO Mailboxes: » Similar to queues, (usually) has a single element and two states: empty/full» If multiple tasks are waiting for a mailbox, the highest priority one gets the messageO Pipes:» Streams of data » Typically use fwrite()/fread() operations» Arbitrary length and data formatEECE 276 – Embedded Systems4Using queuesProducerTaskConsumerTaskQueue1-to-1:ProducerTaskConsumerTaskQueue1-to-many:ConsumerTaskHighest priority task gets the dataEECE 276 – Embedded Systems5Using queues, mailboxesProducerTaskConsumerTaskQueueMany-to-1:ProducerTask(Non-deterministic) Merge of dataMBox1MBox2ConsumerTaskProducerTaskDouble buffer:EECE 276 – Embedded Systems6Problems with queues, etc.O If of finite size, task may block/receive error if full/emptyO Passing pointers as queue elements: data becomes shared (“ownership” changes)O The sender and the receive must agree on the format/meaning of the data passed » void* is not a very good ideaO Memory management: running out of memory space leads to disasters (or


View Full Document

VANDERBILT EECE 276 - Task communication

Download Task communication
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Task communication and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Task communication 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?