Part3-Using System Resource to Tackle Multi-Threaded Design

Parent Previous Next

VisualSim                                                                                                                              


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.


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.

Lab3_Sys_Design

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

Genlab_3

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.

  1. Evaluate the effect of scheduling multiple concurrent tasks.
    1. Identify the right scheduling algorithms.
  2. Evaluate the effect of priority on tasks.
    1. Determine the impact on the response time for higher priority tasks.
    2. Determine the impact on lower priority tasks.
  3. Evaluate the effect of preemption on executing tasks.
    1. Determine the impact on higher priority tasks.
    2. Determine the impact on lower priority tasks.
  4. Generate statistics and data for plotting.

Building and Running the Model

  1. 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.
    1. How does one offset the three traffic streams?

                            Hint: 'Start_Time' of Traffic for second and third will have a non-zero offset time.

                            Hint: See part 1 of this tutorial set

  1. 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?
  1. How does one set 'Task_Time' to 10.0 nanoseconds?
  2. 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.

  1. Attach a "TimeDataPlotter"  for the "SystemResource" (Resource > SystemResource) task plot output and the Mapper plot output.
    1. 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.

Hint: Use the Results > ResourceStatistics block.




Executing the Simulation


  1. 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'.
    1. Determine if the tasks are running as expected (see TimedPlotter output).
    2. Determine if the task statistics are correct.
  2. Modify the 'Scheduler_Type' to the 'Scheduler_RR' scheduling algorithm and rerun the simulation.
    1. Confirm that the TimedPlotter tasks execute a Round Robin schedule.
    2. Determine what changes (if any) are made in the SystemResource Statistics.


Modeling Considerations


  1. How are the 'Mapper' and 'SystemResource' blocks utilized in a real model?

CongratsCongrats

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.