Real-Time Systems Development

Chapter 8: Task Communication and Synchronization

8.1 Chapter overview

Multi-tasking software relies on system functions to provide intertask communications and synchronization facilities. Semaphores, lock files, signals, pipes and sockets are all described with code examples. Commercial RTEs and most operating systems offer these functions.

8.2 Data sharing

Multi-tasking implementations can suffer from difficulties when using shared resources. In particular, reader tasks have to be sure that the data is stable and valid, and writer tasks must guard against simultaneous operations which would leave data structures in an inconsistent condition. When several concurrent tasks are able to access a shared data area, and pre-emptive rescheduling can take place, it is essential to look out for the possibility of task rescheduling right in the middle of an update. In such circumstances, the data will be abandonded for a period in an inconsistent condition until the writer task is restored. Several well-established techniques are available to programmers to deal with this problem and these are listed below and will be further described in the next sections.

Techniques for critical data protection
  • Serialize the critical accesses with cooperative scheduling

  • Disable interrupts to inhibit the scheduler during access to shared data

  • Bit flags, set and tested by application tasks, tasks spin poll

  • Semaphores, flags and task wait queues supplied by the kernel

  • Monitors, exclusive access procedures associated with data

  • Control queues, MASCOT solution

  • Synchronous rendezvous, ADA solution

  • Synchronized methods (Java)

Previously in Section 3.15 the need to protect shared resources from possible corruption, arising from simultaneous access, has been highlighted. The...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Embedded Systems Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.