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