1 / 33

Polling vs. Interrupts

Polling vs. Interrupts. SE-3910 Real-time Systems. Week 4, Class 3 Quick-Quiz (Ungraded) Lab 3 due today!, Week 4 (turn-in TBA!) Lab 4 turn-in up - due Tuesday, Week 5 Select when to use Polling or Interrupts Describe the interrupt handling process

rbradsher
Download Presentation

Polling vs. Interrupts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Polling vs. Interrupts SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  2. SE-3910Real-time Systems • Week 4, Class 3 • Quick-Quiz (Ungraded) • Lab 3 due today!, Week 4 (turn-in TBA!) • 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.

  3. Quick Quiz! What is the CPU utilization of this process? • Inputs: • Check every 5 seconds if we are there. • Run time if not there: 0.25 seconds • Run time if there: 5 seconds • Parent CPU Utilization: • Time remaining for Driving: SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  4. Quick Quiz! What is the resistanceof this resistor? SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  5. Quick Quiz! Which of the following is correct? void foo(struct bar*); … struct bar b; And then…. • foo(&b) • foo(*b) • foo(b&) • foo(b*) SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  6. Quick Quiz! Which of the following is correct? void foo(struct bar2); … struct bar *b; And then…. • foo((struct bar*) b*) • foo((bar*) *b) • foo((bar*) b&) • foo((struct bar*) &b) SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  7. C, Java, C#, … unary operators • Increment: ++x, x++ • Decrement: −−x, x−− • Address: &x • Indirection: *x • Positive: +x • Negative: −x • One's complement: ~x • Logical negation: !x • Sizeof: sizeof x, sizeof(type-name) • Cast: (type-name) cast-expression Wiki: Unary_operation

  8. What did you learn from the SE Night Talks? What parts of the computer can run too slow so we miss a deadline? • Switch bouncing • Polling • Memory fetching (cache) • I/O (Network, File) • Garbage collectors • Passing stucts by value • CPU • Too many flops • Sorting • Threading overhead • Interrupt overhead SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  9. Interrupt Definitions • Interrupt • An event in hardware that triggers the processor to jump from its current program counter to a specific point in the code. • Interrupt Service Routine (ISR) • The function that is called or the particular assembly code that is executed when the interrupt happens is called the Interrupt Service Routine (ISR). • Interrupt flag (IFG) • this is the bit that is set that triggers the interrupt, leaving the interrupt resets this flag to the normal state. • Interrupt Enable • Control bit that tells the processor that a particular interrupt should or should not be ignored. • Interrupt Vector Table • A table in memory which maps ISRs to interrupts. SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  10. ISR Handling (1) SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  11. ISR Handling (2) SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  12. ISR Handling (3) SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  13. What is the Status Register? • (TODO: ALU pic here) SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  14. Switch de-bouncing • How can we avoid multiple presses? SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  15. Polling SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  16. When to Poll vs. Interrupt? • Polling • Advantages • Lower latency (if 100% CPU) • Disadvantages • High CPU • Low Punctuality • Interrupts • Disadvantages • Context switch cost • Advantages • Low CPU • Higher Punctuality SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

  17. 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. Watchdog Timers

  18. 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. 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. 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

  21. 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

  22. 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

  23. 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

  24. 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

  25. 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

  26. 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

  27. 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

  28. 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

  29. 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

  30. 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

  31. 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

  32. Watchdog Timer Structure SE3910 Real Time Systems

  33. Conditional Compilation • #define DEBUG • #ifdef DEBUG • #endif • #define LEVEL 5] • #if LEVEL > 0 • #endif SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling

More Related