>>> SOLUTIONS <<< Answer the following question regarding the basics of systems and performance modeling.

Similar documents
>>> SOLUTIONS <<< a) What is a system? Give a short formal definition. (Hint: what you draw a box around is not a formal definition)

Comprehensive Final Exam for Capacity Planning (CIS 4930/6930) Fall 2001 >>> SOLUTIONS <<<

>>> SOLUTIONS <<< Answer the following questions regarding the basics principles and concepts of networks.

>>> Assignment #4 for Simulation (CAP 4800) <<<

Introduction to CSIM. Outline

MATH : EXAM 3 INFO/LOGISTICS/ADVICE

ECE SPRING NOTE; This project has two parts which have different due dates.

User s Guide: CSIM19 Simulation Engine (C Version)

ETSN01 Exam. August 22nd am 1pm. Clearly label each page you hand in with your name and the page number in the bottom right hand corner.

Chapter 13: I/O Systems

Why is scheduling so difficult?

College Algebra Extra Credit Worksheet

Mean Value Analysis and Related Techniques

FORM 2 (Please put your name and form # on the scantron!!!!)

CS 450 Exam 2 Mon. 11/7/2016

Third Midterm Exam April 24, 2017 CS162 Operating Systems

Mean Value Analysis and Related Techniques

CSE332 Summer 2010: Final Exam

Probability Models.S4 Simulating Random Variables

What We ll Do... Random

CPS 110 Final Exam. Spring 2011

Probability and Statistics for Final Year Engineering Students

Chapter 6: Simulation Using Spread-Sheets (Excel)

Introduction to Queuing Systems

CS16 Exam #1 7/17/ Minutes 100 Points total

Resource Allocation Strategies for Multiple Job Classes

UNIT 4: QUEUEING MODELS

>>> Assignment #3 for Simulation (CAP 4800) <<<

Cover sheet for Assignment 3

CSIM19: A POWERFUL TOOL FOR BUILDING SYSTEM MODELS. Herb Schwetman. Mesquite Software, Inc. PO Box Austin, TX , USA

CPSC 531: System Modeling and Simulation. Carey Williamson Department of Computer Science University of Calgary Fall 2017

THIS IS NOT REPRESNTATIVE OF CURRENT CLASS MATERIAL. STOR 455 Midterm 1 September 28, 2010

Lecture: Simulation. of Manufacturing Systems. Sivakumar AI. Simulation. SMA6304 M2 ---Factory Planning and scheduling. Simulation - A Predictive Tool

DDSS: Dynamic Dedicated Servers Scheduling for Multi Priority Level Classes in Cloud Computing

CS 450 Exam 2 Mon. 4/11/2016

A Study of the Performance Tradeoffs of a Tape Archive

Numerical approach estimate

Discrete Mathematics and Probability Theory Spring 2017 Rao Midterm 2

Chapter 5. Minimization of Average Completion Time and Waiting Time in Cloud Computing Environment

Data 8 Final Review #1

Scientific Computing: An Introductory Survey

Experiment 1 Yahtzee or Validating the t-table

CS , Fall 2001 Exam 2

Midterm Exam #2 Solutions April 20, 2016 CS162 Operating Systems

Will Monroe July 21, with materials by Mehran Sahami and Chris Piech. Joint Distributions

Bootstrapping Methods

Practice Midterm Exam Solutions

VARIANCE REDUCTION TECHNIQUES IN MONTE CARLO SIMULATIONS K. Ming Leung

SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM

CS 2301 Exam 3 B-Term 2011

Introduction to Computer Science Midterm 3 Fall, Points

One Factor Experiments

Learning Objectives. Continuous Random Variables & The Normal Probability Distribution. Continuous Random Variable

Math 6 Long Range Plans Bill Willis. Strand: NUMBER Develop number sense. Textbook: Math Makes Sense 6

Section 10: Device Drivers, FAT, Queuing Theory, Memory Mapped Files

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Computer Science Foundation Exam. Dec. 19, 2003 COMPUTER SCIENCE I. Section I A. No Calculators! KEY

Computer Science Foundation Exam

CS551 Warm-up Project #2

CIS 110 Fall 2016 Introduction to Computer Programming 13 Oct 2016 Midterm Exam

Perfect Student CS 343 Final Exam May 19, 2011 Student ID: 9999 Exam ID: 9636 Instructions Use pencil, if you have one. For multiple choice

CS 351 Exam 1, Fall 2010

CS162 Operating Systems and Systems Programming Lecture 17. Disk Management and File Systems

Using Queuing theory the performance measures of cloud with infinite servers

Pair-Wise Multiple Comparisons (Simulation)

Queueing Theory. M/M/1 and M/M/m Queues

>>> SOLUTIONS <<< Answer the following questions regarding the basics of computer networks and the Internet.

Midterm 2. Friday, August 2, 5:10pm 7:10pm CS 70: Discrete Mathematics and Probability Theory, Summer 2013

Computational Methods. Randomness and Monte Carlo Methods

Queuing Systems. 1 Lecturer: Hawraa Sh. Modeling & Simulation- Lecture -4-21/10/2012

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Review. EECS 252 Graduate Computer Architecture. Lec 18 Storage. Introduction to Queueing Theory. Deriving Little s Law

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)

