Chapter6 RTOS Communication

Chapter6 RTOS Communication - Interprocess communication...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Interprocess communication Chapter 6.4 Interprocess communication Interprocess communication ( IPC ): OS provides mechanisms so that processes can pass data. Two types of semantics: blocking : sending process waits for response; non-blocking : sending process continues. Interprocess communication mechanisms Semaphores Binary counting Signals Mail boxes Queues Pipes IPC styles Shared memory: processes have some memory in common; must cooperate to avoid destroying/missing messages. Message passing: processes send messages along a communication channel---no common address space. comm. channel may be physical or virtual Shared memory Shared memory on a bus: CPU 1 CPU 2 memory Race condition in shared memory Problem when two CPUs try to write the same location: CPU 1 reads flag and sees 0. CPU 2 reads flag and sees 0. CPU 1 sets flag to one and writes location. CPU 2 sets flag to one and overwrites location. Atomic test-and-set Problem can be solved with an atomic test-and-set: single bus operation reads memory location, tests it, writes it. ARM test-and-set provided by SWP (swap): ADR r0,SEMAPHORE LDR r1,#1 GETFLAG SWP r1,r1,[r0] BNZ GETFLAG Critical regions Critical region : section of code that cannot be interrupted by another process. Examples: writing shared memory; accessing I/O device. while (1){ } /* end while (1) */ While (!Test-And-Set(&Lock)); Lock = 0; Critical Region Remainder Mutual Exclusion Example System variables: Lock = 0; while (1){ } /* end while (1) */ Remainder Lock = 0; Critical Region While (!Test-And-Set(&Lock)); Process 1 Process 2 Task and Device Queues Processes queued for shared device access Semaphores Semaphore : OS primitive for controlling access to critical regions. Protocol: 1. Get access to semaphore with P(). (Dutch Proberen to test) 2. Perform critical region operations....
View Full Document

This note was uploaded on 09/23/2011 for the course ELEC 6260 taught by Professor Nelson,v during the Summer '08 term at Auburn University.

Page1 / 36

Chapter6 RTOS Communication - Interprocess communication...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online