

\documentclass{beamer}

% This file is a solution template for:

% - Talk at a conference/colloquium.
% - Talk length is about 20min.
% - Style is ornate.



% Copyright 2004 by Till Tantau <tantau@users.sourceforge.net>.
%
% In principle, this file can be redistributed and/or modified under
% the terms of the GNU Public License, version 2.
%
% However, this file is supposed to be a template to be modified
% for your own needs. For this reason, if you use this file as a
% template and not specifically distribute it as part of a another
% package/program, I grant the extra permission to freely copy and
% modify this file as you see fit and even to delete this copyright
% notice. 


\mode<presentation>
{
  %\usetheme{Madrid}
  %\usetheme{Warsaw}
  % or ...
  %\usetheme{Berkeley}   % left bar
  %\usetheme{Antibes} % tree header
  %\usetheme{Boadilla}  % very plain
  %\usetheme{Warsaw}
  \usetheme{Rochester} % I like
  %\usetheme{Goettingen}  % right bar
  %\usetheme{Ilmenau}

\usecolortheme{lily}

  \usepackage{beamerouterthemeshadow}
  %\usepackage{beamerouterthemesmoothtree}
  \usepackage{beamercolorthemeorchid}
  %\usepackage{beamerinnerthemerounded}
  %\usepackage{beamerthemeshadow}
  \setbeamercovered{transparent}
  % comment out to completely hide covered material



  %\setbeamercovered{transparent}
  % or whatever (possibly just delete it)
}

%\usepackage{wmff}

\usepackage[english]{babel}
% or whatever

\usepackage[latin1]{inputenc}
% or whatever

\usepackage{times}
\usepackage[T1]{fontenc}
% Or whatever. Note that the encoding and the font should match. If T1
% does not look nice, try deleting the line with the fontenc.


\title % (optional, use only with long paper titles)
{CS4632 Object Oriented Simulation}

\subtitle
{Multi-Server Systems}

\author%[Author, Another] % (optional, use only with lots of authors)
{Jos\'e M. Garrido C.}
% \inst{1} 
% \and S.~Another\inst{2}}
% - Give the names in the same order as the appear in the paper.
% - Use the \inst{?} command only if the authors have different
%   affiliation.

\institute[Kennesaw State University] % (optional, but mostly needed)
{
  %\inst{1}%
   Department of Computer Science\\
  Kennesaw State University
%  \and
%  \inst{2}%
%  Department of Theoretical Philosophy\\
%  University of Elsewhere
}
% - Use the \inst command only if there are several affiliations.
% - Keep it simple, no one is interested in your street address.

\date % (optional, should be abbreviation of conference name)
{Spring, 2016}
% - Either use conference name or its abbreviation.
% - Not really informative to the audience, more for people (including
%   yourself) who are reading the slides online

\subject{Applied Computer Science, Simulation}
% This is only inserted into the PDF information catalog. Can be left
% out. 



% If you have a file called "university-logo-filename.xxx", where xxx
% is a graphic format that can be processed by latex or pdflatex,
% resp., then you can add a logo as follows:

\pgfdeclareimage[height=0.17in]{university-logo}{ksu-1.png}
\logo{\pgfuseimage{university-logo}}



% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
%\AtBeginSubsection[]
%{
%  \begin{frame}<beamer>{Outline}
%    \tableofcontents[currentsection,currentsubsection]
%  \end{frame}
%}


% If you wish to uncover everything in a step-wise fashion, uncomment
% the following command: 

%\beamerdefaultoverlayspecification{<+->}


\begin{document}

\begin{frame}
  \titlepage
\end{frame}

%\begin{frame}{Outline}
%  \tableofcontents
  % You might wish to add the option [pausesections]
%\end{frame}


% Structuring a talk is a difficult task and the following structure
% may not be suitable. Here are some rules that apply for this
% solution: 

% - Exactly two or three sections (other than the summary).
% - At *most* three subsections per section.
% - Talk about 30s to 2min per frame. So there should be between about
%   15 and 30 frames, all told.

% - A conference audience is likely to know very little of what you
%   are going to talk about. So *simplify*!
% - In a 20min talk, getting the main ideas across is hard
%   enough. Leave out details, even if it means being less precise than
%   you think necessary.
% - If you omit details that are vital to the proof/implementation,
%   just say so once. Everybody will be happy with that.