Midterm Exam 2B Answer key

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

Lecture 23: Storage Systems. Topics: disk access, bus design, evaluation metrics, RAID (Sections )

Computer Science Foundation Exam

Chapter 13: I/O Systems

Advanced Internet Technologies

Third Midterm Exam April 24, 2017 CS162 Operating Systems

Sections 4.3 and 4.4

Chapter 3 Analyzing Normal Quantitative Data

CIS 110 Introduction to Computer Programming Summer 2017 Final. Recitation # (e.g., 201):

The Memory Hierarchy 10/25/16

Simulation. Chapter Copyright 2010 Pearson Education, Inc. Publishing as Prentice Hall

Bootstrap confidence intervals Class 24, Jeremy Orloff and Jonathan Bloom

In the real world, light sources emit light particles, which travel in space, reflect at objects or scatter in volumetric media (potentially multiple

Computer System Architecture Quiz #2 April 5th, 2019

To earn the extra credit, one of the following has to hold true. Please circle and sign.

ACE Tutorial. October, 2013 Byoung K. Choi and Donghun Kang

Chapter 6 Normal Probability Distributions

C Functions. CS 2060 Week 4. Prof. Jonathan Ventura

CSE 332 Spring 2014: Midterm Exam (closed book, closed notes, no calculators)

CS 113 MIDTERM EXAM 2 SPRING 2013

Programming Assignment #3 Event Driven Simulation

Use of Extreme Value Statistics in Modeling Biometric Systems

CS162 Operating Systems and Systems Programming Lecture 17. Disk Management and File Systems

Learner Expectations UNIT 1: GRAPICAL AND NUMERIC REPRESENTATIONS OF DATA. Sept. Fathom Lab: Distributions and Best Methods of Display

CS , Fall 2001 Exam 2

adjacent angles Two angles in a plane which share a common vertex and a common side, but do not overlap. Angles 1 and 2 are adjacent angles.

Transcription:

Final Exam for Simulation (CIS 4930) Summer 009 >>> SOLUTIONS <<< Welcome to the Final Exam for Simulation (CIS 4930). Read each problem carefully. There are ten required problems (each worth 10 points). There is also an additional extra credit question worth 10 points. You may have with you a calculator, pencils and/or pens, erasers, blank paper, and one 8.5 x 11 inch formula sheet. On this formula sheet you may have anything you want (definitions, formulas, homework answers, old exam answers, etc.) as handwritten by you in pencil or ink on both sides of the sheet. Photocopies, scans, or computer generated and/or printed text are not allowed on this sheet. Note to tablet PC users you may not print-out your handwritten text for the formula sheet. You have 10 minutes for the exam. Please use a separate sheet of paper for the answer to each question. Good luck and be sure to show your work! A table of T scores is included in this exam for any problem that may ask you to calculate a confidence interval. Problem #1 pts for (a), pts for (b), 3 pts for (c), and 3 pts for (d). Answer the following question regarding the basics of systems and performance modeling. a) What is a system? A system is a set of interacting or interdependent entities forming an integrated whole. b) What is performance? Performance is the quantitative measure of a system. c) What is a model, what is the goal of a model, and why do we build models? A model is a representation (physical, logical, or functional) that mimics another object under study (Molly). The goal of a model is to predict some behavior of an actual object of system. Models are often cheaper, easier, faster, and safer than studying real systems. d) What is computer simulation? Computer simulation is the discipline of designing a model of an actual or theoretical physical system, executing the model on a computer, and analyzing the execution output. (Fishwick). Problem # pts for (a), pts for (b), 6 pts for (c) (1 pt for mean, 1 pt for variance and pts for each plot). Answer the following question regarding the basics of probability theory as they apply to performance modeling. a) What is the difference between a permutation and a combination? In a permutation order matters, in a combination order does not matter. b) What is a random variable? A random variable is a function that maps a real number to every possible outcome in the sample space.

c) Consider an unfair six-sided die where the probability of rolling a 1 is three times the probability of rolling any other value. All other values have the same probability of occurring. Let X be the random variable that takes on values 1 through 6 for our unfair die. Plot the pmf and CDF of X. Determine the mean of X. Pr[X = 1] = 0.375, Pr[X =, 3, 4, 5, and 6] = 0.15 E[X] = (0.375)(1) + (0.15)() + (0.15)(3) + (0.15)(4) + (0.15)(5) + (0.15)(6) =.875 f(x) 0.375 + o 0.50 + 0.15 + o o o o o +---+---+---+---+---+---+--- 0 1 3 4 5 6 x F(x) 1.000 + +--- 0.875 + +---+ 0.750 + +---+ 0.65 + +---+ 0.500 + +---+ 0.375 + +---+ 0.50 + 0.15 + +---+---+---+---+---+---+--- 0 1 3 4 5 6 x Problem #3 5 pts for (a) (roughly 1 pt per sub-answer), 5 pts for (b) ( pts for PK, 3 pts for set-up). Answer the following questions about queuing theory. a) For an M/M/1 queue we know that the mean number of customers in the system (L) is equal to the utilization divided by one minus the utilization. Using basic laws and relationships, derive the mean wait in the system (W), the mean number of customers in the queueing area (Lq), and the mean wait in the queuing area (Wq) as a function of arrival rate and service rate. For full credit, your expressions need to be simplified. We know that L = ρ ( 1 ρ ) where ρ = λ μ where λ = customer arrival rate and μ = customer service rate. Little s Law states that L = λw. We also know what Lq = L ρ and Wq = W ( 1 μ). So, we now have W = 1 ( μ λ), Wq = λ (( μ λ) μ), and Lq = ρ ( 1 ρ ). b) Consider a single server queue with Poisson arrivals (rate λ) and a uniformly distributed service time (with minimum value a seconds and maximum value b seconds). Solve for the mean number of customers in the system (L). You do not need to simplify your expression for L.

