Simulation
Simulation
Simulation
kr
DISCRETE-EVENT
SYSTEM
SIMULATION
Third Edition
Simulation
the imitation of the operation of a real-world process or system over time
to develop a set of assumptions of mathematical, logical, and symbolic relationship
between the entities of interest, of the system.
to estimate the measures of performance of the system with the simulation-
generated data
Simulation enables the study of, and experimentation with, the internal
interactions of a complex system, or of a subsystem within a complex
system.
Informational, organizational, and environmental changes can be simulated,
and the effect of these alterations on the model’s behavior can be
observed.
The knowledge gained in designing a simulation model may be of great value
toward suggesting improvement in the system under investigation.
By changing simulation inputs and observing the resulting outputs, valuable
insight may be obtained into which variables are most important and how
variables interact.
Simulation can be used as a pedagogical device to reinforce analytic
solution methodologies.
1.1 When Simulation is the Appropriate Tool (2)
http://tolerance.ajou.ac.kr
Advantages
New polices, operating procedures, decision rules, information flows, organizational
procedures, and so on can be explored without disrupting ongoing operations of
the real system.
New hardware designs, physical layouts, transportation systems, and so on, can
be tested without committing resources for their acquisition.
Hypotheses about how or why certain phenomena occur can be tested for
feasibility.
Insight can be obtained about the interaction of variables.
Insight can be obtained about the importance of variables to the performance of
the system.
Bottleneck analysis can be performed indicating where work-in-process,
information, materials, and so on are being excessively delayed.
A simulation study can help in understanding how the system operates rather
than how individuals think the system operates.
“What-if” questions can be answered. This is particularly useful in the design of
new system.
1.3 Advantages and Disadvantages of Simulation (2)
http://tolerance.ajou.ac.kr
Disadvantages
Model building requires special training. It is an art that is learned over time and
through experience. Furthermore, if two models are constructed by two
competent individuals, they may have similarities, but it is highly unlikely that
they will be the same.
Simulation results may be difficult to interpret. Since most simulation outputs
are essentially random variables (they are usually based on random inputs), it
may be hard to determine whether an observation is a result of system
interrelationships or randomness.
Simulation modeling and analysis can be time consuming and expensive.
Skimping on resources for modeling and analysis may result in a simulation
model or analysis that is not sufficient for the task.
Simulation is used in some cases when an analytical solution is possible, or even
preferable, as discussed in Section 1.2. This might be particularly true in the
simulation of some waiting lines where closed-form queueing models are
available.
1.4 Areas of Application (1)
http://tolerance.ajou.ac.kr
System
defined as a group of objects that are joined together in some regular
interaction or interdependence toward the accomplishment of some
purpose.
System Environment
changes occurring outside the system.
Model
a representation of a system for the purpose of studying the system
a simplification of the system
sufficiently detailed to permit valid conclusions to be drawn about the
real system
1.9 Types of Models
http://tolerance.ajou.ac.kr
Problem formulation
Policy maker/Analyst understand and agree with the formulation.
Setting of objectives and overall project plan
Model conceptualization
The art of modeling is enhanced by an ability to abstract the essential
features of a problem, to select and modify basic assumptions that
characterize the system, and then to enrich and elaborate the model
until a useful approximation results.
Data collection
As the complexity of the model changes, the required data elements
may also change.
Model translation
GPSS/HTM or special-purpose simulation software
1.11 Steps in a Simulation Study (2)
http://tolerance.ajou.ac.kr
Verified?
Is the computer program performing properly?
Debugging for correct input parameters and logical structure
Validated?
The determination that a model is an accurate representation of the
real system.
Validation is achieved through the calibration of the model
Experimental design
The decision on the length of the initialization period, the length of
simulation runs, and the number of replications to be made of each run.
Production runs and analysis
To estimate measures of performances
1.11 Steps in a Simulation Study (3)
http://tolerance.ajou.ac.kr
More runs?
Documentation and reporting
Program documentation : for the relationships between input
parameters and output measures of performance, and for a
modification
Progress documentation : the history of a simulation, a chronology of
work done and decision made.
Implementation
1.11 Steps in a Simulation Study (4)
http://tolerance.ajou.ac.kr
For each repetition i, generate a value for each of the p inputs, and
evaluate the function, calculating a value of the response yi. The input
values may be computed by sampling values from the distributions
determined in step 1. A response typically depends on the inputs and
one or more previous responses.
http://tolerance.ajou.ac.kr
Inputs Response
1
2
·
·
n
2.1 Simulation of Queueing Systems (1)
http://tolerance.ajou.ac.kr
Server
Waiting Line
Calling population
In some systems, the condition about arrival rate being less than
service rate may not guarantee stability
2.1 Simulation of Queueing Systems (4)
http://tolerance.ajou.ac.kr
System state : the number of units in the system and the status of
the server(busy or idle).
Departure
Event
Arrival
Event
The interarrival times and service times must be meshed to simulate the
single-channel queueing system.
Table 2.4 was designed specifically for a single-channel queue which serves
customers on a first-in, first-out (FIFO) basis.
2.1 Simulation of Queueing Systems (12)
http://tolerance.ajou.ac.kr
A rrival D ep arture
C hecko ut C o unter
Assumptions
• Only one checkout counter.
• Customers arrive at this checkout counter at random from 1 to 8 minutes
apart. Each possible value of interarrival time has the same probability of
occurrence, as shown in Table 2.6.
• The service times vary from 1 to 6 minutes with the probabilities shown in
Table 2.7.
• The problem is to analyze the system by simulating the arrival and service
of 20 customers.
2.1 Simulation of Queueing Systems (15)
http://tolerance.ajou.ac.kr
2.1 Simulation of Queueing Systems (16)
http://tolerance.ajou.ac.kr
This result can be compared with the expected service time by finding the mean
of the service-time distribution using the equation in table 2.7.
E ( S ) sp ( s )
s 0
The expected service time is slightly lower than the average service time in the
simulation. The longer the simulation, the closer the average will be to
E (S )
2.1 Simulation of Queueing Systems (22)
http://tolerance.ajou.ac.kr
a b 1 8
E ( A) 4.5 (min)
2 2
The longer the simulation, the closer the average will be to E ( A)
average time customer spends in the system = 2.8 + 3.4 = 6.2 (min)
2.1 Simulation of Queueing Systems (24)
http://tolerance.ajou.ac.kr
A b le
B aker
A drive-in restaurant where carhops take orders and bring food to the car.
Assumptions
• Cars arrive in the manner shown in Table 2.11.
• Two carhops Able and Baker - Able is better able to do the job and works a bit
faster than Baker.
• The distribution of their service times is shown in Tables 2.12 and 2.13.
2.1 Simulation of Queueing Systems (25)
http://tolerance.ajou.ac.kr
After the first customer, the cells for the other customers must be based on
logic and formulas. For example, the “Clock Time of Arrival” (column D) in the
row for the second customer is computed as follows:
D2 = D1 + C2
The logic to computer who gets a given customer can use the Excel macro
function IF(), which returns one of two values depending on whether a condition
is true or false.
IF( condition, value if true, value if false)
http://tolerance.ajou.ac.kr
clock = 0
Is there the service
Is it time of arrival? Increment clock
completed?
No No
Yes
Yes
Store clock time (column H or K)
Generate random digit for
Is Able idle?
service (column E)
Yes
Convert random digit to random
number for service time
(column G)
No
Able service begin (column F)
Generate random digit for
Is Baker idle?
service (column E)
Yes
Convert random digit to random
No
number for service time
(column J)
Nothing Baker service begin (column I)
2.1 Simulation of Queueing Systems (27)
http://tolerance.ajou.ac.kr
If the first condition (Able idle when customer 10 arrives) is true, then the
customer begins immediately at the arrival time in D10. Otherwise, a second IF()
function is evaluated, which says if Baker is idle, put nothing (..) in the cell.
Otherwise, the function returns the time that Able or Baker becomes idle,
whichever is first [the minimum or MIN() of their respective completion times].
A similar formula applies to cell I10 for “Time Service Begins” for Baker.
2.1 Simulation of Queueing Systems (28)
http://tolerance.ajou.ac.kr
Baker was busy only 69% of the time. The seniority rule keeps Baker
less busy (and gives Able more tips).
Nine of the 26 arrivals (about 35%) had to wait. The average waiting
time for all customers was only about 0.42 minute (25 seconds), which
is very small.
Those nine who did have to wait only waited an average of 1.22
handle all the diners, and three servers would probably be too many.
Adding an additional server would surely reduce the waiting time to
nearly zero. However, the cost of waiting would have to be quite high to
justify an additional server.
2.2 Simulation of Inventory Systems (1)
http://tolerance.ajou.ac.kr
Notice that in the second cycle, the amount in inventory drops below zero,
indicating a shortage.
Two way to avoid shortages
Carrying stock in inventory
: cost - the interest paid on the funds borrowed to buy the items, renting of
storage space, hiring guards, and so on.
Making more frequent reviews, and consequently, more frequent purchases or
replenishments
: the ordering cost
The total cost of an inventory system is the measure of performance.
The decision maker can control the maximum inventory level, M, and the length of
the cycle, N.
In an (M,N) inventory system, the events that may occur are: the demand for
items in the inventory, the review of the inventory position, and the receipt of an
order at the end of each review period.
2.2 Simulation of Inventory Systems (3)
http://tolerance.ajou.ac.kr
M illing M achine
R ep airp erso n
A classic simulation
problem is that of a
squadron of bombers
attempting to destroy an
ammunition depot shaped
as shown in Figure 2.8.
2.3 Other Examples of Simulation (7)
http://tolerance.ajou.ac.kr
The examples illustrate the need for determining the characteristics of the
input data, generating random variables from the input models, and
analyzing the resulting response.
Ch. 3 General Principles
http://tolerance.ajou.ac.kr
Discrete-event simulation
The basic building blocks of all discrete-event simulation models
: entities and attributes, activities and events.
A system is modeled in terms of
its state at each point in time
the entities that pass through the system and the entities that represent
system resources
the activities and events that cause system state to change.
Event notice
A delay's duration
Not specified by the modeler ahead of time, But rather determined by system
conditions.
Quite often, a delay's duration is measured and is one of the desired outputs of
a model run.
H o w lo ng to w ait?
Delay Activity
A discrete-event simulation
: the modeling over time of a system all of whose state changes occur
at discrete points in time-those points when an event occurs.
The mechanism for advancing simulation time and guaranteeing that all
events occur in correct chronological order is based on the future event
list (FEL).
Future Event List (FEL)
to contain all event notices for events that have been scheduled to occur at a
future time.
to be ordered by event time, meaning that the events are arranged
chronologically; that is, the event times satisfy
t t1 t 2 tn
current value of Imminent event
simulated time
Scheduling a future event means that at the instant an activity begins, its
duration is computed or drawn as a sample from a statistical distribution
and the end-activity event, together with its event time, is placed on the
future event list.
http://tolerance.ajou.ac.kr
3.1.1. The Event-Scheduling/Time-Advanced Algorithm (2)
http://tolerance.ajou.ac.kr
the addition of a new event to the list, and occasionally removal of some event
(called cancellation of an event)
: Addition of a new event (and cancellation of an old event) requires a
search of the list.
The efficiency of this search depends on the logical organization of the list
and on how the search is conducted.
The removal and addition of events from the FEL is illustrated in Figure 3.2.
3.1.1. The Event-Scheduling/Time-Advanced Algorithm (3)
http://tolerance.ajou.ac.kr
The system snapshot at time 0 is defined by the initial conditions and the
generation of the so-called exogenous events.
Every simulation must have a stopping event, here called E, which defines
how long the simulation will run.
World views
: the event-scheduling world view, the process-interaction world view, and the
activity-scanning world view.
Phase A : Remove the imminent event from the FEL and advance the clock
to its event time. Remove any other events from the FEL that
have the same event time.
Phase B : Execute all B-type events that were removed from the FEL.
Phase C : Scan the conditions that trigger each C-type activity and
activate any whose conditions are met. Rescan until no
additional C-type activities can begin or events occur.
3.1.2. World Views (5)
http://tolerance.ajou.ac.kr
Activity Condition
The effect of the arrival and departure events was first shown in
Figures 2.2 and 2.3 and is shown in more detail in Figures 3.5 and 3.6.
http://tolerance.ajou.ac.kr
http://tolerance.ajou.ac.kr
3.1.3. Manual Simulation Using Event Scheduling (3)
http://tolerance.ajou.ac.kr
Initial conditions
the system snapshot at time zero (CLOCK = 0)
LQ(0) = 0, LS(0) = 1
both a departure event and arrival event on the FEL.
The simulation is scheduled to stop at time 60.
Server utilization : total server busy time (B) / total time (TE).
a* : the generated interarrival time
s* : the generated service times
The simulation in Table 3.1 covers the time interval [0, 21].
3.1.3. Manual Simulation Using Event Scheduling (4)
http://tolerance.ajou.ac.kr
3.1.3. Manual Simulation Using Event Scheduling (5)
http://tolerance.ajou.ac.kr
Traveling
Loading
Scale
Loader Weighing
queue queue
First-Come
First-Come First-Served
First-Served
The distributions of loading time, weighing time, and travel time are given in
Tables 3.3, 3.4, and 3.5, respectively, from Table A.1.
The purpose of the simulation is to estimate the loader and scale utilizations
(percentage of time busy).
3.1.3. Manual Simulation Using Event Scheduling (9)
http://tolerance.ajou.ac.kr
It has been assumed that five of the trucks are at the loaders and one
is at the scale at time 0.
49 / 2
average loader utilization 0.32
76
76
average scale utilization 1.00
76
These estimates cannot be regarded as accurate estimates of the long-
run “steady-state” utilizations of the loader and scale.
Head Pointer
Memory address 100 101 102 103 104 105 106 107 108 109 110
1 2 3 4 5 7 8 9 10
adding
6
100 101 102 103 104 105 106 107 108 109 110
1 2 3 4 5 6 7 8 9 10
a variable called a head pointer, with name headptr, points to the record at the
top of the list.
3.2.2 Using Arrays for List Processing (3)
http://tolerance.ajou.ac.kr
Example 3.7 (A List for the Dump Trucks at the Weigh Queue)
In Example 3.5, suppose that a waiting line of three dump trucks
occurred at the weigh queue, at CLOCK time 10 in Table 3.6.
Suppose further that the model is tracking one attribute of each dump
truck, its arrival time at the weigh queue, updated each time it arrives.
headptr = 3
R(3) = [DT3, 5.0, 2]
R(2) = [DT2, 10.0, 4]
R(4) = [DT4, 10.0, 0]
tailptr = 4
3.2.2 Using Arrays for List Processing (6)
http://tolerance.ajou.ac.kr
At CLOCK time 12, dump truck DT 3 begins weighing and thus leaves
the weigh queue.
headptr = 2
At CLOCK time 20, dump truck DT 5 arrives to the weigh queue and
joins the rear of the queue.
tailptr = 5
3.2.3 Using Dynamic Allocation and Linked Lists (1)
http://tolerance.ajou.ac.kr
If for some reason we wanted the third item on the list, we would
have to traverse the list, counting items until we reached the third
record.
Example 3.8 (The Future Event List and the Dump Truck Problem)
Based on Table 3.6, event notices in the dump truck problem of
Example 3.5 are expanded to include a pointer to the next event notice
on the future event list and can be represented by:
[ event type, event time, DT i , nextptr ]
as, for example,
[ EL, 10, DT 3, nextptr ]
where EL is the end loading event to occur at future time 10 for dump
truck DT 3, and the _eld nextptr points to the next record on the FEL.
Figure 3.9 represents the future event list at CLOCK time 10 taken
from Table 3.6.
3.2.3 Using Dynamic Allocation and Linked Lists (4)
http://tolerance.ajou.ac.kr
headptr
1 2 … 49 50
51 52 … 99 100
80 where to add?
http://tolerance.ajou.ac.kr
Historical period
1955 – 60 The Period of Search
1961- 65 The Advent
1966 – 70 The formative Period
1971 – 78 The Expansion Period
1979 – 86 The Period of Consolidation and
Regeneration
1987 - The Period of Integrated Environments
4.1 History of Simulation Software
http://tolerance.ajou.ac.kr
THE ART OF
COMPUTER
SYSTEMS
PERFORMANCE
ANALYSIS
Raj Jain
http://tolerance.ajou.ac.kr
Part 1 An Overview
of Performance Evaluation
Ch. 1 Introduction
Ch. 2 Common Mistakes and How to Avoid Them
Ch. 3 Selection of Techniques and Metrics
CH. 1 INTRODUCTION
http://tolerance.ajou.ac.kr
Workload Characterization
Ex. (1.3) The number of packets lost on two links was measured for four
file sizes as shown in Table 1.1. Which link is better?
Ex. (1.4) The performance of a system depends on the following three factors
(a) Garbage collection technique used: G1, G2, or none.
(b) Type of workload: editing, computing, or artificial intelligence (AI).
(c) Type of CPU: C1, C2, or C3
How many experiments are needed? How does one estimate the
performance impact of each factor?
1.1 Outline of Topics (6)
http://tolerance.ajou.ac.kr
Example 1.7
The throughputs of two systems A and B were measured in
transactions per second.
The results are shown in Table 1.2
A 20 10
B 10 20
ACM SIGMETRICS
: for researchers engaged in developing methodologies and user
seeking new or improved techniques for analysis of computer
systems
ACM SIGSIM
: Special Interest Group on SIMulation – Simulation Digest
CMG
: Computer Measurement Group, Inc. – CMG Transactions
1.3 Professional Organizations,
Journals, and Conferences (2)
http://tolerance.ajou.ac.kr
SIAM
: SIAM Review, SIAM Journal on Control &Optimization, SIAM Journal
on Numerical Analysis, SIAM Journal on Computing, SIAM Journal
on Scientific and Statistical Computing, and Theory of Probability &
Its Applications
1.3 Professional Organizations,
Journals, and Conferences (3)
http://tolerance.ajou.ac.kr
ORSA
: Operations Research, ORSA Journal on Computing, Mathematics
of Operations Research, Operations Research Letters, and
Stochastic Models
No goals
Any endeavor without goals is bound to fail.
Each model must be developed with a particular goal in mind.
The metrics, workloads, and methodology all depend upon the goal.
W hat g o als?
G eneral- p urp o se
m o d el
P articular m o d el
2.1 Common Mistakes in
Performance Evaluation (2)
http://tolerance.ajou.ac.kr
Biased Goals
The stating the goals becomes that of finding the right metrics
and workloads for comparing the two systems, not that of
finding the metrics and workloads such that our system turns
out better.
Pick up as
my likes
Parameter A Metric B
Workload C Factor D
2.1 Common Mistakes in
Performance Evaluation (4)
http://tolerance.ajou.ac.kr
Model A
Final
results
Model B
2.1 Common Mistakes in
Performance Evaluation (5)
http://tolerance.ajou.ac.kr
Compare MIPS
Unrepresentative Workload
The workload used to compare two systems should be
representative of the actual usage of the systems in the field.
The choice of the workload has a significant impact on the
results of a performance study.
Network
Measurement
Analytical
Simulation Modeling
2.1 Common Mistakes in
Performance Evaluation (8)
http://tolerance.ajou.ac.kr
No Analysis
One of the common problems with measurement projects is
that they are often run by performance analysts who are good
in measurement techniques but lack data analysis expertise.
They collect enormous amounts of data but do not know to
analyze or interpret it.
Erroneous Analysis
There are a number of mistakes analysts commonly make in
measurement, simulation, and analytical modeling, for example,
taking the average of ratios and too short simulations.
Simulation time
2.1 Common Mistakes in
Performance Evaluation (14) http://tolerance.ajou.ac.kr
No Sensitivity Analysis
Often analysts put too much emphasis on the results of their
analysis, presenting it as fact rather than evidence.
Without a sensitivity analysis, one cannot be sure if the
conclusions would change if the analysis was done in a slightly
different setting.
Without a sensitivity analysis, it is difficult to access the relative
importance of various parameters.
2.1 Common Mistakes in
Performance Evaluation (15)
http://tolerance.ajou.ac.kr
Packet 512
octects
Transmit Receive
buffer buffer
2.1 Common Mistakes in
Performance Evaluation (16)
http://tolerance.ajou.ac.kr
Ignoring Variability
It is common to analyze only the mean performance since
determining variability is often difficult, if not impossible.
If the variability is high, the mean alone may be misleading to
the decision makers.
Load
demand Weekly Mean
= 80
Not useful
Decision Analyst
maker
2.1 Common Mistakes in
Performance Evaluation (20)
http://tolerance.ajou.ac.kr
I’m analyst.
Let’s explain the Words, pictures, and graphs
results of the
analysis
2.1 Common Mistakes in
Performance Evaluation (21)
http://tolerance.ajou.ac.kr
Dual CPU
System
Timesharing system Different ALU system
Select Metrics
Select criteria to compare the performance.
Choose the metrics(criteria).
In general, the metrics are related to the speed, accuracy, and
availability of services.
The performance of a network
: the speed(throughput, delay), accuracy(error rate), and
availability of the packets sent.
The performance of a processor
: the speed of (time taken to execute) various instructions
2.2 A Systematic Approach to
Performance Evaluation (4)
http://tolerance.ajou.ac.kr
List Parameters
Make a list of all the parameters that affect performance.
The list can be divided into system parameters and workload
parameters.
System parameters
: Hardware/Software parameters
: These generally do not vary among various installations of the
system.
Workload parameters
: Characteristics of user’s requests
: These vary form one installation to the next.
2.2 A Systematic Approach to
Performance Evaluation (5)
http://tolerance.ajou.ac.kr
Select Workload
The workload consists of a list of service requests to the system.
For analytical modeling, the workload is usually expressed as a
probability of various requests.
For simulation, one could use a trace of requests measured on
a real system.
For measurement, the workload may consist of user scripts to
be executed on the systems.
To produce representative workloads, one needs to measure
and characterize the workload on existing systems.
2.2 A Systematic Approach to
Performance Evaluation (8)
http://tolerance.ajou.ac.kr
Design Experiments
Once you have a list of factors and their levels, you need to
decide on a sequence of experiments that offer maximum
information with minimal effort.
In first phase, the number of factors may be large but the
number of levels is small. The goal is to determine the relative
effect of various factors.
In second phase, the number of factors is reduced and the
number of levels of those factors that have significant impact
is increased.
2.2 A Systematic Approach to
Performance Evaluation (9)
http://tolerance.ajou.ac.kr
Present Results
It is important that the results be presented in a manner that is
easily understood.
This usually requires presenting the results in graphic form and
without statistical jargon.
The knowledge gained by the study may require the analysts to
go back and reconsider some of the decisions made in the
previous steps.
The complete project consists of several cycles through the
steps rather than a single sequential pass.
Case Study 2.1 (1)
http://tolerance.ajou.ac.kr
System Definition
Goal : to compare the performance of applications using
remote pipes to those of similar applications using
remote procedure calls.
Key component : Channel (either a procedure or a pipe)
System
Case Study 2.1 (3)
http://tolerance.ajou.ac.kr
Services
Two types of channel calls
: remoter procedure call and remote pipe
The resources used by the channel calls depend upon the
number of parameters passed and the action required on those
parameters.
Data transfer is chosen as the application and the calls will be
classified simply as small or large depending upon the amount
of data to be transferred to the remote machine.
The system offers only two services
: small data transfer or large data transfer
Case Study 2.1 (4)
http://tolerance.ajou.ac.kr
Metrics
Due to resource limitations, the errors and failures will not be
studied. Thus, the study will be limited to correct operation only.
Resources : local computer(client), the remote computer(server),
and the network link
Performance Metrics
- Elapsed time per call
- Maximum call rate per unit of time or equivalently, the time
required to complete a block of n successive calls
- Local CPU time per call
- Remote CPU time per call
- Number of bytes sent on the link per call
Case Study 2.1 (5)
http://tolerance.ajou.ac.kr
Parameters
System Parameter
Speed of the local CPU, the remote CPU, and the network
Operating system overhead for interfacing with the channels
Operating system overhead for interfacing with the networks
Reliability of the network affecting the number of retransmissions required
Workload Parameters
Time between successive calls
Number and sizes of the call parameters
Number and sizes of the results
Type of channel
Other loads on the local and remote CPUs
Other loads on the network
Case Study 2.1 (6)
http://tolerance.ajou.ac.kr
Factors
Type of channel
: Two type – remote pipes and remote procedure calls
Speed of the network
: Two locations of the remote hosts will be used – short distance(in the
campus) and long distance(across the country)
Sizes of the call parameters to be transferred
: Two levels will be used – small and large
Number n of consecutive calls
: Eleven different values of n – 1,2,4,8,16,32,,512,1024
All other parameters will be fixed.
The retransmissions due to network errors will be ignored.
Experiments will be conducted when there is very little other load on
the hosts and the network.
Case Study 2.1 (7)
http://tolerance.ajou.ac.kr
Evaluation Technique
Since prototypes of both types of channels have already been
implemented, measurements will be used for evaluation.
Analytical modeling will be used to justify the consistency of
measured values for different parameters.
Workload
A synthetic program generating the specified types of channel
requests
This program will also monitor the resources consumed and log
the measured results(using Null channel requests).
Case Study 2.1 (8)
http://tolerance.ajou.ac.kr
Experimental Design
A full factorial experimental design with 2311=88 experiments will be
used for the initial study.
Data Analysis
Analysis of variance will be used to quantify the effects of the first
three factors and regression will be used to quantify the effects of the
number n of successive calls.
Data Presentation
The final results will be plotted as a function of the block size n.
http://tolerance.ajou.ac.kr
Analytical
Criterion Modeling Simulation Measurement
Life-cycle stage
Measurement : only if something similar to the proposed
system already exists
Analytical modeling and Simulation : if it is a new concept
Level of accuracy
Analytical modeling requires so many simplifications and
assumptions that if the results turn out be accurate.
Simulations can incorporate more details and require less
assumptions than analytical modeling, and thus more often are
closer to reality.
Measurements may not give accurate results simply because
many of the environmental parameters, such as system
configuration, type of workload, and time of the measurement,
may be unique to the experiment. Thus, the accuracy of results
can vary from very high to none.
3.1 Selecting an Evaluation Technique (4)
http://tolerance.ajou.ac.kr
Trade-off evaluation
The goal of every performance study is either to compare
different alternatives or to find the optimal parameter value.
Analytical models provide the best insight into the effects of
various parameters and their interactions.
With simulations, it may be possible to search the space of
parameter values for the optimal combination, but often it is
not clear what the trade-off is among different parameters.
Measurement is the least desirable technique in this respect. It
is not easy to tell if the improved performance is a result of
some random change in environment or due to the particular
parameter setting.
3.1 Selecting an Evaluation Technique (5)
http://tolerance.ajou.ac.kr
Cost
Measurement requires real equipment, instruments, and time. It
is the most costly of the three techniques.
Cost, along with the ease of being able to change configurations, is
often the reason for developing simulations for expensive systems.
Analytical modeling requires only paper and pencils. Thus, It is the
cheapest alternative.
Saleability of results
The key justification when considering the expense and the
labor of measurements
Most people are skeptical of analytical results simply because
they do not understand the technique or the final result.
3.1 Selecting an Evaluation Technique (6)
http://tolerance.ajou.ac.kr
Tim e
(R esponse tim e)
D one R ate
correctly (Throughput)
D one R esource
(U tilization)
System
Probability
D one
Error j
incorrectly
Tim e betw een
errors
D uration
of the event
cannot do Event k
Time-rate-resource metrics
Response time: the delay inside the network for individual packets.
Throughput: the number of packets per unit of time.
Processor time per packet on the source end system.
Processor time per packet on the destination end systems.
Processor time per packet on the intermediate systems.
Case Study 3.1 (3)
http://tolerance.ajou.ac.kr
(i 1 xi ) 2
n
f ( x1 , x2 ,, xn )
ni 1 xi2
n
For all nonnegative values of xi’s, the fairness index always lies
between 0 and 1.
If only k of the n users receive equal throughput and the remaining n-k
users receive zero throughput, the fairness index is k/n.
Case Study 3.1 (5)
http://tolerance.ajou.ac.kr
Tim e
http://tolerance.ajou.ac.kr
R esp o nse tim e
Tim e
R eactio n Think
tim e tim e
R esp o nse
tim e
(D efinitio n 1)
R esp o nse
tim e
(D efinitio n 2)
N o m inal
cap acity http://tolerance.ajou.ac.kr
Thro ug hp ut
`
U sab le
K nee cap acity
cap acity
Lo ad
R esp o nse
tim e
`
Lo ad
3.3 Commonly Used Performance
Metrics (4)
http://tolerance.ajou.ac.kr
Idle time : the period during which a resource is not being used.
Reliability : the probability of errors or by the mean time between
errors.
Availability : the fraction of the time the system is available to
service user’s requests.
Downtime : the time during which the system is not available.
Uptime : the time during which the system is available(MTTF-Mean
Time To Failure).
Cost/performance ratio : a metric for comparing two or more
systems.
3.4 Utility Classification of
Performance Metrics
http://tolerance.ajou.ac.kr
U tility U tility
M etric M etric
U tility
B est
M etric
3.5 Setting Performance
Requirements (1)
http://tolerance.ajou.ac.kr
(a) The probability of any bit being in error must be less than 10 -7.
(b) The probability of any frame being in error (with error indication
set) must be less than 1%.
(c) The probability of a frame in error being delivered without error
indication must be less than 10-15.
(d) The probability of a frame being misdelivered due to an
undetected error in the destination address must be less than
10-18.
(e) The probability of a frame being delivered more than once
(duplicate) must be less than 10-5.
(f) The probability of losing a frame on the LAN (due to all sorts of
errors) must be less than 1%.
Case Study 3.2 (3)
http://tolerance.ajou.ac.kr
Availability : Two fault modes were considered significant. The first was
the time lost due to the network reinitializations, and the
second was time lost due to permanent failures requiring
field service calls. The requirements for frequency and
duration of these fault modes were specified as follow:
(a) The mean time to initialize the LAN must be less than 15
milliseconds.
(b) The mean time between LAN initializations must be at least 1
minute.
(c) The mean time to repair a LAN must be less than 1 hour. (LAN
partitions may be operational during this period.)
(d) The mean time between LAN partitioning must be at least half a
week.
http://tolerance.ajou.ac.kr
정지영
목차
http://tolerance.ajou.ac.kr
1. 개요
2. 다중프로세서 시스템
3. 근사 분석 모델
4. 시뮬레이션 모델
5. 분석 모델과 시뮬레이션 모델 결과
6. 다중프로세서 시스템 모델의 확장
1. 개요
http://tolerance.ajou.ac.kr
시스템의 분석적 모델 개발
기억장치
1 2 M
버스 1
2
1 2 N
처리장치
멀티프로세서 시스템 요소
2. 다중프로세서 시스템
http://tolerance.ajou.ac.kr
메모리 요청 처리
1. 프로세서는 머신 싸이클이 시작될 때 메모리 요청을 초기화하
는 동시에 실행을 일시 정지 시킨다. 동일 모듈에 대한 다중 요
청은 중재 메커니즘에 의해 해결한다.
시스템 대역폭(BW)
프로세서와 메모리 사이의 전체 전송률로 단위 시간당 전송
의 관점으로 표현
전송 시간이 1싸이클이기 때문에 전체 버스 활용은 BW와 같
고 BW는 종종 사용중인 버스의 평균 수로서 정의
q 1 (1 p / M ) N (식5.1)
메모리 요청확률이 동일하고 독립적이라고 가정하면, M개의 메
모리 중 i번째를 요청할 확률 fi는 이항분포이다.
M i
fi q (1 q) M i (식5.2)
i
한 싸이클에서 승인되는 버스 요청의 기대값
M B 1
BW B fi i fi (식5.3)
iB i 1
3. 근사 분석 모델
http://tolerance.ajou.ac.kr
실행 블럭된 요청 승인된 요청
x b 1
단일 프로세서 요청률
r=(b+1)/T = (b+1)/(x+b+1)
분모와 분자를 b+1로 나누면
r=1/[1+x/(b+1)]
b+1=rT : T 동안에 발생된 요청의 전체 횟수
프로세서당 요청완료율: BW/N
T=N/BW
b+1=Nr/BW
r= 1/[1+xBW/Nr]
3. 근사 분석 모델
http://tolerance.ajou.ac.kr
e=0.005인 경우 C 알고리즘
real BW(p,B,M,n)
real p; intB, M, N;
{
real bw0, bw1=p*N, r=p, x=1.0/p-1.0, Bwi();
do
{
bw0 = bw1; r=1.0/(1.0+x*bw0/(N*r));
bw1=BWi(r,B,M,N);
}
while (fabs(bw1-bw0) > 0.005);
return(bw1);
}
3. 근사 분석 모델
http://tolerance.ajou.ac.kr
real Fact(n)
int n;
{ /* compute n factorial */
real z=1.0;
while (n) {z*=n; n--;}
return (z);
}
3. 근사 분석 모델
http://tolerance.ajou.ac.kr
real C(n,k)
int n,k;
{ /* compute binomial coefficient */
return (Fact (n)/Fact(k) * Fact(n-k)));
}
real f(i,M,q)
int i, M; real q;
{ /* compute binomial probability */
real z;
z=C(M,i)*pow(q,(real)i)*pow(1.0-q,(real)(M-i));
return(z);
}
3.1 활용과 대기시간
http://tolerance.ajou.ac.kr
b=(N/BW)-(1/p)
3.2 평균 큐 길이
http://tolerance.ajou.ac.kr
Lb=bBW / N
Lb=1-BW / Np
3.3 시스템 처리량
http://tolerance.ajou.ac.kr
#include <smpl.h>
#define busy 1
real
p=0.250, /* local memory miss rate */
treq[17] /* next request time for processor */
tn=1.0E6; /* earliest-occurring request time */
int
N=8, M=4, nB=2, /* no. processors, memories, & buses */
modole[17],bus, /* memory & bus facility descriptors */
nbs=0, /* no. busy buses current cycle */
req[17], /* currently-requested memory module */
next=1, /* arbitration scan starting point */
4.1 시뮬레이션 모델 1
http://tolerance.ajou.ac.kr
메모리
프로세서 메모리큐 버스
1 1 1
2 2 2
해제
N M N
예약
다중프로세서 시스템 큐잉 모델 다이어그램
4.2 시뮬레이션 모델 2
http://tolerance.ajou.ac.kr
#include <smpl.h>
#define queued 1
real p=0.250; /* local memory 비적중율 */
int N=8, M=4, nB=2, /* no. processors, memories, & buses */
module[17], /* facility descroptors for modules */
bus, /* focility descriptors for buses */
req[17]; /* currently-requested memory module */
4.3 시뮬레이션 모델 3
http://tolerance.ajou.ac.kr
main()
{
int event, I, n; real x=1.0/p-1.0;
smpl(0,”Bandwidth Model”) ;
bus=facility(“bus”,nB) ;
for(i=1; i<=M, i++) module[i]=facility(“module”,1);
for(n=1; n<=N; n++) {
req[n]=random(1,M); schedule(1, expntl(x),n; )
}
4.3 시뮬레이션 모델 3
http://tolerance.ajou.ac.kr
while (time()<10000.0) {
cause(&event,&n);
switch(event) {
case 1:
if (request(module[req[n]], n, 0)!=queued)
then schedule(2, 0.0, n); break;
case 2: /* reserve bus & initiate transfer */
if (request(bus, n, 0) !=queued) then
schedule(3, 1.0, n); break;
case 3: /* complete: schedule next request */
release(bus, n);
release(module[req[n]], n);
req[n]=random(1, M);
schedule(1,espntl(x), n); break;
}
}/* end-while */
report();
}/* end-main */
5. 분석 모델과 시뮬레이션 모델 결과
http://tolerance.ajou.ac.kr
일정하지 않은 요청률
중앙 및 입출력 프로세서의 혼합과 같은 다른 요청률을 가진
서로 다른 프로세서 타입으로 구성된 시스템을 모델링하기를
원할 수 있다.
다양한 전송 길이
요청당 하나의 단위의 전송을 가정했었다. 이것을 요청당 여
러 단위가 전송될 수 있도록 확장시키길 원할 수 있다.
정지영
1. Introduction
http://tolerance.ajou.ac.kr
1.1 변수(Variable)
문자(letter), 숫자(digit), 마침표(period)를 조합해 만든다. 대소
문자의 구별은 없다.
example :
read x and y
add x to y
print 1 line with y thus
The sum is : ***
1. Introduction
http://tolerance.ajou.ac.kr
1.8 프로그램 종료
stop 문은 프로그램을 논리적으로 끝내는 명령문이고,
end 문은 물리적으로 끝내는 명령문이다.
1.10 Routines
CALL routine name : routine을 호출할 때
RETURN은 call된 routine을 종료할 때 쓴다.
argument passing
- routine <name> given <argument> yielding <argument>
function을 사용하여 routine을 표현할 수가 있다.
preamble에서 "DEFINE name AS mode function"으로 정의
하 고 return value 는 function 내 에 서 "RETURN WITH
arithmetic expression"으로 한다.
example : function Absolute(Number)
...
return with Number
end
1. Introduction
http://tolerance.ajou.ac.kr
Model Structure
시뮬레이션을 하는 모델은 다음의 구성요소를 가져야 한다.
1) 새로운 객체의 도착을 표현하는 메카니즘
2) 모델된 시스템 안에서 그 객체에서 일어나는 일의 표현
3) 시뮬레이션을 종료시키는 메카니즘
Process Concept
프로세스는 모델 안에서 시뮬레이션이 수행되는 시간동안 능동적
으로 행동하는 개체이다
2. Elementary modeling concept
http://tolerance.ajou.ac.kr
Resource Concept
자원(resource)은 모델 안에서 프로세스가 요구하는 일을 행하는 수동
적인 개체이다.
Program Structure
1) Preamble : C의 Header File과 유사하다.
2) Main program : 시뮬레이션이 수행되도록 하는 절차를 밟는 부
분이다. 시스템의 컨트롤이 Timing Routine으로 넘어가는 동작으
로 수행한다.
3) Process routine : preamble에서 선언된 process의 동작을 표현하
는 routine
Timing routine
Discrete-event simulation의 심장부로 모델 개발자에게 투명
예제: A Simple Gas Station Model
http://tolerance.ajou.ac.kr
[ Model 개요 ]
시뮬레이션에서 사용된 가정
PREAMBLE
PROCESSES INCLUDE GENERATOR AND CUSTOMER
RESOURCES INCLUDE ATTENDANT
ACCUMULATE AVG.QUEUE.LENGTH AS THE AVERAGE
MAIN
CREATE EVERY ATTENDANT(1)
LET U.ATTENDANT(1) = 2
ACTIVATE A GENERATOR NOW
START SIMULATION
PRINT 4 LINES WITH AVG.QUEUE.LENGTH(1),
MAX.QUEUE.LENGTH(1),
AND UTILIZATION(1) * 100. / 2 THUS
PROCESS GENERATOR
FOR I = 1 TO 1000,
DO
ACTIVATE A CUSTOMER NOW
WAIT UNIFORM.F(2.0,8.0,1) MINUTES
LOOP
END
PROCESS CUSTOMER
REQUEST 1 ATTENDANT(1)
WORK UNIFORM.F(5.0,15.0,2) MINUTES
RELINGQUISH 1 ATTENDANT(1)
END
3. Modeling Individual Objects
http://tolerance.ajou.ac.kr
1 2 3
U.Pump
N.X.Pump
N.Q.Pump
Grade
3. Modeling Individual Objects
http://tolerance.ajou.ac.kr
3.2 Variables
변수는 전역 또는 지역변수(default)로 될 수 있다. 전역변수는
Preamble에 정의된다.
모든 변수는 mode를 가지고 있다.(integer, real, alpha, text)
Background mode는 real이며 다음의 문장에 의해 변경된다.
NORMALLY, MODE IS mode
PREAMBLE
DEFINE .seconds TO MEAN days
DEFINE .milliseconds TO MEAN hours
DEFINE .microseconds TO MEAN minutes
END
MAIN
LET HOURS.V = 1000
LET MINUTES.V = 1000
END
예제: A Bank with a Separate Queue for Each Teller
http://tolerance.ajou.ac.kr
PREAMBLE
PROCESSES INCLUDE GENERATOR AND CUSTOMER
RESOURCES INCLUDE TELLER
MAIN
READ N.TELLER, MEAN.INTERARRIVAL.TIME, MEAN.SERVICE.TIME,
AND DAY.LENGTH
CREATE EVERY TELLER
FOR EACH TELLER,
LETU.TELLER(TELLER) = 1
PROCESS GENERATOR
DEFINE ARRIVAL.TIME AS A REAL VARIABLE
LET TIME.TO.CLOSE = DAY.LENGTH / HOURS.V
PROCESS CUSTOMER
DEFINE ARRIVAL.TIME AS A REAL VARIABLE
DEFINE MY.CHOICE AS A INTEGER VARIABLE
LET ARRIVAL.TIME = TIME.V
FOR EACH TRELLER, WITH N.X.TELLER(TELLER) = 0,
FIND THE FIRST CASE
IF FOUND,
LET MY.CHOICE = TELLER
ELSE
FOR EACH TELLER,
COMPUTE MY.CHOICE AS THE MINIMUM(TELLER)
OF N.Q.TELLER(TELLER)
ALWAYS
REQUEST 1 TELLER(MY.CHOICE)
LET WAITING.TIME = TIME.V - ARRIVAL.TIME
WORK EXPONENTIAL.F(MEAN.SERVICE.TIME,2) MINUTES
RELINQUISH 1 TELLER(MY.CHOICE)
END
예제: A Bank with a Separate Queue for Each Teller
http://tolerance.ajou.ac.kr
[ 예제의 OUTPUT ]
SIMULATION OF A BANK WITH 2 TELLERS
(EACH WITH A SEPARATE QUEUE)
CUSTOMERS ARRIVE ACCORDING TO AN EXPONENTIAL DISTRIBUTION
OF INTER ARRIVAL TIMES WITH A MEAN OF 5.00 MINUTES.
SERVICE TIME IS ALSO EXPONENTIALLY DISTRIBUTED
WITH A MEAN OF 10.00 MINUTES.
THE BANK DOORS ARE CLOSED AFTER 8.00 HOURS.
(BUT ALL CUSTOMERS INSIDE ARE SERVED.)
THE LAST CUSTOMER LEFT THE BANK AT *.** HOURS.
THE AVERAGE CUSTOMER DELAY WAS *.** MINUTES.