%\section{Multi-Server Queuing Models}

\section {Introduction}

\begin{frame}{Multiple Servers}
 \begin{block}{}
Multi-server systems include more that one server, and these provide service to the customers arriving into the customer queue(s). 
  \end{block}
   \begin{block}{}
The models of multi-server systems can be designed with several similar servers or with different types of servers. 
  \end{block}
 \end{frame} 

\begin{frame}{Queuing Models}
The three categories of queuing models that can be analyzed with simulation are:
\begin{enumerate}
  \item single-server models
  \item multi-server models
  \item queuing networks
\end{enumerate}
\end{frame} 

\begin{frame}{Performance Metrics}
Some of the performance measures to be computed for queuing models are:
\begin{itemize}
 \item For every server, the percentage of the total time that the server is actually carrying out the servicing of the customers, the server utilization
  \item The average number of customers waiting (i.e., the number of customers in the queue)
  \item The average time that a customer spends in the system, the average sojourn time\index{sojourn time}
 \item The total number of customers serviced in a given interval, the system
    throughput 
 \item The percentage of customers rejected because of the limited queue size. (These customers arrive when the queue is full.)
\end{itemize}
\end{frame}

\section{Multi-Server Models}

\begin{frame}{Behavior of Multi-server Models}
 \begin{block}{}
 In simple multi-server models, any of the servers can provide the service demanded by a customers  waiting in the customer queue.

  \end{block}
  \pause
  \begin{block}{}
\begin{itemize}
  \item The servers that are not busy, are usually stored in server queue.
\item  
An arriving customer will remove the server at the head of the server queue and reactivate the server. 
\item The system has several servers providing service to customers. 
\item All servers are alike, e.g., there is only one type of server. 
\item In a similar manner, all customers are alike, there is only one type of customer. 
\end{itemize}
  \end{block}
\end{frame}

\begin{frame}{Illustration of a Multi-server Model}
\begin{figure}
\center
\includegraphics[width=2.75in]{serverm.png}
\caption{A multi-server model}
\label{fig:servmn}
%\vskip\baselineskip
\end{figure}
\end{frame}

\begin{frame}{Multi-server Carwash System}
  \begin{block}{}
  \begin{itemize}
\item The model of the Carwash system has {\em K} wash-machines. 
\item A customer waits in the queue until any server becomes available. 
\item The server then removes the customer from the customer queue and starts servicing to it. 
  \end{itemize}
  \end{block}
    \begin{block}{}
    \begin{itemize}
  \item  
  The multi-server model has an array of {\em K\/} server objects. 
\item This array is needed first, so that customer can reference any server, second every server will compute its own to idle time. 
\item There is  a queue for idle servers. 
\item The capacity of the server queue is {\em K\/}.
\end{itemize}
  \end{block}
\end{frame}

\begin{frame}{Queues in the Model}
The model has two queues:
\begin{itemize}
\item One queue for cars waiting for service
\item One queue for idle servers (waiting for cars)
\end{itemize}
\begin{block}{}
As in the single-server model, the queues in this model are simple, i.e., they follow a first-in-first-out (FIFO\index{FIFO}) order.
\end{block}
\end{frame}

\begin{frame}{General Behavior of the Carwash System}
\begin{enumerate}
 \item A new car object (customer) arrives and checks if there is any server available in the server queue. If so, the car removes the server at the head of the server queue and reactivates it.
 \item The car joins the car queue to wait for service.
 \item When a server becomes available, it removes the car from the car queue.
 \item The server provides the service for service interval of the car object.
 \item When the service has completed, the car object continues its own activities  and the server becomes available.
 \item If the server finds that the car queue is empty, the server object  becomes available, is made idle, and joins the server queue.
\end{enumerate}
\end{frame}



\begin{frame}{The Server Object}
\begin{enumerate}
 \item Examine the customer queue and if it is not empty, perform the following activities: 
     \begin{enumerate}
	\item Remove the customer from the head of the customer queue
	\item Perform the service to the customer for the specified service interval 
	\item Reactivate the customer object and let it continue its own activities
     \end{enumerate}
 \item If the customer queue is empty, join the server queue and suspend\index{suspend} itself to wait\index{wait} (in the idle state).
