

% add the PATH to retrieve cls and sty beamer styles files
\makeatletter
\providecommand*{\input@path}{}
\edef\input@path{{../../support/beamer/}\input@path}% prepend
\makeatother

% \documentclass{pharoslides}
% \documentclass[aspectratio=169]{pharoslides} % format 16/9
\documentclass[withvideo]{pharoslides} % format 16/9 + incrustation video

\graphicspath{{./figures/}{../}{../../support/beamer/imgs/}}

%Information to be included in the title page:
\title{Runtime Architecture}
\subtitle{}
\author{Damien Cassou, Stéphane Ducasse and Luc Fabresse}
\institute{http://stephane.ducasse.free.fr}
\date{}
\slidesid{W6S06}

\begin{document}

\frame[plain]{\titlepage}



\begin{frame}[fragile]

\frametitle{Execution Model}

Pharo virtual machine (VM) executes compiled code

\begin{itemize}
\item The virtual machine and its plugins are platform specific (different versions for different OSes)
\item VMs exist for MacOS, Windows, Linux (different versions), iOS, ARM, Android
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Multiple Stage Compilation}

\begin{enumerate}
\item Pharo code is compiled to bytecodes (platform neutral instructions)
\item The virtual machine transforms dynamically bytecodes to assembly
\end{enumerate}
\end{frame}



\begin{frame}[fragile]

\frametitle{Virtual Machine}

\begin{itemize}
\item Pharo.exe, Pharo.app... are the virtual machines
\item There are two modes:
\begin{itemize}
\item from command-line or in interactive (UI) mode
\end{itemize}

\item It executes compiled code / generates on the fly assembly
\item Compiled code is packaged/stored in an \textit{image} (memory snapshot)
\item The virtual machine only needs the \textit{image} to execute programs
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Image Files: Memory Snapshots}

\begin{columns}

\begin{column}{0.6\textwidth}

\textit{.image} files is a cache of objects:

\begin{itemize}
\item Simple objects (points, strings ...)
\item But also \textbf{compiled} classes and \textbf{compiled} methods
\item Each time we save the image, all objects are saved to disc
\item At startup we get back all the objects we saved
\item PC (program counter) is also saved and restored 
\begin{itemize}
\item frozen execution is restarted at launch time
\end{itemize}

\end{itemize}
\end{column}


\begin{column}{0.5\textwidth}


\begin{center}
\includegraphics[width=1.6\textwidth]{figures/File-VirtualMachineAndImages.png}\end{center}

\end{column}

\end{columns}

\end{frame}



\begin{frame}[fragile]

\frametitle{Change Files: Change Tape}

\textit{.changes} file is a tape of all the changes performed to the system

\begin{itemize}
\item Logs class creation/deletion, method addition/removal, actions...
\item Used to browse versions
\item Can replay/undo actions
\end{itemize}

\textbf{A change is associated to an image}

\begin{itemize}
\item To display class/method definition, tools look in the changes file associated to the current image
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Image/Change Files}

\begin{itemize}
\item A change is associated to an image 
\item Image contains all the objects in binary form. Can be executed without the changes file
\item Changes file simply contains the textual representation of the changes made to the image
\end{itemize}


\begin{center}
\includegraphics[width=0.85\textwidth]{figures/File-VirtualMachineAndImageChange.png}\end{center}

\end{frame}



\begin{frame}[fragile]

\frametitle{Save your code using a package and version control system}

\begin{itemize}
\item Change and image are handy to develop
\item But \textbf{they are not a software engineering artefact}
\item Always have a loading script that takes an image, load your code, run the tests, build your application
\item Usually
\begin{itemize}
\item save code using a Version Control System (monticello, git)
\item use an integration server to build automatically applications
\end{itemize}

\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{About the Source/Changes Files}

\begin{columns}

\begin{column}{0.4\textwidth}

\textit{PharoXX.sources} 

\begin{itemize}
\item Contains the \textit{textual} definition of \textbf{system} classes and predefined objects
\item Is read-only
\item Created during release of new Pharo versions
\item Shared to all the users (images)
\end{itemize}
\end{column}


\begin{column}{0.6\textwidth}


\begin{center}
\includegraphics[width=1.4\textwidth]{figures/File-ImageAtT0.png}\end{center}

\end{column}

\end{columns}

\end{frame}



\begin{frame}[fragile]

\frametitle{When you Define New Classes}

\begin{columns}

\begin{column}{0.4\textwidth}

During development or code loading 

\begin{itemize}
\item New objects are compiled in the image
\item New definitions are added to the changes file
\item Still you can browse the definition of the system class (stored in the \textit{PharoXX.sources})
\end{itemize}
\end{column}


\begin{column}{0.6\textwidth}


\begin{center}
\includegraphics[width=1.4\textwidth]{figures/File-ImageAtT1.png}\end{center}

\end{column}

\end{columns}

\end{frame}



\begin{frame}[fragile]

\frametitle{New Change Management is Coming}

Pharo change system

\begin{itemize}
\item Getting improved
\begin{itemize}
\item new recording mechanism
\item better replay
\item new tooling
\end{itemize}

\item Will integrate better with Git and other modern distributed version control systems
\item Offering new ways to produce images 
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Conclusion}

\begin{itemize}
\item Powerful deployment
\item Fast boot-time
\item Support micro commits
\item Will use modern version control
\end{itemize}
\end{frame}




% \setlength{\textwidth}{\originaltextwidth}
\setbeamertemplate{background canvas}{\insertBorderForHandout}

\begin{frame}[plain]

\begin{minipage}{\originaltextwidth}
\centering
\large


\vspace{2em}

A course by

\vspace{1em}

\hspace{-20px}\includegraphics[height=32px]{inriaLogo}\hspace{3em}\raisebox{7px}{and}\hspace{3em}\raisebox{-6px}{\includegraphics[height=30px]{logoutop}}

\vspace{2em}

in collaboration with

\vspace{1em}

\includegraphics[height=40px]{unisciellogo}\hskip 1.5em%
\raisebox{5px}{\includegraphics[height=30px]{unitlogo}}\hskip 2em%
\raisebox{8px}{\includegraphics[height=24px]{univLilleLogo}}\hskip 2em%
\raisebox{3px}{\includegraphics[height=29px]{logo-IMT}}\hskip 2em%
\raisebox{1px}{\includegraphics[height=32px]{minesDouaiLogo}}

\vspace{2.5em}

\includegraphics[width=50px]{by-nc-nd} \tiny \hskip 0.5em \raisebox{5px}{Inria 2016}

\medskip

\tiny
Except where otherwise noted, this work is licensed under CC BY-NC-ND 3.0 France

\url{https://creativecommons.org/licenses/by-nc-nd/3.0/fr/} 

\end{minipage}
\end{frame}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
