Resources / SystemResource_Extend
Block Name: SystemResource_Extend
Code File Location: VisualSim/actor/lib/Scheduler_HW
o Used to define a processing resource that can be called from multiple points in a model.
o Separate the behavior flow from the architecture definition.
o Similar to the System resource methodology in SysML.
o
Different from SystemResource. The output port of this block connects
to behaviors, mappers and other delays. Adding
the
SystemResource_Done will return the Data Structure to the Mapper block.
The following is a block diagram that shows the application of a SystemResource_Extend block.
This block forms the architecture part of the behavior and architecture separation methodology. In this methodology, the data structures are transfered along the behavior flow. When the data structure arrives at a Mapper block or a Mapper RegEx (scheduleTask) in a Script block, the Data Structure is sent to the architecture device defined by this SystemResource block. Another SystemResource can also send a request to this block. The SystemResource_Extend behaves as a Queue + Server + External Resource.
The arriving transaction is placed in a priority queue which is reordered based on the priority of the transaction. Higher the number; higher the priority. When the transaction arrives at the Head of the Queue, it is delayed by the "Task_Time" value provided along with the Data Structure. After this delay, the Data Structure is sent to the output port. Any logic can be performed outside of this block including delays, routing and trigger other operations. The SystemResource is blocked and no new transaction is processed. To use the SystemResource in non-blocking model, select the FCFS_NonBlocking for the Scheduler. When the SystemResource_Done block is encountered in the flow from the output port., the transaction releases the Scheduler and returns the transaction back to the SystemResource, Mapper or the next line after the RegEx function in the code. The transaction can continue through the SystemResource_Done block.
The external processing is used where the Server requires data from a cache before the completing the processing, or the data needs to be cleared by a interrupt before allowing the next transaction or to emulate a pipeline stall for a period of time. The SystemResource_Done Block can be executed immediately (non-blocking case), or at the end of the task (blocking case).
The ports are for plotting
(state_plot) and external transaction processing (output). The
incoming transaction to the SystemResource must provide the following
information- Scheduler_Name, Task Time, Task_Priority (optional) and
Task_Number (Identifier used for plotting purpose. If the default is unchanged, the Task_Number = 1).
The statistics can be accessed
using the ResourceStatistics block, getBlockStatus and the output file
that is written into the model directory/results folder.
To understand the usage of the SystemResource_Extend, look at the Scheduler Example in the BDE.
o Input queue is ordered based on the priority of the transaction. Higher the number signifies higher priority.
o The Scheduler can handle time as a double value (number of seconds) or cycles (divided by the Speed_MHz).
o Three default
scheduling schemes and two user-defined are provided. The
FCFS_NonBlocking is to support non-blocking, which means that the next
transaction does have to wait for the previous one to reach the Done
block.
o Additional logic and delays can be added to each tasks by adding blocks to the 'output' port. The Scheduler is released using the Scheduler_Release.
o Requesting transaction can arrive from any part of the model.
o Supports two Power_Manager states- Active and Standby. Standby is when the SystemResource is inactive. Active is when the SystemResource is processing a task.
o User can define additional states for each SystemResource. Using the Power RegEx, the user can move the SystemResource into any state.
o getBlockStatus
(“Scheduler Name”, “Any value”, Type, Any value, Any value). Type can
be “length, “copy” and “stats”. Does not require Queue number or
Position. To learn the usage, click on getBlockStatus example.
o In the First-Come
First_Serve (FCFS) mode, the Data Structure is processed when it
reaches the head of the Queue.
o In the Round-Robin mode, the Data Structures in the Queue are
each allocated a finite piece (Round-Robin Time Slice) of the
processing time in each round. The RR scheduler will reduce a remaining
task time by the time slice till completed. RR schedulers do not use
priority.
In the
Scheduler_FCFS_NonBlocking, when the first data structure is sent on
the output, the next data structure can be delayed. There can be
multiple data structure between the output port and the Done block.
o User-Defined: Users can add additional algorithms to the block. The Scheduler logic must be written in Java and samples are provided in <VisualSim_Install>/VS_AR/User_Library/algorithms directory.
The latency across the SystemResource_Extend consists of the queuing time + internal processing time + external processing time. The processing time is computed in two ways:
If a Mapper Block sends Task_Time '10.0' anticipating "Number Clocks" block menu attribute, and the block menu attribute is "Relative Time", then one may not see any output till '10.0' seconds!
The Context_Switching time occurs every time there is a new Data Structure processed or a Data Structure is preempted or a preemption Data Structure returns. The "Task_Context_Switch_Time" is not applied to each RR time slice, rather at the completion of a RR task.
Features |
SystemResource |
SystemResource_Extend |
Preemption |
Yes |
No |
Hierarchical |
Yes |
No |
Extended Task Processing |
No |
Yes |
Non-Blocking | No | Yes |
The Scheduler blocks provide individual task timing and scheduler statistics. The user can enable this feature by checking the parameter called Add_Scheduler_Times_to_DS. This enables individual statistics to be added to each data structure processed by the Scheduler. The added fields include TIME_ACTIVATION, TIME_FINISH, TIME_IN_SCHEDULER, TIME_RELEASE and TIME_RESPONSE. These five fields complement the existing header field of a data structure called TIME, which contains the time the data structure was created, and appear together in the data structure.
TIME_RELEASE = TIME_ACTIVATION
If the scheduler is busy, and enqueued, and the Scheduler_Type is FCFS then:
TIME_RELEASE > TIME_ACTIVATION.
TIME_RESPONSE = TIME_FINISH - TIME_RELEASE
If the TIME_ACTIVATION and TIME_RELEASE timestamps are the same, then the TIME_IN_SCHEDULER and TIME_RESPONSE scheduler statistics are the same for the scheduler. To learn more about the individual statistics in a model, view the Individual Statistics Example in the BDE.
If multiple SystemResource exist in the model and Add_Scheduler_Times_to_DS is checked in multiple schedulers, then the user must process the added scheduler statistics after each scheduler completes execution by transferring the values to other data structure fields, or to unique model memories.
The statistics for the Scheduler
are generated using the getBlockStatus RegEx function. This
function can be called in either the Virtual_Machine, Processing or
Decision blocks.
Statistics_A = getBlockStatus(Scheduler_Name,"Any Value","stats",1,"Any
Value") -> To get the statistics
Reset_Stats_A = getBlockStatus(Scheduler_Name,"Any
Value","stats",-1,"Any Value") -> To reset the statistics
There is a pre-created statistics Generator block called
Results/Resource_Statistics/Resource_Statistics_Report and is used in
the Resource_Statistics Example in the BDE.
View the SystemResource_Extend Example in the BDE to see the plotting.
Statistics Output
Statistic Name |
Value |
Explanation |
Mathematical Equation |
Type |
Number_Entered |
100 |
Number of transactions entering the queue. |
- |
int |
Number_Exited |
25 |
Number of transactions that left the queue. |
- |
int |
Number_Rejected |
10 |
Number of transactions rejected and output to reject port. |
- |
int |
Queue_Number |
1 |
Queue Number. Value will be 1. |
- |
int |
Occupancy_Min |
4.0 |
Minimum queue size during the simulation. |
// Obtain Min for X, where X0 = Double.MAX_VALUE if (Xn < Xn – 1) Xmin = Xn |
double |
Occupancy_Mean |
8.0 |
Mean/Average queue size during the simulation |
// Obtain Mean for X Xµ = (1 / n) * (X1 + X2 + … + Xn) |
double |
Occupancy_StDev |
3.0 |
Standard Deviation from the Mean queue size during the simulation. |
// Obtain Standard Deviation for X |
double |
Occupancy_Max |
25.0 |
Maximum queue size consumed during the simulation. |
// Obtain Max for X, where X0 = Double.MIN_VALUE if (Xn > Xn – 1) Xmax = Xn |
double |
Total_Delay_Min |
1.3 |
In seconds. Least time through the queue+server among all transactions. |
// Obtain Min for X, where X0 = Double.MAX_VALUE if (Xn < Xn – 1) Xmin = Xn |
double |
Total_Delay_Mean |
1.3 |
In seconds. Mean/Average time through the queue+server among all transactions. |
// Obtain Mean for X Xµ = (1 / n) * (X1 + X2 + … + Xn) |
double |
Total_Delay_StDev |
1.3 |
In seconds. Standard Deviation from the Mean time through the queue+server among all transactions. |
// Obtain Standard Deviation for X |
double |
Total_Delay_Max |
1.3 |
In seconds. Maximum time through the queue+server among all transactions. |
// Obtain Max for X, where X0 = Double.MIN_VALUE if (Xn > Xn – 1) Xmax = Xn |
double |
Utilization_Pct_Mean |
0.0 |
Mean/Average utilization of the server portion only. Queue utilization not considered. Unit is in percentage. |
// Obtain Mean for X Xµ = (1 / n) * (X1 + X2 + … + Xn) |
double |
Where n is the number of samples and X is occupancy or delay.
Parameter |
Explanation |
Type |
Example |
Resource_Name |
Resource_Name is used by Mapper blocks, RegEx and child SystemResource to call this SystemResource. |
String |
"Resource_Name" |
Task_Context_Switch_Time |
It is used to model the time to switch between one scheduler task and the next task. If the value is greater than 0.0, and there is a waiting task, it is added to the starting task. In RR mode, applied after task completes. If hiearchical schedulers, then lower level scheduler (SystemResource) determines context switch time. |
Double |
0.0 |
Round_Robin_Time_Slice |
Quantum time to switch between tasks in Round Robin Scheduler, meaning the time the scheduler will devote to each task incrementally till it completes in the scheduler. If the "Task_Context_Switch_Time" is greater than zero, then it will also be added between round robin tasks. If there is only one task executing, then there will be no "Task_Context_Switch_Time" time added. |
Double |
0.1 |
Clock_Rate_Mhz |
It is used to model delays, only if the Time_Type is 'Number_Clocks'. Scheduler delay is 'Number_Clocks' divided by Clock_Rate_Mhz times 1000000.0 (clock cycle time). |
Double |
500.0 |
Max_Scheduler_Length |
It is in terms of individual tasks. If the scheduler length is exceeded, then an exception will be generated. |
Integer |
30 |
Time_Type |
'Relative_Time' mode can be used for estimating prototype tasks, or partially defined software tasks. |
Double |
Relative_Type |
Scheduler_Type |
'Scheduler_FCFS' is a first-come- first-serve scheduler that supports priority. However it does not preempt the executing task if a higher priority task arrives before a lower priority task completes. 'Scheduler_RR' schedules tasks to complete in a round-robin fashion, using the 'Round_Robin_Time_Slice' parameter, if there is more than one task in the scheduler. 'Scheduler_FCFS_NonBlocking'
is used when the SystemResource must operate in a non-blocking mode.
This means multiple Data Structures can be executing betwene the output
and the Done block. |
- |
Scheduler_FCFS |
Add_Scheduler_Times_to_DS |
Add_Scheduler_Times_to_DS turns on or off the request for individual statistics. |
- |
- |
Port |
Explanation |
task_output |
This port receives the data structure after the internal processing time has elapsed. |
task_plot |
Output port sending SystemResource task plot information. One typically connects this port to a TimedPlotter block. See Plot_Type below for menu attribute setting for plots. If the Mapper has a Task_Number = Task_Number_Fld_Int_Dbl_Expr or default, then the Task_number =1 for that Mapper. |
Created with the Personal Edition of HelpNDoc: Easily create Help documents