

\documentclass[compress,red]{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

  % 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)
{Object Oriented Simulation}

\subtitle
{Multi-Server Queuing Models with Priorities}

\author%[Author, Another] % (optional, use only with lots of authors)
{Dr. 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}{Queuing Networks}
 \begin{block}{Service Stations}
 \begin{itemize}
 \item
A queuing network is a more general model than the ones considered previously, it consists of a number of interconnected stations. 
\item
The stations are interconnected in such a way that the outputs of one station are used as inputs to one or more other stations. 
\item Each station has its own server and queue, it can consist of one or more servers and a queue.
\item Each service station in a queuing network provides a different type of service. 
\end{itemize}
  \end{block}
   \begin{block}{}

  \end{block}
 \end{frame} 

\begin{frame}{A Queuing Network Model with Six Stations}
\begin{figure}
\center
\includegraphics[width=2.75in]{qnet2.png}
%\vskip\baselineskip
\end{figure}
\end{frame}



\begin{frame}{Queuing Network Models}
\begin{itemize}
 \item 
 In queuing systems, customers  request service from several service stations. 
 \item A customer object will usually request service from several service stations. 
\item
For example, in a data communication network the data packets are the customers and they travel from service station to service station until each packet reaches its final destination.
\end{itemize}
\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
 \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}

\begin{frame}{Priorities}
  \begin{block}{Customer Types}
  \begin{itemize}
\item In models with multiple types of customers, each customer type has its own mean arrival rate, mean service period, and other workload parameters. 
\item Usually, each customer type is given a priority. 
\item A priority is used by the server object to select a customer for service. 
\item The server normally selects the customer with the highest priority. 
\item The priority affects the order of removal from the queue---the queue discipline.
  \end{itemize}
  \end{block}
\end{frame}

\begin{frame}{Model of a Simple System with Priorities}
\begin{figure}
\center
\includegraphics[width=2.75in]{pqueue.png}
%\vskip\baselineskip
\end{figure}
\end{frame}

\begin{frame}{Applications with Priorities}
\begin{itemize}
\item Real-time systems used to control power plants
\item Computer communication networks, in which data may be routed in different ways, according to the message priorities
  \item Medical attention in a hospital, in which patients are attended according to the degree of the emergency
  \item Operating systems, in which  processes are serviced according to the process' priority
\end{itemize}
\end{frame}


\begin{frame}{Priority Queues}
\begin{itemize}
\item Simulation models with priorities include at least one priority queue for arriving customers. 
  \item
A priority queue is a queue that stores customers in order of priority and uses FIFO ordering for customers with the same priority. 
\item Customers with the highest priority are always at the head of the queue.
 Computer communication networks, in which data may be routed in different ways, according to the message priorities
\end{itemize} 
\end{frame}


\begin{frame}{Priorities With Single-Server Models}
\begin{itemize}
\item 
Customer objects of different types arrive and join a priority queue. 
\item The priority is assigned by the arrivals object. 
\item Since customer objects of the various types have different mean inter-arrival periods and different mean service periods, for each type of customers a different arrivals object is created. 
\item Each arrivals object creates customer objects of the same type. 
\end{itemize} 
\end{frame}



\begin{frame}{Process Priorities}
\begin{itemize}
\item 
The priority of a process is an integer value and represents its relative importance in relation to other processes. 
\item In OOSimL, the highest priority value is 0. 
\item To access the priority of a process, the statement \textcolor{red}{\bf assign priority} is used.
\end{itemize} 
\end{frame}  

\begin{frame}[fragile]{Example Process Priorities}

{\tt \small
\begin{verbatim}
define mach_prio of type integer // priority of machine
define myprio of type integer    // priority of self
define machine of class Server   // reference to server object
...  
assign priority of machine to mach_prio
assign priority to myprio        // get priority self
\end{verbatim}
}
\end{frame}  

%
\begin{frame}[fragile]{Set Priority of Active Object}
\begin{block}{}
 To set the priority of a process, the statement \textcolor{red}{\bf fix priority} is used. The general structure of the statement follows.
 \end{block}
\vspace{0.1in}
%\begin{quote}
{\tt %\footnotesize
\begin{algorithm}
{\bf fix priority} $\langle$ prio\_var $\rangle$ [{\bf to} $\langle$ ref\_variable $\rangle$ ]
\end{algorithm}
}
\end{frame}

\begin{frame}[fragile]{Example of Set Priority}
\begin{block}{}
The following example sets the priority 5 to the current process, then it sets priority 1 to another process referenced by {\em machine}. 
\end{block}
\vspace{0.1in}
{\tt \small
\begin{verbatim} 
fix priority 5 // to self
fix priority 1 to machine
\end{verbatim}
}
\end{frame}

