没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Managing Concurrency in Complex Embedded Systems
©2014 David M. Cummings, Kelly Technology Group
1
Managing Concurrency in Complex Embedded Systems
David M. Cummings
Kelly Technology Group
Background
This paper is based on portions of an invited presentation delivered at a 2010 workshop on
Cyber-Physical Systems. The slides for that presentation can be found at:
http://www.kellytechnologygroup.com/main/fujitsu-cps-workshop-10jun2010-invited-presentation.pdf.
Introduction
Experienced developers of complex embedded systems know that concurrent programming is
hard. Building a system consisting of many processes and/or threads, and ensuring that the
system meets its performance objectives and behaves reliably and predictably, sometimes in the
face of unpredictable errors, is no small accomplishment. In this paper, I will present some
guiding principles that can be very effective in building complex embedded systems that are
highly reliable, robust and predictable. Over the course of more than three decades, my
colleagues and I have used these principles with success on a wide variety of projects, including:
A network of 27 Doppler radar processors for the FAA
A digital receiver for NASA’s Deep Space Network
The flight computer for NASA’s Mars Pathfinder Spacecraft
A TDMA satellite modem card for Windows PCs for broadband IP access over the air
A terrestrial wireless appliance for broadband IP access over the air
A clustered backup and disaster recovery appliance
Of course, a single paper cannot capture all of the factors that go into building a successful,
complex embedded system. Here I will focus on the following key points:
The threading model
The structure within each thread
First, examples of threading models and structures that can cause problems will be presented. I
will then present a solution that avoids these problems.
并发管理
我将介绍一些指导原则,这些指导原则,有效的构建高度可靠、健壮和可预测的复杂嵌入式系统
首先,将介绍可能导致问题的线程模型和结构的示例。然后我将提出一个避免这些问题的解决方案
有经验的复杂嵌入式系统开发人员知道并发编程是困难的
允许多个任务在同一时
间段内同时执行,以提
高程序的执行效率和响
应速度
在过去的三十年里,我和我的同事们在各种各样的项目中成功地运用了这些原则,下面项目
当然,一篇论文无法涵盖构建一个成功的、复杂的嵌入式系统所需的所有因素
线程模型
每个线程中的结构
我将重点阐述以下几点
Managing Concurrency in Complex Embedded Systems
©2014 David M. Cummings, Kelly Technology Group
2
Attributes of Embedded Systems
The typical embedded system considered in this paper includes the following attributes:
Real-time deadlines
Extensive interaction with hardware
Largely or completely autonomous
Often thought of as hardware devices that “just work”
Extensible
Maintainable
These systems may be either uniprocessor systems or multiprocessor/multicore systems. The
hardware with which the systems interact sometimes consists of ASICs and/or FPGAs that are
co-designed with the software. In addition to extensive interaction with hardware, the systems
often include network communication with other devices as well. And, as any experienced
developer knows, maintainability and extensibility are critical, because there will be bug fixes
and feature enhancements over the lifetime of the system.
Also, I assume that the system is running at least a minimal real-time kernel with support for:
Threads
Preemptive, priority-based scheduling
Message passing
Synchronization primitives (e.g., locks/semaphores)
My colleagues and I have put these ideas into practice in both commercial products and
government deployments using a number of operating systems, including VxWorks, Linux, and
OpenVMS. Most of the systems we have built were written in C or C++. One was written in
Ada.
The Threading Model
The following diagram represents a simplified view of a typical threading model for such
systems:
与硬件的广泛交互
大部分或完全自主
基于优先级的抢占调度
实时期限
可扩展的
可维护的
消息传递
同步原语
Managing Concurrency in Complex Embedded Systems
©2014 David M. Cummings, Kelly Technology Group
3
The application code is executed within threads, processes, or a combination of the two. For
simplicity, in this paper I will assume there are multiple threads sharing a single address space,
although the same general considerations apply to multiple processes, each consisting of one or
more threads.
The threads communicate with one another by depositing messages into message queues.
Usually, this is performed by services in the two underlying layers of the diagram. Sometimes a
thread will call a service to explicitly deposit a message into another thread’s queue.
Alternatively, a thread may call a service to perform some function, which will result, under the
covers, in that service depositing a message into another thread’s queue.
For large amounts of data that have to be shared between threads, shared memory is often used,
in order to limit the sizes of the messages sent via message queues. Often, the data is written into
shared memory by the initiating thread, and then a message is sent to the target thread’s message
queue that informs the target thread, either explicitly or implicitly, that data is available in shared
memory. (Alternatively, for timer-based cyclic activities, the initiating thread writes the data into
shared memory during one time period, and the target thread reads the data out of shared
memory during a second time period.) The underlying services used to manage the data in the
shared memory, i.e., the services used by the initiating thread to deposit the data into shared
memory, and the services used by the target thread to read the data from shared memory,
typically perform any necessary synchronization via locks/semaphores to ensure thread-safe
access.
线程通过将消息存入消息队列来相互通信
对于必须在线程之间共享的大量数据,通常使用共享内存
通常,数据由初始化线程写入共享内存,然后将消息发送到目标线程的消息队列,以显示或隐式的方式通知目标线程,共享内存中有数据可用
用于管理共享内存中的数据的底层服务,即初始化线程用于将数据存入共享内存的服务,以及目标线程用于从共享内存中读取数据的服务,通常
通过锁、信号量执行必要的同步,以确保线程安全访问;
剩余14页未读,继续阅读
资源评论
qq_30846925
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功