Академический Документы
Профессиональный Документы
Культура Документы
Verónica Gaspes
www2.hh.se/staff/vero
But . . .
Busy waiting vs Interrupts The reactive embedded system
But . . .
Busy waiting vs Interrupts The reactive embedded system
But . . .
Busy waiting vs Interrupts The reactive embedded system
But . . .
Busy waiting vs Interrupts The reactive embedded system
But . . .
Busy waiting vs Interrupts The reactive embedded system
void controller_main() {
int dist, signal;
void decoder_main() {
while(1){
struct Packet packet;
dist = sonar_read();
while(1){
control(dist, radio_read(&packet);
&signal,
decode(&packet,¶ms);
¶ms);
}
servo_write(signal);
}
}
}
←− Time sharing −→
void controller_main() {
int dist, signal;
void decoder_main() {
while(1){
struct Packet packet;
dist = sonar_read();
while(1){
control(dist, radio_read(&packet);
&signal,
decode(&packet,¶ms);
¶ms);
}
servo_write(signal);
}
}
}
←− Time sharing −→
Consequence 1
B B B
A A A
t(ms)
Say each thread gets Tms for execution, both waiting and
computing!
Busy waiting vs Interrupts The reactive embedded system
Consequence 1
B B B
A A A
t(ms)
Consequence 1
B B B
A A A
t(ms)
Consequence 1
Consequence 2
Thread B
A B A B A B A B A B A B A B A B A B A
Minus . . .
1 Not a satisfactory technique for input synchronization if the
Could we do otherwise?
An input synchronization technique that does not require the
receiver of data to actively ask whether data has arrived.
Busy waiting vs Interrupts The reactive embedded system
Minus . . .
1 Not a satisfactory technique for input synchronization if the
Could we do otherwise?
An input synchronization technique that does not require the
receiver of data to actively ask whether data has arrived.
Busy waiting vs Interrupts The reactive embedded system
Minus . . .
1 Not a satisfactory technique for input synchronization if the
Could we do otherwise?
An input synchronization technique that does not require the
receiver of data to actively ask whether data has arrived.
Busy waiting vs Interrupts The reactive embedded system
Minus . . .
1 Not a satisfactory technique for input synchronization if the
Could we do otherwise?
An input synchronization technique that does not require the
receiver of data to actively ask whether data has arrived.
Busy waiting vs Interrupts The reactive embedded system
CPU
CPU
An analogy
Busy waiting
Reacting to an interrupt
Go to the post-office again and
Receive a note in your mailbox
again to check if the delivery has
that the goods can be picked up.
arrived.
An analogy
Busy waiting
Reacting to an interrupt
Go to the post-office again and
Receive a note in your mailbox
again to check if the delivery has
that the goods can be picked up.
arrived.
An analogy
Busy waiting
Reacting to an interrupt
Go to the post-office again and
Receive a note in your mailbox
again to check if the delivery has
that the goods can be picked up.
arrived.
An analogy
Busy waiting
Reacting to an interrupt
Go to the post-office again and
Receive a note in your mailbox
again to check if the delivery has
that the goods can be picked up.
arrived.
An analogy
Busy waiting
Reacting to an interrupt
Go to the post-office again and
Receive a note in your mailbox
again to check if the delivery has
that the goods can be picked up.
arrived.
ISRs vs functions
Busy waiting
Reacting
We defined functions like
We define ISRs. These are not
sonar read that can be called in
called from the program, but the
the program. The CPU decides
code is executed when an
when to call the function:
interrupt occurs:
while(1){
ISR(SIG_SONAR){
sonar_read();
control();
control();
}
}
ISRs vs functions
Busy waiting
Reacting
We defined functions like
We define ISRs. These are not
sonar read that can be called in
called from the program, but the
the program. The CPU decides
code is executed when an
when to call the function:
interrupt occurs:
while(1){
ISR(SIG_SONAR){
sonar_read();
control();
control();
}
}
ISRs vs functions
Busy waiting
Reacting
We defined functions like
We define ISRs. These are not
sonar read that can be called in
called from the program, but the
the program. The CPU decides
code is executed when an
when to call the function:
interrupt occurs:
while(1){
ISR(SIG_SONAR){
sonar_read();
control();
control();
}
}
ISRs vs functions
Busy waiting
Reacting
We defined functions like
We define ISRs. These are not
sonar read that can be called in
called from the program, but the
the program. The CPU decides
code is executed when an
when to call the function:
interrupt occurs:
while(1){
ISR(SIG_SONAR){
sonar_read();
control();
control();
}
}
ISRs vs functions
Busy waiting
Reacting
We defined functions like
We define ISRs. These are not
sonar read that can be called in
called from the program, but the
the program. The CPU decides
code is executed when an
when to call the function:
interrupt occurs:
while(1){
ISR(SIG_SONAR){
sonar_read();
control();
control();
}
}
CPU centric
Reacting CPU
One thread of control that runs
A set of code fragments that
from start to stop (or forever)
constitute the reactions to
reading and writing data as it
recognized events.
goes.
The main part of the course from now on will focus on the reactive
view.
Busy waiting vs Interrupts The reactive embedded system
CPU centric
Reacting CPU
One thread of control that runs
A set of code fragments that
from start to stop (or forever)
constitute the reactions to
reading and writing data as it
recognized events.
goes.
The main part of the course from now on will focus on the reactive
view.
Busy waiting vs Interrupts The reactive embedded system
CPU centric
Reacting CPU
One thread of control that runs
A set of code fragments that
from start to stop (or forever)
constitute the reactions to
reading and writing data as it
recognized events.
goes.
The main part of the course from now on will focus on the reactive
view.
Busy waiting vs Interrupts The reactive embedded system
CPU centric
Reacting CPU
One thread of control that runs
A set of code fragments that
from start to stop (or forever)
constitute the reactions to
reading and writing data as it
recognized events.
goes.
The main part of the course from now on will focus on the reactive
view.
Busy waiting vs Interrupts The reactive embedded system
Application
Sensor
Port Sensor A
Port Actuator
Sensor B
Sensor Port
Busy waiting vs Interrupts The reactive embedded system
Application
driver
Sensor
Port Sensor A
app
Port Actuator
Sensor B
Sensor Port
driver
Busy waiting vs Interrupts The reactive embedded system
Reactive Objects
Boxes
Represent software or hardware reactive objects that:
Maintain an internal state (variables, registers, etc)
Provide a set of methods as reactions to external events
(ISRs, etc)
Simply rest between reactions!
Arrows
Represent event or signal or message flow between objects that can
be either
asynchronous
synchronous
Busy waiting vs Interrupts The reactive embedded system
Reactive Objects
Boxes
Represent software or hardware reactive objects that:
Maintain an internal state (variables, registers, etc)
Provide a set of methods as reactions to external events
(ISRs, etc)
Simply rest between reactions!
Arrows
Represent event or signal or message flow between objects that can
be either
asynchronous
synchronous
Busy waiting vs Interrupts The reactive embedded system
Reactive Objects
Boxes
Represent software or hardware reactive objects that:
Maintain an internal state (variables, registers, etc)
Provide a set of methods as reactions to external events
(ISRs, etc)
Simply rest between reactions!
Arrows
Represent event or signal or message flow between objects that can
be either
asynchronous
synchronous
Busy waiting vs Interrupts The reactive embedded system
Reactive Objects
Boxes
Represent software or hardware reactive objects that:
Maintain an internal state (variables, registers, etc)
Provide a set of methods as reactions to external events
(ISRs, etc)
Simply rest between reactions!
Arrows
Represent event or signal or message flow between objects that can
be either
asynchronous
synchronous
Busy waiting vs Interrupts The reactive embedded system
Hardware objects
Hardware objects
Hardware objects
Hardware objects
Software objects
Software objects
Software objects
Software objects
Software objects
Distance Servo
Controller
data signals
Object Sonar Output
Input
Control
Params
Radio
Decoder
packets
Input
Reactive Objects
Bonus
Principles and methodologies from OOP become applicable to
embedded, event-driven and concurrent systems!
Busy waiting vs Interrupts The reactive embedded system
Reactive Objects
Bonus
Principles and methodologies from OOP become applicable to
embedded, event-driven and concurrent systems!
Busy waiting vs Interrupts The reactive embedded system
Reactive Objects
Bonus
Principles and methodologies from OOP become applicable to
embedded, event-driven and concurrent systems!
Busy waiting vs Interrupts The reactive embedded system
Reactive Objects
Bonus
Principles and methodologies from OOP become applicable to
embedded, event-driven and concurrent systems!
Busy waiting vs Interrupts The reactive embedded system
Reactive Objects
Bonus
Principles and methodologies from OOP become applicable to
embedded, event-driven and concurrent systems!
Busy waiting vs Interrupts The reactive embedded system
Reactive Objects
Bonus
Principles and methodologies from OOP become applicable to
embedded, event-driven and concurrent systems!
Busy waiting vs Interrupts The reactive embedded system
Reactive Objects
Bonus
Principles and methodologies from OOP become applicable to
embedded, event-driven and concurrent systems!
Busy waiting vs Interrupts The reactive embedded system
Java? C++?
Other threads that use the same counter are sharing the state!
Java? C++?
Other threads that use the same counter are sharing the state!
Java? C++?
Other threads that use the same counter are sharing the state!
Java? C++?
Other threads that use the same counter are sharing the state!
Java? C++?
Other threads that use the same counter are sharing the state!
OO and Concurrency
This is one of the reasons why we choose to build our own kernel
supporting reactive objects and programming in C.
Busy waiting vs Interrupts The reactive embedded system
OO and Concurrency
This is one of the reasons why we choose to build our own kernel
supporting reactive objects and programming in C.
Busy waiting vs Interrupts The reactive embedded system
OO and Concurrency
This is one of the reasons why we choose to build our own kernel
supporting reactive objects and programming in C.
Busy waiting vs Interrupts The reactive embedded system
OO and Concurrency
This is one of the reasons why we choose to build our own kernel
supporting reactive objects and programming in C.
Busy waiting vs Interrupts The reactive embedded system
OO and Concurrency
This is one of the reasons why we choose to build our own kernel
supporting reactive objects and programming in C.
Busy waiting vs Interrupts The reactive embedded system
OO and Concurrency
This is one of the reasons why we choose to build our own kernel
supporting reactive objects and programming in C.
Busy waiting vs Interrupts The reactive embedded system
OO and Concurrency
This is one of the reasons why we choose to build our own kernel
supporting reactive objects and programming in C.
Busy waiting vs Interrupts The reactive embedded system
OO and Concurrency
This is one of the reasons why we choose to build our own kernel
supporting reactive objects and programming in C.
Busy waiting vs Interrupts The reactive embedded system
Reactive objects in C