0% found this document useful (0 votes)
27 views

DVA455 Exercises

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

DVA455 Exercises

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Exam preparation exercises

1. RTS development

a) Explain why the following probably is not a good idea, and suggest another development
approach:
“We will use an agile development method with short sprints. Each sprint we will pick one
function, define detailed functional- and timing requirements for that function, implement it
and ensure that those requirements are met.”

b) Give two reasons why real-time embedded systems are difficult to test compared to other
types of software, and explain why.

c) Explain why the following reasoning is incorrect:


“Since this is a hard real-time system, we have to use a modern hardware platform with a
very powerful processor to make sure that all computations are completed in as short time
as possible.”
2. Real-time requirements

a) Explain why the following is probably not a good system-level timing requirement, and
suggest a reasonable reformulation:
“After detecting that a collision has occurred, the fuel valve must be closed within 100 ms.”

b) Consider the following response time requirement:


“When the brake pedal is pressed, the corresponding brake pressure must be applied to all
four wheels within 200 ms.“
Explain why we probably also need a separation constraint (what specific problem/scenario
is not captured by the response time requirement above) and suggest how a reasonable
separation constraint could be formulated.
3. RTS design

a) Explain why this reasoning is incorrect (a simple figure might help):


“The task reading the brake pedal sensor has a period of 50 ms because of the requirement
that the cruise controller must be turned off within 50 ms after the driver presses the brake.”

b) Consider the description: The motor should be adjusted based on the water level at least
every 50 ms. If the pause button is pushed, the motor must stop within 200 ms and remain off
for 10 s.

Explain why the following is not a suitable design (what specific problem will it cause), and
suggest an improvement (numbers indicate task periods):
3. RTS design (cont.)

c) Consider the description: If the average temperature reaches 120 degrees, the fan must
start within 200 ms and the valve must be opened within 50 ms.

Explain why the following is not a suitable design (what specific problem will it cause), and
suggest an improvement (numbers indicate task periods):
4. RTS implementation

a) Let A and B be two tasks with a precedence relation from task A to task B.
Explain how task parameters can be selected to ensure this precedence when the system
is based on i) Fixed Priority Scheduling (FPS); or ii) Earliest Deadline First (EDF).

b) Consider the design below, with this explanation: The periods are defined in a way that we
can use rate monotonic priority assignment and ensure that tasks are executed in the right
order. Explain why this is not a suitable design (what specific problem will it cause) and
suggest an improvement (numbers indicate task periods).

c) Give an example of a task set that is not suitable to implement as a cyclic executive, and
explain why.
5. RTS design and analysis

Consider the following requirements for a real-time system controlling a part of a water distribution network:
1. The main valve should be adjusted every 100 ms based on the pressure before and after the valve.
2. If the pressure after the valve ever reaches max_level, the two emergency valves must be opened
within 50 ms, and no more than 10 ms apart.
3. The current pressure values should be sent to a remote operator station every second.

In addition, you know that the code for sending information to the operator station is fairly complex, with a
WCET of 150 ms. Each sensor reading takes 10 ms, but computations and controlling the valves takes very
little time (around 1 ms).
a) Design the system and depict the design graphically, including the tasks, what data is communicated
between tasks, and which tasks are communicating with which peripheral devices (sensors/actuators).
b) Select a suitable scheduling approach (offline/online, preemptive/nonpreemptive, etc.), and assign periods
and other relevant task parameters.
c) Argue that all three system-level timing requirements are met (including that the system is schedulable).
Note: Consistency between the three sub-assignments (a, b and c) is crucial.
6. RTOS
Assume the following tasks:

T1_main(void){ T2_main(void){ T3_main(void){


while(1){ while(1){ while(1){
/*do something*/ /*do something */ /*do something */

sleep(42); sleep(24);
} } }

a) Assign priorities such that all tasks can execute.

b) Give an example of a priority ordering that prevents at least one task from
executing.

c) If we remove sleep(24) from T2, will all tasks be able to execute?