This is an M/G/1 queue where the G is uniform with μ ( a + b) and = ( b a) = 1 1 σ and so Cs = 1 1 1 ( b a) ( 1 )( a + b) λ We also have that ρ = Using the PK formula (for M/G/1) we have a + b ( ) λ 1 1 b a 1+ ( )( ) a + b 1 a + b ρ (1 + Cs ) λ L = ρ + = + (simplification is not necessary). ( 1 ρ ) a + b λ 1 a + b. Problem #4 4 pts for graph and 1 pt for each of six measures. Consider the following single-server queueing system from time = 0 to time = 10 sec. Arrivals and service times are: Customer #1 arrives at t = 1 second and requires seconds of service time Customer # arrives at t = second and requires seconds of service time Customer #3 arrives at t = 5 seconds and requires seconds of service time Customer #4 arrives at t = 8 seconds and requires seconds of service time Solve for system throughput (X), total busy time (B), mean service time (Ts), utilization (U), mean system time (delay in system) (W), and mean number in the system (L). Show your work to receive full credit. Num in sys 3 + + +---+ 1 + +---+ +---------------+ +-------+ +---+---+---+---+---+---+---+---+---+---+--- 1 3 4 5 6 7 8 9 10 time X = C/T = 4/10 = 0.4 cust/sec B = 8 seconds (by inspection) Ts = B/C = 8 / 4 =.0 sec / cust U = B/T = 8/10 = 80% W = Sum of w / C = 9 / 4 =.5 sec L = Sum of w / T = 9 / 10 = 0.9 cust Problem #5 5 pts for Monte Carlo framework, 5 pts for correct solution. Write a Monte Carlo simulation to model a biased coin as follows. When flipped if the coin show tails it has a 50% chance of tails or heads on the next flop. However, if the coin shows heads then it has 75% chance of showing heads again on the next flip. The Monte Carlo simulation should determine the probability of a head showing. You may assume that you have access to a function rand_val() that returns uniform(0.0, 1.0). int main() double head_prob; // Probability of flipping a head double heads, tails; // Counters for heads and tails int i; // Loop counter rand_val(1); head_prob = 0.50; heads = tails = 0;