\begin{frame}[fragile]{Example 2 with Priority}
\begin{block}{}
The following example increases the priority of a process referenced by {\em machine} by 1. The code defines an integer variable {\em m\_priority\/} to store the priority of the process.
\end{block}
\vspace{0.1in}
{\tt \small
\begin{verbatim} 
define m_priority of type integer
...
assign priority of machine to m_priority   
increment m_priority  // increment current priority
fix priority m_priority to machine // new priority
\end{verbatim}
}
\end{frame}

\begin{frame}{Priority Queues}
\begin{block}{}
\begin{itemize}
\item 
Priority queues allow the simulation model to retrieve or remove processes from the queue, based on the priority of the processes.
\item 
Priority queues do not behave as FIFO queues.
\item 
A priority queue is an object of class \textcolor{red}{\em Pqueue}. 
\item
OOSimL includes statements that are used to define and manipulate priority queues. 
\end{itemize}
\end{block}
\end{frame}

\begin{frame}[fragile]{Example Creating Objects of Class Pqueue}
\begin{block}{}
The following lines of code declare and create the priority queue with reference name {\em cust\_queue}, with queue name {\em Customer Queue}, using 8 different priorities, and size (capacity) of 25 customers for every priority.
\end{block}
\vspace{0.1in}
{\tt \small
\begin{verbatim} 
define cust_queue of class Pqueue 
...
// create priority queue
create cust_queue of class Pqueue 
      using "Customer Queue", 8, 25
\end{verbatim}
}
\end{frame}

\begin{frame}{Create Objects of Class Pqueue}
\begin{block}{}
\begin{itemize}
\item Objects of class \textcolor{red}{\em Pqueue} are passive objects.
\item 
The constructor for creating a priority queue requires the name of the queue, the optional number of different priorities, and the queue size for all priorities, which is also optional. 
\item If the second argument is not included, the number of priorities is assigned to 300 (default). 
\item If the third argument is not included, the assigned default queue size is 1,000 for every priority. 
\end{itemize}
\end{block}
\end{frame}

\begin{frame}[fragile]{Priority Queue Length}
\begin{block}{}
\begin{itemize}
\item 
 This \textcolor{red}{\bf assign} statement gets the current size (total number of processes) in the specified priority queue. 
 \item
An integer value that corresponds to the current length of the queue is assigned to the specified integer variable. 
\item The general structure of the statement follows. 
\end{itemize}
 \end{block}
 
\vspace{0.1in}
%\begin{quote}
{\tt %\footnotesize
\begin{algorithm}
{\bf assign length of} $\langle$ queue\_ref $\rangle${\bf to} $\langle$ variable $\rangle$
\end{algorithm}
}
\end{frame}

\begin{frame}[fragile]{Example Length of Priority Queue}
\begin{block}{}
For example, the following lines of code get the current length of priority queue {\em cust\_queue} (defined above) and assign this value to variable {\em mqlength}.
\end{block}

\vspace{0.1in}
{\tt \small
\begin{verbatim} 
define mqlength of type integer
...
assign length of cust_queue to mqlength 
\end{verbatim}
}
\end{frame}


\begin{frame}[fragile]{Check Priority Queue Empty}
\begin{block}{}
\begin{itemize}
\item 
The \textcolor{red}{\bf if} statement with the {\bf empty} condition check if a queue is empty. 
\item
For example, the following lines of code check if queue object {\em cust\_queue} (defined above) is empty. 
\item
The current process suspends itself if the queue is empty, otherwise, it proceeds to remove a process from the queue.
\end{itemize}
\end{block}
\small \tt
\begin{verbatim}
  if cust_queue is empty then
     // if queue is empty, suspend here
     suspend self
     ...
  else
     // dequeue process
     ...
  endif
\end{verbatim}
\end{frame}

\begin{frame}[fragile]{Processes With A Specified Priority}
\begin{block}{}
The following line of code gets the current number of processes in the priority queue {\em cust\_queue}, with priority {\em l\_prio}, and assigns this number to variable {\em num\_proc}.
\end{block} 

%\begin{quote}
{\tt \small
\begin{verbatim}
assign length of cust_queue with 
    priority l_prio to num_proc 
\end{verbatim}
}
\end{frame}

\begin{frame}[fragile]{Insert Process Into Priority Queue}
\begin{block}{}
\begin{itemize}
\item 
The \textcolor{red}{\bf insert} (and {\bf enqueue}) statement inserts the specified process into the priority queue. 
\item The size of the queue is increased by one. 
\item The priority of the process is automatically used to insert the process. 
\end{itemize}
\end{block}
\vspace{0.1in}
%\begin{quote}
{\tt \small
\begin{algorithm}
{\bf insert} $\langle$ ref\_variable $\rangle$ {\bf into} $\langle$ queue\_ref $\rangle$ 
% \ \ \ \ {\bf with priority} $\langle$ prio\_var $\rangle$
{\bf insert self into} $\langle$ queue\_ref $\rangle$
% {\bf with priority} $\langle$ prio\_var $\rangle$
{\bf enqueue} $\langle$ ref\_variable $\rangle${\bf into} $\langle$ queue\_ref $\rangle$
% \ \ \ \ {\bf with priority} $\langle$ prio\_var $\rangle$
{\bf enqueue self into} $\langle$ queue\_ref $\rangle$
% {\bf with priority} $\langle$ prio\_var $\rangle$
\end{algorithm}
}
\end{frame}

\begin{frame}[fragile]{Example Insert}
\begin{block}{}
The following lines of code insert (enqueue) process {\em cust\_obj} into priority queue {\em pcust\_queue}.
 \end{block}
%\begin{quote}
{\tt \small
\begin{verbatim}
 define cust_prio = 3 of type integer
 define cust_obj of class Customer  
 ...
 // enqueue customer process
 insert cust_obj into pcust_queue 
\end{verbatim}
}
\end{frame}

\begin{frame}[fragile]{Remove Process with Specified Priority}
\begin{block}{}
\begin{itemize}
\item 
The statements \textcolor{red}{\bf remove} and \textcolor{red}{\bf dequeue} remove (dequeue) a process of a specified priority,  from a priority queue. 
\item
After removal, the size of the queue is reduced by one, as a result of this operation. 
\end{itemize}
\end{block}
\vspace{0.1in}
%\begin{quote}
{\tt \small
\begin{algorithm}
{\bf remove} [{\bf object}] $\langle$ ref\_var $\rangle${\bf of class} $\langle$ cl\_name $\rangle$
\ \ {\bf from} [{\bf queue}] $\langle$ queue\_ref $\rangle$ \\
\ \ \ \ {\bf with priority} $\langle$ prio\_variable $\rangle$
{\bf dequeue} [{\bf object}] $\langle$ ref\_var $\rangle${\bf of class} $\langle$ cl\_name $\rangle$
\ \ {\bf from} [{\bf queue}] $\langle$ queue\_ref $\rangle$ \\
\ \ \ \ {\bf with priority} $\langle$ prio\_variable $\rangle$
\end{algorithm}
}
\end{frame}

\begin{frame}[fragile]{Example Remove Process}
\begin{block}{}
\begin{itemize}
\item 
The following example removes (dequeues) a customer process from queue {\em cust\_queue} and assigns a reference {\em cust\_obj} to it, given priority {\em cust\_prio}. 
\item
If no priority is specified, the statement removes the highest priority process from the priority queue.
\end{itemize}
\end{block} 
%\begin{quote}
{\tt \small
\begin{verbatim}
define cust_prio of type integer
...
remove object cust_obj of class Customer from 
   queue cust_queue with priority cust_prio
\end{verbatim}
}
\end{frame}

\begin{frame}{Carwash with Priorities}
\begin{itemize}
\item 
Each car object includes its priority (type) in addition to its service period, as part of its relevant attributes. 
\item
A car object joins the car queue according to its priority.
\item
The Arrivals object creates a sequence of car objects of a specified priority. One car object is created after every inter-arrival time interval. 
\item
Every car object has a different service interval.
\end{itemize}
\end{frame}


\begin{frame}[fragile]{Output of Carwash with Priorities}

{\tt \small
\begin{verbatim}
End Simulation of Model of Carwash System 
  with Priorities date: 9/17/2008 time: 8:21
 
Total cars of type 0 serviced : 120
Car type 0 average wait period: 10.587397344561573
Total cars of type 1 serviced : 68
Car type 1 average wait period: 235.79209727808004
Total cars of type 2 serviced : 35
Car type 2 average wait period: 442.1166150740475
Total cars of type 3 serviced : 41
Car type 3 average wait period: 750.9129750062083
Total cars of type 4 serviced : 29
Car type 4 average wait period: 701.8389044542504

Total number of cars serviced: 293
Car average wait period: 286.414
Average period car spends in the shop: 289.953
Machine utilization: 0.994
\end{verbatim}
}
\end{frame}

\begin{frame}{Multi-Server Models with Priorities}
\begin{itemize}
\item 
There are several car types, each with a specified priority
\item
There are several objects of class Arrivals, each one generates car objects of the specified type
\item
Each server dequeues and services the car with the highest priority
\item
A different configuration has each server servicing cars of a specified type
\end{itemize}
\end{frame}

\begin{frame}{Model of a Multi-Server System with Priorities}
\begin{figure}
\center
\includegraphics[width=3.0in]{mserverp.png}
%\vskip\baselineskip
\end{figure}
\end{frame}



\end{document}