7. Scheduling methods

a) Connect each scheduling algorithm to the appropriate analysis:


What is the corresponding schedulability test for each analysis method?

scheduling algorithm : Analysis metod:


- Rate Monotonic - CPU utilization bound analysis
- Deadline Monotonic - Response time analysis
- Earliest Deadline First - Processor demand bound
analysis

b) Give a schedulability test that is both sufficient and necessary for a task
set where all tasks have the same period, i.e.., T1=T2=T3=…=Tn
8. Rate Monotonic
Assuming the taskset:

Task T C
A 10 1
B 4 1
C 2 1

a) Assign priorities according to Rate Monotonic.


b) Calculate the CPU utilisation.
c) Draw an execution trace for a critical instant.
d) Calculate the response times for all tasks.
9. Rate Monotonic

Task Period (T) C D


A 4 1 4
B 8 3 8
C 16 7 16

Assume rate monotonic.

Is the taskset schedulable?

If not, how much do you need to reduce the execution time of the lowest
priority task such that the system is schedulable?
10. Response time analysis
Task Period = deadline C
L 50 10
H ? 3

L = low priority
H = high priority

a) What is the shortest possible period for H such that the system is schedulable?
11. Response time analysis with shared resources

Assume the following system:

Task T C Task Semafor Critical section


A 16 4 A S1 1
B 10 3 B S1 1
C 8 2 B S2 1
C S1 1
C S2 2
C S3 1

Priority assignment = Rate Monotonic.


Synchronisation protocol = Priority Ceiling Protocol

Calculate the response times for all tasks.


12. Response time analysis with shared resources
Task T Dl C
Task 1 8 8 4
Task 3
Task 2 14 14 3
S1 I/O 1
Task 3 26 26 4
Task 2 S2 I/O 2
S3 I/O 3 Task S1 S2 S3
Task 1
Task 1 - 3 1
Task 2 1 1 -
Task 3 2 - -

Length of the
critical section (cs)
Priority assignment = Rate Monotonic.
Synchronisation protocol = Priority Ceiling Protocol

Is the system schedulable?


13. Earliest Deadline First
Task Period C D
A 3 1 3
B 4 1 4
C 5 1 5
D 5 1 5

Is the system schedulable by Earliest Deadline First (EDF)?

Draw an execution trace up to 15 clock ticks.


14. Earliest Deadline First

Task Period D C

A 3 2 1

B 4 2 1

C 5 4 2

Schedulable with EDF?

æ ê L - Di ú ö
n
"L Î D : L ³ å çç ê + ÷
ú ÷Ci
1
i =1 è ë Ti û ø
15. Offline scheduling

Use preemption and EDF heuristics to schedule the precedence graphs below:

Period: 15
Task C Release time (RT) Deadline (D)
A
A 4 0 7
C
PG 1: B 3 0 12

B C 5 0 15

D 1 3 4

Period: 5
PG 2:
D
16. Offline scheduling
Construct an offline schedule for the control of an electric motor.

MOTOR

Period=12
sampling actuating

Computer

Sampling
– It takes at most one clock tick
– Must be done latest 3 clock ticks after its activation
Computation of an actuation value
– Takes at most 5 clock ticks
Actuation
– Takes at most 1 clock tick
– The time between actuation and the next sampling may not be longer than 3 clock
ticks
Additionally, we have a taks that calculates the engine torque
– Period= 2T=24
– Takes at most 1 clock tick
– Must be done latest 3 clock ticks after its activation
17. CAN communication
Assume the following messages sent on a CAN bus from 3
nodes (N1 sends m1, etc.)
message Deadline (D) Period (P) Data bytes (n)

m1 4 10 1
m2 6 20 5
m3 10 15 6

Assume:
• all values represent milliseconds
• Priority assignment: deadline monotonic
• nr of control bits in every frame: 47
• Buss spped: 50 Kbit/s
• no incoming jitter

a) Calculate the response time for all messages


b) Calculate the utilization demand on the bus

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy