SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a...

18
SE-3910 Real-time Systems • Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up • Watchdog demo SE-3910 - Dr. Josiah Yoder Slide style: Dr. Hornick Much Material: Dr. Schilling, Some from Dr. Hornick, etc. 1

Transcript of SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a...

Page 1: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

SE-3910Real-time Systems

• Week 5, Class 2– Lab turn-in page is up!– Use interrupts in a Linux/C environment– Scheduling

– Watchdog follow-up• Watchdog demo

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 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Quick Quiz! (1)

What is an advantage of a Watchdog Timer?

What is a disadvantage?

How can we avoid the disadvantages?

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

Much Material: Dr. Schilling2

Page 3: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Quick Quiz! (2)

Name two non-essential OS components and describe why each is non-essential.

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

Much Material: Dr. Schilling3

Page 4: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Quick Quiz (3)

What does this shell script print?-------- script ------echo “var1: $1” echo ‘var2: $2’ echo “Number of Arguments: $#”-----------------------when run as./script “John Doe” “Pete Stephens” “Nancy Drew”

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

Much Material: Dr. Schilling4

Page 5: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Task State Diagram

Laplante and Ovaske 4E p. 97 5

Page 6: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Scheduling Approaches• Pre-runtime

– Create a feasible schedule offline prior to execution– Requires prediction of the worst case performance for the

system– Takes into account context switch overhead– Tries to avoid resource conflicts

• Runtime scheduling– Priorities (fixed or dynamic) are assigned and resources are

allocated– Allows for tasks to be interrupted– Allows for resources to be demanded periodically, aperiodically,

or sporadicallySE-3910 - Dr. Josiah Yoder

Slide style: Dr. HornickMuch Material: Dr. Schilling

6

Page 7: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Scheduling Definitions

Laplante and Ovaske 4E p. 98 7

Page 8: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

(cont.)

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

Much Material: Dr. Schilling8

Page 9: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Simplifying Assumptions• All tasks in the task set considered are strictly

periodic.• The relative deadline of a task is equal to its period.• All tasks are independent; there are no precedence

constraints.• No task has any nonpreemptible section, and the

cost of preemption is negligible.• Only processing requirements are significant;

memory and I/O requirements are negligible.

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

Much Material: Dr. Schilling9

Page 10: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Round-Robin Scheduling

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

Much Material: Dr. Schilling10

Page 11: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Round-Robin Scheduling with pre-emption

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

Much Material: Dr. Schilling11

Page 12: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Cyclic Code Scheduling• Scheduling decisions are made periodically

rather than arbitrarily– Major cycle (hyperperiod)

• The minimum time required to execute tasks allocated to the CPU

• Equal to the least common multiple of the task periods

– Frames• The locations where scheduling decisions are made• No premption within frames

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

Much Material: Dr. Schilling12

Page 13: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Optimal Cyclic Code Scheduling – Rate Monotonic Scheduling

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

Much Material: Dr. Schilling13

Page 14: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

In-Class Exercise

• Calculation: What is the processor utilization for this problem?

• Based on RMA, what order will they execute and how will they execute?

• Hints: Draw release times, break up processing into multiple frames if needed.

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

Much Material: Dr. Schilling14

Page 15: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Rate-Monotonic Example

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

Much Material: Dr. Schilling15

Page 16: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

RMA Guarantee – Upper Bound for lower bound for range that will work

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

Much Material: Dr. Schilling16

Page 17: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Demo – Connecting to Beaglebone• [TODO] – Perhaps another time!

– I may eventually put instructions for setting up a DHCP server on your laptop using “connection sharing” on website under “Objectives”

– Ask me if you don’t find it when you need it– You know my number.

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

Much Material: Dr. Schilling17

Page 18: SE-3910 Real-time Systems Week 5, Class 2 – Lab turn-in page is up! – Use interrupts in a Linux/C environment – Scheduling – Watchdog follow-up Watchdog.

Demo – Watchdog

One promptfor i in `seq 0 1000`; do echo $(($i*10)); sleep 10; done;

Anothercat > /dev/watchdog

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

Much Material: Dr. Schilling18