se-3910 real-time systems week 5, class 1 – quick-quiz (ungraded) – lab 4 turn-in up - due...

23
SE-3910 Real-time Systems • Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts – Describe the interrupt handling process – Use conditional compilation to remove code from compiling SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling, Some from Dr. Hornick, etc. 1

Upload: alexandrina-daniel

Post on 04-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

SE-3910Real-time Systems

• Week 5, Class 1– Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5– Select when to use Polling or Interrupts– Describe the interrupt handling process – Use conditional compilation to remove code from

compiling

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling, Some from Dr. Hornick, etc.1

Page 2: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Quick Quiz! What is the rise-time of this signal?

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling2

0

5V

16ms10ms 13ms

Page 3: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Quick Quiz! Which of the following is correct?

void foo(struct bar2* b);…struct bar* b;And then….•foo((struct bar2*) b*)•foo((bar2*) *b)•foo((bar2*) b&)•foo((struct bar2*) &b)

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling3

Page 4: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

When to Poll vs. Interrupt?• Polling

– Advantages• Lower latency (if

100% CPU)

– Disadvantages• High CPU• Low Punctuality

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling4

• Interrupts– Disadvantages

• Context switch cost

– Advantages• Low CPU• Higher Punctuality

Page 5: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Potential Problems• What happens if an unexpected interrupt

occurs and we have random garbage in the interrupt table?

• What happens if an interrupt handler doesn’t return?

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling5

Page 6: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

The Clementine• In 1994, a deep space probe, the Clementine, was

launched to make observations of the moon and a large asteroid (1620 Geographos).

• After months of operation, a software exception caused a control thruster to fire for 11 minutes, which depleted most of the remaining fuel and caused the probe to rotate at 80 RPM.

• Control was eventually regained, but it was too late to successfully complete the mission.

6Watchdog Timers

Page 7: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 7

Page 8: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 8

Page 9: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 9

Page 10: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 10

Page 11: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 11

Page 12: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 12

Page 13: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 13

Page 14: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 14

Page 15: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 15

Page 16: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 16

Page 17: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 17

Page 18: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 18

Page 19: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 19

Page 20: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 20

Page 21: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Watchdog Timer Structure

SE3910 Real Time Systems

Page 22: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Watchdog On the Beaglebone• http://beaglebone.cameon.net/home/watchd

og-timer• Open the file /dev/watchdog• Do not close the file• Write something (e.g. "\n") to the file at least

every 59 seconds to keep the system running

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling22

Page 23: SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5 – Select when to use Polling or Interrupts –

Conditional Compilation• #define DEBUG• #ifdef DEBUG• #endif

• #define LEVEL 5• #if LEVEL > 0• #endif

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling23