Using System Resource to Tackle Multi-Threaded Design
Tutorial Goals
The following is a summary of the concepts and tasks you will learn in this session.
- Define multiple concurrent tasks or flows.
- Define a shared resource- SystemResource.
- Map behavior to the target architecture.
Target
This session sizes the
processor resource to support the parallel tasks
running on it. The system contains three concurrent tasks that need
to be executed on the single processor. Each task has a different
arrival rate, priority, and processing time. Let us look at the impact
of different scheduling algorithms such as First Come-First Serve
(FCFS), FCFS with Preemption, and Round-Robin. The block diagram of the
proposed system is shown in Figure 1.
Figure 1: Block Diagram of the Proposed System
VisualSim Tutorial Model Location
Open this model in VisualSim from the following location:
File->Open File $VS/doc/Training_Material/Tutorial/WebHelp/Tutorial/General_Applications/Gen_Lab3.xml
Figure 2: Genlab 3 Model
Objectives
This session focuses on
building a scheduling model in VisualSim in order to evaluate the
performance of targeting multiple tasks to a single System Resource.
- Evaluate the effect of scheduling multiple concurrent tasks.
- Identify the right scheduling algorithms.
- Evaluate the effect of priority on tasks.
- Determine the impact on the response time for higher priority tasks.
- Determine the impact on lower priority tasks.
- Evaluate the effect of preemption on executing tasks.
- Determine the impact on higher priority tasks.
- Determine the impact on lower priority tasks.
- Generate statistics and data for plotting.
- Determine how the priority impacts the order of execution (by visual inspection).
- Determine how the processing time or Task_Time affects scheduler buffering.
Building and Running the Model
- Set
up three 'Traffic' blocks to generate tasks with fixed inter arrival
times of 100, 110 and 115 MHz, respectively; offset the second 'Traffic'
block to 3.0 nanoseconds and the third one to 2.0 nanoseconds.
- How does one offset the three traffic streams?
Hint: 'Start_Time' of Traffic for second and third will have a non-zero offset time.
- How does one generate a "Fixed" transaction every 100.0 MHz?
- How does one test that the transactions are being generated?
Hint: See part 1 of this tutorial set
- Setup
three 'Mapper' blocks to issue tasks with unique 'Task_Number's.
Also, set 'Task_Priority' to 1, 2, and 3 respectively.
- How does one specify the 'Target_Resource' as a parameter?
- How does one specify a fixed task number?
- How does one set 'Task_Time' to 10.0 nanoseconds?
- Setup a
'SystemResource' block to accept tasks arriving from the 'Mapper'
block. Make sure the 'Systemresource' block uses 'Relative Time'
and the FCFS + Preempt' scheduling algorithm. The
Task_Context_Switch_Time should be set to 0.0 and the
'Round_Robin_Time_Slice' should be set to 0.5.
- What is the difference between 'Relative_Time' and 'Number_Clocks'?
- How is the parameter 'Round_Robin_Time_Slice' used in the FCFS scheduling?
Hint: It is not used.
- Attach a
"TimeDataPlotter" for the "SystemResource" (Resource >
SystemResource) task plot output and the Mapper plot output.
- What is the difference in the task_plot for the SystemResource and the Mapper?
Hint:
The first is the execution of all the resources in the sequence. The
second is the number of tasks currently waiting or being processed by
all SystemResources that have been dispatched from this Mapper.
- How do you display the statistics?
Hint: Use the Results > ResourceStatistics block.
Executing the Simulation
- Run the model with
the 'Scheduler_Type' set to 'FCFS with Preemption'. Once this
has completed, rerun the simulation with 'Scheduler_Type' set to 'FCFS'.
- Determine if the tasks are running as expected (see TimedPlotter output).
- Determine if the task statistics are correct.
- Modify the 'Scheduler_Type' to the 'Scheduler_RR' scheduling algorithm and rerun the simulation.
- Confirm that the TimedPlotter tasks execute a Round Robin schedule.
- Determine what changes (if any) are made in the SystemResource Statistics.
Modeling Considerations
- How are the 'Mapper' and 'SystemResource' blocks utilized in a real model?
Congrats
You now understand how to map behaviors to architectures and how to use the scheduling blocks in VisualSim!!!
You are now ready to start
building your own models. To see the potential application of the
concepts described in this set of tutorials, review the tutorial set
called Performance Analysis.