for (i=0; i<num_iter; i++) if (rand_val(0) < head_prob) heads++; head_prob = 0.75; else tails++; head_prob = 0.50; printf("pr[head] = %f \n", (double) heads / (heads + tails)); return(0); Problem #6 1 pt for C function library, 1 pt for process oriented, 1 pt for each of facility, storage, event, mailbox, table, reporting and random number streams, and 1 pt for run length control. Give an approximately 100 to 150 word overview or description of what is CSIM. You will be graded for completeness (i.e., it is not sufficient to just say CSIM is a simulation language ). CSIM is a commercial C function library from Mesquite Software for developing process-oriented discrete event simulation models. CSIM was originally developed in the 1980s. A CSIM process models a system component and it can be active, holding (time moves forward), or waiting. CSIM processes run independently. CSIM supports constructs for facilities (entities that do work), storage (entities that can be allocated and de-allocated), events (process synchronization), mailboxes (passing messages between processes), tables (collecting and summarizing data), reporting, and random number streams. Reporting includes standard end-of-run reports and inspector functions for use during simulation runtime and at the end-of-run. CSIM also supports automatic run length control (or stopping) using confidence intervals based on a batch-means method. Problem #7 Roughly 1 pt for each correct line. Allow for any ordering of simultaneous events. Appendix A contains a CSIM program. What is the output from this program?

Problem #8 5 pts for (a) (use of table pts, insertion of record() pts and D/M/1 is 1 pt), 5pts for (b) ( for create(), 1 for loop, for hold() and record()). Answer the following CSIM-related questions. a) Appendix B contains a CSIM program that models a single server queue. Add a CSIM table to the program to collect data on the number of customers in the system as seen by an arriving customer. What kind of queue (identify using Kendall notation) does this CSIM program model? The solution is marked in Appendix B. This program models a D/M/1 queue. b) Write a CSIM process that will periodically (say, every DELAY seconds DELAY is a globally defined constant value) collect data on how many customers are queued for a CSIM facility named Server (the facility Server has been globally defined). The collected data should be recorded in a CSIM table named Cust_table (Cust_table has been globally defined). void sample() create("sample"); while(1) hold((double) DELAY); record((double) qlength(server), Cust_table); Problem #9 5 pts for identify keying components (1 pts for each component), 3 pts for basic structure, pts for cache hit and else of three holds). Describe how to model a disk drive unit. Sketch-out a CSIM process for a disk drive that captures a pretty good level of detail for modeling reading a file from the disk drive unit. It is important to identify all the components and/or functionality of a disk drive unit that may affect performance. Key aspects of disk drive performance are the 1) cache hit probability, ) head seek time, 3) disk spin time, and 4) actual disk (also cache) access rate. The key performance metric of interest is the response time to read a file. A CSIM process for a disk drive read model looks like: void disk(double file_size, double org_time) create("disk"); // Process the file read request reserve(disk_facility); if (uniform(0.0, 1.0) < Prob_hit) hold(file_size / Read_rate1); else hold(uniform(0.0, Seek_time)); hold(uniform(0.0, Spin_time)); hold(file_size / Read_rate); release(disk_facility); // Read the file bytes from cache // Move the head // Spin the disk to position // Read the file bytes from disk // Record the response time record((clock - org_time), Resp_table); Where Prob_hit, Read_rate1, Read_rate, Seek_time, and Spin_time are all global variables that have been defined and declared elsewhere previous to disk() be invoked. In this model we used probability distributions for cache hit, head movement time, and disk spin time. An even more detailed model would have a real cache and would completely model head movement based on the head seek algorithm actually used in the disk drive. The disk location would also be modeled.

