Presentation is loading. Please wait.

Presentation is loading. Please wait.

EMBEDDED SYSTEMS 9 April 2013 William W. McMillan.

Similar presentations


Presentation on theme: "EMBEDDED SYSTEMS 9 April 2013 William W. McMillan."— Presentation transcript:

1 EMBEDDED SYSTEMS 9 April 2013 William W. McMillan

2 What embedded systems existed in 1980? How many do you have on your person right now?

3 Kinds of Real-Time Operations  Monitor and record.  Actuate (move, release).  Alarm, shut down, or take other emergency action.  Control access.  Deliver content.  Communicate.  Translate, decode, or interpret.

4 Challenges of Real-Time  Small memory.  Slow processor.  Low power.  Need to be fast.  Deadlines need to be met.  Concurrent processes.  Need for reliability.

5 When have you programmed a real- time or embedded system? What challenges did you face?

6 Management Challenges  Programming language trade-offs.  Choosing hardware platform.  Choosing software platform.  Getting staff who know physics and electronics.  Deciding deployment.  Maintenance.

7 Decision Tables  “Stimulus-response” table.  E.g., if power low and buffer nearly full, write data in alternate storage.  Arrange by columns:  Condition, action.  Likely preliminary to state diagrams and are less formal.

8 State Diagrams  A principal tool for real-time systems.  Used in design, of course.  Critical for communicating how system works.  Need to keep up-to-date.  Use software tools to support.

9 Besides state diagrams, what other UML diagrams come to mind as useful for real-time and embedded systems?

10 Programming Practices  See reliability engineering.  Special premium on algorithm efficiency.  Memory is precious.  Pack data, e.g., bits for Booleans.  Use short representations when you can.  Need to control access.  Avoid dynamic memory allocation.  Protect stacks, etc. from overflow.

11 Programming Practices  Can have many “global” devices and data, e.g.,  Ports.  Status bits.  Video memory.  Buffers.  Need much more discipline in accessing these.  Code inspection and formal analysis are useful.

12 Programming Practices  Data structures  Circular queue: Producer prevented from adding to full queue. Consumer prevented from taking from empty queue.  Pipeline: Data handed from process to process.  General: hashing, logarithmic search, etc.  Timing analysis  Model processes to predict.  Based on finite state machines.

13 Think of a typical programming construct or method that would be inappropriate in many embedded systems.

14 Ways to Get Data and Status  Keep channels open  Switch-style, continuous communication.  Simplex or duplex.  Polling  Ask devices at regular intervals how things are going, if there are data, etc.  Interrupts  Device has low-level access to event loop.  Actively sends message when needs attention.

15 Scheduling (OS Issue)  Round robin  Each process gets a time unit in turn.  Priority queue  Most important goes first…  … but do the less important ever get a chance?  Multiple queues, by priority  Higher priority get less time.  As run more often, get more time, but lower priority.

16 Scheduling (OS Issue)  Shortest first  Run smaller jobs first.  Policy-driven, e.g.,  If get less than share of CPU time, raise priority.  If impending deadline, raise priority.  If related to alarm, raise priority.

17 For a mobile device application, describe a policy for scheduling concurrent processes.

18 Sticky Wickets (OS Issues)  Deadlock, e.g.,  ThreadA holds printer, waits for File1.  ThreadB holds File1, waits for printer.  Race condition, e.g.,  ThreadA: if (x == y)  ThreadB: if (x == y)  ThreadA: { x++; }  ThreadB { x++; }


Download ppt "EMBEDDED SYSTEMS 9 April 2013 William W. McMillan."

Similar presentations


Ads by Google