blob: f7a98f7acc7686cf392915a21a4d0207e84f341d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# $Id$
Shows how to use the scheduling service in conjunction with
the real-time event channel. The test also uses the Kokyu
dispatching module within the RTEC, which provides the
dispatching queues for the isolation of events based on
their preemption priority generated by the scheduler. The
test has two consumers and two suppliers. The test also
demonstrates how to use timers in the EC to trigger timeout
events for timeout consumers which inturn act as suppliers
to other consumers. The following shows the test setup.
LO_CRIT |-----|
1Hz EC Timer1 ----> TimerConsumer1 ---> Supplier1 --->| |---> Consumer1
| EC |
| |
1/3Hz EC Timer2 ----> TimerConsumer2 ---> Supplier2 --->| |---> Consumer2
HI_CRIT |-----|
The event-channel cooperates with the scheduling service to
compute a schedule and assign priorities to each event. The event
channel will use different queues for those events, each queue
serviced by threads at different priorities. In the above
test case, there will be two dispatching queues, one for each
flow. The 1Hz flow will have higher priority than the 1/3Hz flow
wirh plain RMS scheduling. With MUF scheduling, the HI_CRIT
flow will have higher priority than the LO_CRIT flow.
The example can be run as follows:
$ ./Service -s<rms|muf>
Please make sure you run the example with root privileges.
Expected output for RMS
-----------------------
You should see the 1Hz events dispatched by a higher priority
thread than the 1/3Hz events. Sample output is shown below. Here
2051 is the thread id of the thread dispatching 1/3Hz events
and 1026 is the thread id of the thread dispatching 1Hz events.
The latter runs at a higher real-time thread priority than the
former under RMS scheduling strategy.
Consumer (27703|2051) we received event type 17
Consumer (27703|1026) we received event type 16
Consumer (27703|1026) we received event type 16
Consumer (27703|1026) we received event type 16
Consumer (27703|2051) we received event type 17
Expected output for MUF
-----------------------
You should see the 1/3Hz events dispatched by a higher priority
thread than the 1Hz events since the former is more critical
than the latter. Sample output is shown below. Here
2051 is the thread id of the thread dispatching 1Hz events
and 1026 is the thread id of the thread dispatching 1/3Hz events.
The latter runs at a higher real-time thread priority than the
former under MUF scheduling strategy.
Consumer (28191|2051) we received event type 16
Consumer (28191|2051) we received event type 16
Consumer (28191|2051) we received event type 16
Consumer (28191|1026) we received event type 17
Consumer (28191|2051) we received event type 16
|