Difference between revisions of "Technical topic: Manage interface priorities"

From TASTE
Jump to: navigation, search
(Use case)
 
m (1 revision imported)
 
(No difference)

Latest revision as of 21:02, 4 August 2017

The need

It is common to specify systems that can receive more than one message. In TASTE terms, it means functions that have more than one provided interfaces (PI).

When this is the case you may want to give give different levels of priorities to the various PI, so that at runtime, when the function is executed, the PI will be executed according to their priority.

We will explain how this can be done with TASTE.

Use case

This simple system contains two functions (Function1 and Function2). Periodically ("pulse" PI) Function 1 will call sequentially PI1 and then PI2 from Function 2. Both are sporadic.

Prio-usecase.png

The code of Function1 using SDL: simply calling the two PI in sequence

Prio-f1.png

The code of Function2 using SDL: simple printf when a PI is executed

Prio-f2.png

Assuming that Function 1 as a whole has a higher priority than Function 2 (so that it is not pre-empted immediately by Function 2 when calling PI1) we want to be able to decide which interface of PI1 or PI2 will effectively be executed the first one.

How to do it

Open the Deployment view and then the Concurrency View (from the Tools menu). Click on the top-icon as shown on the picture below: this is where you can define your priorities.

Prio-concurrencyview.png

Try to give different values to PI1 and PI2, to figure out first if on your target a small number means a high priority or if it is the opposite.

How to test it

Linux targets cannot be used to validate this feature, as the Linux scheduler is not real-time and will mess up your scheduling. Try a real-time OS (e.g. RTEMS POSIX on a Leon processor) and use the built-in QEmu emulator to quickly check the results.

   $ xterm -e /opt/qemu-leon2/bin/qemu-system-sparc -M at697 -nographic -kernel /path/to/leon_binary

Prio-run.png