\end{enumerate}
\end{frame}







\begin{frame}{The Car Object}
\begin{enumerate}
  \item Examine the car queue and if it is not full, join the queue. 
  \begin{enumerate}
  \item Check whether there is an available server object by examining the server queue and if not empty, remove the server object from the head of the server queue. 

  \item Reactivate the server object.

  \item Suspend itself and go into the idle state.

  \item Reactivated by the server object after completed the service, continue with own individual behavior before terminating\index{terminate}.
  \end{enumerate}
  \item If the car queue is full, terminate immediately , the car has been 
	rejected.
\end{enumerate}
\end{frame}  



%
\begin{frame}{The Arrivals Object}
\begin{block}{}
 Repeat while the clock time is less than the close-arrival period.
\begin{enumerate}
  \item Generate a random\index{random number} inter-arrival time interval.

  \item Wait until the simulation clock advances by a time interval equal to the inter-arrival interval.

  \item Generate a random  customer service interval.

  \item Create\index{create} a customer object.
\end{enumerate}
 \end{block}
\end{frame}

\begin{frame}{Implementation of the Multi-server Carwash Model}
\begin{block}{}
The OOSimL implementation\index{implementation} of the multi-server Carwash model is stored in file {\tt mcarwash.jar}. The source files included are: {\tt MCarwash.osl}, {\tt Car.osl}, {\tt Server.osl}, and {\tt Arrivals.osl}. The additional source file {\tt SimModel.osl} is necessary to carry out the GUI I/O with the ACM classes. 
\end{block}
\end{frame}

\begin{frame}{First and Second GUIs of Multi-server Model}
\begin{columns}
 \column{.45\textwidth}
\begin{figure}
%\centereps{2.25in}{1.22in}{cw1.png}
 \includegraphics[width=2.15in]{mcw1.png}
\caption{First GUI}
\label{fig:cw1}
%\vskip\baselineskip
\end{figure}
  \column{.45\textwidth}
  \begin{figure}
%\centereps{2.25in}{1.22in}{cw2.png}
 \includegraphics[width=2.15in]{mcw2.png}
\caption{Second GUI}
\label{fig:cw2}
%\vskip\baselineskip
\end{figure}
\end{columns}
\end{frame}

\begin{frame}{Results GUI of Multi-server Model}
\begin{figure}
\center
\includegraphics[width=2.75in]{mcw3.png}
\caption{Results GUI of multi-server model}
\label{fig:servmn}
%\vskip\baselineskip
\end{figure}
\end{frame}


\begin{frame}[fragile]{Partial Output of a Simulation Run}
\small \tt
\begin{verbatim}
End Simulation of Multi-server Model of Carwash System 
   date: 9/12/2008 time: 10:20
 
Total number of cars serviced: 259
Car average wait period: 10.734
Average period car spends in the shop: 23.227
Machine 0 utilization: 0.984
Machine 1 utilization: 0.98
Machine 2 utilization: 0.984
Machine 3 utilization: 0.984
Machine 4 utilization: 0.976
\end{verbatim}
\end{frame}

\begin{frame}[fragile]{Partail Code in class {\em Car}}
\tt \small
\begin{verbatim}
 if MCarwash.servQueue is not empty
 then
    // get next available server
    remove object wmach of class Server from 
           MCarwash.servQueue
    set servname = wmach.get_name()
    display cname, " activating server ", servname,
           " at ", simclock
    tracewrite cname, " activating ", servname
    reactivate wmach now 
 endif
 //
 suspend self               // to wait for service
\end{verbatim}
\end{frame}

\begin{frame}[fragile]{Partail Code in class {\em Server}}
\tt \small
\begin{verbatim}
 if MCarwash.car_queue is empty
 then
    // car queue is empty
    set startIdle = get_clock()  // start idle period
    tracewrite sname, " to idle state"
    // join available server queue
    insert self into MCarwash.servQueue   
    suspend self        // suspend server
    //
    // reactivated by a car object
    // queue must now be nonempty          
    set simclock = get_clock()
    set idle_period = simclock- startIdle
    add idle_period to MCarwash.accum_idle[snum]
    display sname, " reactivated at " + simclock
 endif
 call serviceCustomer   // service the car
