Written by Patrick E. Lanigan
while working with the PARTS project
at
the University of Pittsburgh
This applet requires J2RE 1.3.1, but version 1.4.0 & higher is recommended.
Get the latest Java 2 Runtime Environment here.
"Typical real-time scheduling theory has addressed deadling and energy constraints as well as deadline and reward constraints simulataneously in the past. However, we believe that embedded devices with varying applications typically have three constraints that need to be addressed: energy, deadline, and reward. These constraints play important roles in the next generation of embedded devies, since they provide users with a variety of QoS-aware trade-offs. An optimal scheme would allow the device to run the most critical and valuable applications, without depleting the energy source while still meeting all deadlines" - from Rusu, Melhem, Mosse, "Maximizing the System Value while Satisfying Time and Energy Constraints" [ RTSS02.ps ] [ RTSS02.pdf ]
The problem of maximizing the system value while meeting time and energy constraints is NP-hard, requiring exponential time to find the optimal solution. This applet gives a graphical demonstration of two heuristic-based algorithms, REW-pack and REW-unpack, which in logarithmic running time, closely approximate the optimal solution.
For more detailed information on the algorithms demonstrated here, see this paper (PDF version).
To get started:
- Select the Power Model tab. Choose a predefined power model from the pull-down box.
- Select the Task Set tab. Choose a predefined task set from the pull-down box.
- From the pull-down box at the top of the applet, select an algorithm.
- Click "Run Simulation".
- The results will be displayed in the bottom portion of the applet window.
Available algorithms:
- REW-pack - adds tasks at minimum speed levels, increases speeds incrementally
- REW-unpack - adds tasks at maximum speeds levels, decreases speeds incrementally
- Optimal - performs exhaustive search
Available task models:
- Task Set A - set containing 10 tasks
- Task Set B - set containing 15 tasks
- Task Set C - set containing 20 tasks
Available power models:
- Transmeta 5400 - 16 speed levels with frequencies ranging from 200 Mhz - 700 Mhz and voltages from 1.1 - 1.65 volts.
- Intel XScale - 5 speed levels with frequencies ranging from 150 Mhz to 1000 Mhz and voltages from 0.75 - 1.8 volts.
In this section you will find a description of the simulator, task set, and power model user parameters available in the applet.
Simulator
- Algorithm selection - Use the pulldown box to select REW-pack, REW-unpack, or optimal scheduling algorithms
- Enable animation - By default animation is turned on. Uncheck this box to disable animation in the results window. Disabling animation will save system resources when running the algorithms (see "Resource Concerns Running the Optimal Algorithm").
Power Model
- Power model selection - Use the pulldown box to choose from two predefined power models, or select a custom power model.
Linear Generation
- # Speeds - Number of speed levels to generate.
- Minimum voltage - Voltage at minimum speed level for the power model.
- Maximum voltage - Voltage at maximum speed level for the power model.
- Minimum frequency - Processor frequency at minimum speed level for the power model.
- Maximum frequency - Processor frequency at maximum speed level for the power model.
Speed Level Properties
- Level ID - Unique numerical identifier of selected speed level
- Frequency - Clock frequency of the selected speed level
- Voltage - Voltage of the selected speed level
- Display Color - Color in results window graph representing the selected speed level
Task Model
- Task set selection - Use the pulldown box to choose from 3 predefined task sets, or select a custom task set
- Deadline (% of max) - Set the global deadline as a percentage of the total excecution time of all tasks at minimum speed.
- Energy (% of max) - Set the energy constraint as a percentage of the total energy requirement of all tasks excecuting at maximum speed.
Random Generation
- # Tasks - Number of tasks to randomly generate.
Task Properties
- Task ID - Unique numerical identifier of the selected task.
- WCET (Cycles) - Worst case execution time, measured in millions of cycles.
- Reward - Specifies the reward, or value, associated with a task.
- Activity - Activity factor for each task. This factor is used to compute the power consumption of a particular task and is defined to be "proportional with the dynamic switching caused by the task."
This section describes how to create, edit, and run custom experiments. Custom experiments can be run using a custom task model, a custom power model, or both. These can be made by modifying a predefined model or by generating new models.
Saving to and loading from your local disk is also covered in this section.
Creating an Experiment
Task Model
To create a random task model, in the Task Model panel:
- Enter the number of tasks you wish to generate in the # Tasks field.
- Hit the "Generate" button.
This will create a task set with the specified number of tasks and attributes assigned randomly within the following intervals: WCET [1, 100], Reward [1, 100], Activity [0.8, 1.2]. Any previously loaded custom task models will be replaced by the newly generated one.
Power Model
To create a new linearly spaced power model, in the Power Model panel:
- Enter the number of speed levels you wish to generate in the # Speeds field.
- Enter a minimum and maximum voltage, and a minimum and maximum frequency for the power model in the appropriate fields.
- Hit the "Generate" button.
This will create a custom power model with speed levels spaced linearly between the miniumum and maximum values. Any previously loaded custom power models will be replaced by the newly generated one.
Editing an Experiment
Individual tasks and speed levels can be added, edited and deleted by following the same basic steps.
Adding an Item
- Identify a new item by entering an unused ID in the respective ID field.
- Use the mouse or the tab key to move between fields, filling in all the information.
- Click the "Add/Change" button to add your new item to the list.
Editing an Item
- Select an item to edit by
- clicking on it in the display list -or-
- entering its ID in the respective ID field and using the mouse or tab key to change fields.
- Enter the new values. Note: To change the display color of a speed level, click the color box next to the "Display Color" label. This will bring up a color chooser dialog from which you may choose a new color.
- Click the "Add/Change" button to commit your changes.
Deleting an Item
- Select an item to edit by
- clicking on it in the display list -or-
- entering its ID in the respective ID field and using the mouse or tab key to change fields
- Click the "Delete" button.
Once a model has been edited, it is saved as a "Custom" model and is accessible through the respective model chooser pull down boxes. You can switch back and forth between predefined models and your custom model. However, only one custom model of each type (power and task) can be loaded in the program at a time. Once changes have been made to another predefined model, the new custom model will replace any previously loaded custom model. For information about saving and loading custom models to and from your local disk, see the next section.
Saving & Loading Experiments Locally
The "Save" and "Load" buttons will only become active if the applet has permission to access your local disk. By default, applet security settings typically do not allow local disk access. In order to save and load task and power models locally, you will need to configure your Java Virtual Machine to give unsigned applets the proper permissions.
If you are unfamiliar with Java permissions and are using the Sun JVM, you can download the standalone application version of the demo. To run the file, type java -jar REWSim.jar at the command line. You must have J2RE v1.3.1 or higher installed.
Task and power models are saved to plain text files. The first line in the file is a header specifying the type of model represented in the file. The second line specifies how many items the model contains. Each item is listed on a space-delimited new line. The last line in each file should be a footer denoting the end of the model. If you wish to generate your own model files, they should use the following formats:
Task Model Power Model <--BEGIN TASK MODEL-->
[number of tasks]
[item_id] [wcet] [reward] [activity]
... more tasks ...
[item_id] [wcet] [reward] [activity]
<--END TASK MODEL--><--BEGIN POWER MODEL-->
[number of speed levels]
[item_id] [frequency] [voltage]
... more levels ...
[item_id] [frequency] [voltage]
<--END POWER MODEL-->Viewing Results
Run the simulation by selecting an algorithm and clicking "Run Simulation". A results window will appear in the results display area at the bottom of the application window. Once the algorithm has completed, the results window will be updated to display the schedule found by the algorithm. It will also display the deadline and energy used as a percentage of the total available, the total reward of the schedule, the approximate running time of the algorithm, and the number of steps needed to find a solution.
To get a better view of the results, you can resize the results display area. Drag the separator bar vertically, or use the "One Touch" buttons to expand the display area to your liking. You can also resize the entire application window for more viewing space.
The schedule is represented in two ways. The "Saved Solution" box lists each task in the solution and its associated frequency. The graphs represent each task as a colored bar; the task's speed level is plotted along the y-axis, and the relative energy and deadline usage of each task is plotted along the x-axis of the respective graphs. You can have as many results windows opened at one time as your system's resources allow. The graphs can be zoomed in and out using the buttons located to the bottom right of each graph.
Animation
Animation is controlled using the buttons located in the top left corner of the window. The animation supports play/pause, stop, step forward, and fast forward functions. Pausing the animation freezes it at the current stage. Stopping playback returns the results window to its inital state.
During animation, the graphs change to represent the current selected tasks and their respective speed levels. The animation also lists the current reward, energy usage, and deadline usage of the selected tasks. The best solution found so far is listed in the "Saved Solution" list, with the currently selected tasks listed in the "Selected Tasks" list. Tasks that have not been considered are listed in the "Unused Tasks" list, and once a task has been dropped it is moved to the "Dropped Tasks" list.
The progress bar shows the progress of the algorithm by counting the major steps taken by the algorithm, which include:
- Adding a task.
- Droping a task.
- Increasing the speed of some task.
- Decreasing the speed of some task.
- Saving the current solution.
Note: The animator will only record the first 100,000 steps of any experiment for playback. However, the experiment will still run to completion as long as it is not cancelled by the user. (See Resource Concerns Running the Optimal Algorithm)
The optimal algorithm is very expensive by nature. Accordingly, finding the optimal solution with any more than a few tasks and speed levels can cause problems with memory and processor usage.
In order to facilitate animation, the REWSim traces each algorithm and stores its steps in memory. This trace list is played back each time the experiment is animated. Since the optimal can potentially take millions of steps, trace list can grow very fast consuming large amounts of memory. For this reason, the animator will only record the first 100,000 steps of any experiment. To further reduce the overhead of tracing the algorithms, you can disable animation before running an experiment by deselecting the checkbox labeled "Enable Animation".
You can close the graph window after it appears in the results viewing area to stop the optimal algorithm if it is taking too long to complete or placing too high a load on your processor.
Generally, all of the algorithms perform less operations with tighter constraints. Accordingly, to experiment with more tasks and speed levels, try lowering the energy and deadline available.
Page and applet created by Patrick
Lanigan,
a current Computer Science student
at the University of Pittsburgh.