Problem #10 6 pts for formulas, 1 pt for each correctly computed value. Below are some sample means taken from independent replications of a simulation model. What is the 95% confidence interval (CI)? What is the accuracy of the CI? A T-score table is given in Appendix C. 10 1 15 15 15 17 1 Y = 6 S = ( 10 + 1 + 15 + 15 + 15 + 17) 1 6 1 = 14 [( 10 14) + ( 1 14) + K+ ( 17 14) ] =.598 t α =.57 (for 95% confidence we use α = 0.05 and N = 6 degrees of freedom, so we use the N - 1= 5 row).598 H =.57 =.6543 6 Thus, the population mean (μ) is between 11.346 and 16.6543 with 95% confidence. The accuracy of the CI is.6543/14 = 19%. Extra Credit: 4 pts for two indexes, 4 pts for getting length, pts for picking queue including load balancing. Write a CSIM process that models the following load balancer. Consider a single load balancer where all customers arrive. There are N queues. A customer can be sent to any of the N queues. For an arriving customer, randomly select two queues out of the N. Send the customer to the queue (of the two selected) with the smallest number of customers in the system. Ties need to be broken fairly. The prototype for the queue process (that you need not write) is void queue[i](double org_time); Each queue has a facility Server[i] in it. The index i ranges from 0 to N 1. void loadbalancer() int index1, index; int len1, len; // Index for queues // Number in system for selected queues // Select two queues index1 = random_int(0, (N-1)); index = random_int(0, (N-1)); // Get the number in the system for the two selected queues len1 = qlength(server[index1]) + num_busy(server[index1]); len = qlength(server[index1]) + num_busy(server[index]); // Forward customer to the shortest queue, break ties fairly if (len1 < len) queue[index1](double clock); else if (len < len1) queue[index](double clock); else If (uniform((double) 0.0, (double) 1.0) < 0.5) queue[index1](double clock); else queue[index](double clock);

Appendix A Source code for problem #7 // CSIM model for problem #7 on the final exam (summer 009) #include <stdio.h> #include "csim.h" #define SIM_TIME 1.0e6 FACILITY Server; void generate(void); void queue1(double service_time); void sim(void) create("sim"); Server = facility("server"); generate(); hold(sim_time); void generate() create("generate"); hold(1.0); queue1(.0); hold(1.0); queue1(.0); hold(.0); queue1(1.0); hold(5.0); queue1(1.0); void queue1(double service_time) create("queue1"); printf("(1) at %f \n", clock); reserve(server); printf("() at %f \n", clock); hold(service_time); release(server); printf("(3) at %f \n", clock);

Appendix B Source code for problem #8 // CSIM model for problem #8 on the final exam (summer 009) #include <stdio.h> #include "csim.h" #define SIM_TIME 1.0e6 FACILITY Server; TABLE Cust_table; void generate(double lambda, double mu); void queue1(double service_time); void sim(void) double lambda, mu; create("sim"); Server = facility("server"); Cust_table = table("customer table"); lambda = 0.9; mu = 1.0; generate(lambda, mu); hold(sim_time); report(); void generate(double lambda, double mu) double interarrival_time; double service_time; create("generate"); while(1) interarrival_time = 1.0 / lambda; hold(interarrival_time); service_time = exponential(1.0 / mu); queue1(service_time); void queue1(double service_time) create("queue1"); record((double) (qlength(server) + num_busy(server)), Cust_table); reserve(server); hold(service_time); release(server);

Appendix C T score table Selected values of t α ; N 1 α = 0.05 α = 0. 05 N 1 t t 4.13.78 5.0.57 6 1.94.45 7 1.90.37 8 1.86.31 9 1.83.6 10 1.81.3 11 1.80.0 1 1.78.18