\end{verbatim}
\end{frame}

\begin{frame}{Implementation of the Multi-server Barbershop Model}
\begin{block}{}
Very similar to the multi-server Barber model.
The OOSimL implementation\index{implementation} of the multi-server Barbershop model is stored in file {\tt mbarber.jar}. The source files included are: {\tt MBarber.osl}, {\tt Customer.osl}, {\tt Server.osl}, {\tt Arrivals.osl}, {\tt MBarberGUI.osl}, {\tt MBarberPanel.osl}. 
\end{block}
\end{frame}

\begin{frame}{Input GUI of Multi-server Barbershop Model}
\begin{figure}
\center
\includegraphics[width=2.75in]{mbarb1.png}
\caption{Input GUI of multi-server Barbershop model}
\label{fig:mbarb1}
%\vskip\baselineskip
\end{figure}
\end{frame}

\begin{frame}{Results GUI of Multi-server Barbershop Model}
\begin{figure}
\center
\includegraphics[width=2.75in]{mbarb2.png}
\caption{Results GUI of multi-server Barbershop model}
\label{fig:mbarb2}
%\vskip\baselineskip
\end{figure}
\end{frame}

\section{Models With Multiple Queues}

\begin{frame}{Models with Several Customer Queues}
Multi-server models can include more than one customer queue and the simplest models have:
\begin{itemize}
 \item A separate queue for every server. 
 \item Each server object owns a queue and a customer object will receive service from only one server object. 
 \item The customer queues are simple queues --- FIFO queues.
\end{itemize}
\end{frame}

\begin{frame}{Illustration of Model with Multiple Queues}
\begin{figure}
\center
\includegraphics[width=3.0in]{servermq.png}
\caption{A multi-server model with multiple queues}
\label{fig:servermq}
%\vskip\baselineskip
\end{figure}
\end{frame}

\begin{frame}{Managing Multiple Queues}
\begin{block}{}
\begin{itemize}
\item Arriving customers normally select the station with the shortest queue. 
\item If all the queues have the same size, then an arriving customer joins the first queue. 
\item If a queue is full, the customer will ignore it. 
\item If all the queues are full, the customer is rejected and terminates.
\end{itemize}
\end{block}
\end{frame}

\begin{frame}{Behavior of The Customer Object}
\begin{enumerate}
  \item Join the shortest customer queue that is not full. 
  \begin{enumerate}
  \item Reactivate\index{reactivate} the server object of the queue if the server is idle.

  \item Suspend itself and go to the idle state.

  \item After the service has been completed, continue own activities.

  \item Terminate\index{terminate}.
  \end{enumerate}
  \item If all the customer queues are full, terminate (e.g., the customer object is
	rejected).
\end{enumerate}
\end{frame}

\begin{frame}{Behavior of The Server Object}
\begin{enumerate}
 \item  Repeat while the customer queue for this server is not empty 
    \begin{enumerate}
	\item Remove the customer object from the head of the corresponding customer queue 
	\item Perform the service to the customer object 
	\item Reactivate the customer object.
    \end{enumerate}
 \item If the customer queue is empty, suspend itself and wait in the idle state until the next customer object arrives.
 \item When reactivated by a customer object, start from step 1.
\end{enumerate}
\end{frame}



\begin{frame}{First GUI of Model with Multiple Queues}
\begin{figure}
\center
\includegraphics[width=3.0in]{mqmscw1.png}
\caption{First GUI of multi-server model with multiple queues}
\label{fig:mqmscw1}
%\vskip\baselineskip
\end{figure}
\end{frame}

\begin{frame}[fragile]{Partial Output of a Simulation Run}
\small \tt
\begin{verbatim}
End Simulation of Multiserver Multi-queue Carwash Model 
date: 6/15/2009 time: 13:48
Elapsed computer time: 2328 millisec
 
Total number of cars serviced: 327
Car average wait period: 153.004
Average period car spends in the shop: 167.475
Machine0 utilization: 0.998
Machine1 utilization: 0.995
Machine2 utilization: 0.989
Machine3 utilization: 0.988
Machine4 utilization: 0.979
\end{verbatim}
\end{frame}


\end{document}
