MDK-ARM Keil, MDK-ARM Datasheet - Page 36

KIT REALVIEW MCU DEVELOPMENT

MDK-ARM

Manufacturer Part Number
MDK-ARM
Description
KIT REALVIEW MCU DEVELOPMENT
Manufacturer
Keil
Type
Compiler and IDEr
Datasheets

Specifications of MDK-ARM

For Use With/related Products
ARM MCUs
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
36
Barrier Turnstile
Although a rendezvous is very
useful for synchronizing the
execution of code, it only works
for two functions. A barrier is a
more generalized form of
rendezvous, which works to
synchronize multiple tasks. A
barrier is shared between a
defined number of tasks. As
each task reaches the barrier it
will halt and de schedule. When
all of the tasks have arrive at the
barrier it will open and all of the tasks will resume execution simultaneously.
The barrier uses semaphores to build a code object called a turnstile. The
turnstile is like a gate. Initially the turnstile gate is locked. When all of the tasks
have arrived at the turnstile, it will open allowing all of the tasks to continue
‘simultaneously’. Once the critical code has been executed each task will pass
through a second exit turnstile. The exit turnstile is used to lock the first entry
turnstile and reset the barrier object so the barrier can be reused.
The barrier object is a sophisticated use of semaphores so it its worth spending
some time studying it. The barrier object uses three semaphores, the entry
turnstile, Entry_Turnstile, the exit turnstile, Exit_Turnstile, and a Mutex, which
ensures that only one task at a time executes the critical code section. The
general structure of the barrier is:
while(1)
}
Entry Turnstile code
Synchronised code section
Exit Turnstile code
{
Chapter 2. Developing With an RTOS

Related parts for MDK-ARM