slides/slides09.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Fri, 28 Nov 2014 12:22:50 +0000
changeset 337 92a718b88e14
parent 336 3cb200fa6d6a
child 381 036a762b02cf
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
     2
\usepackage{../slides}
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
     3
\usepackage{../langs}
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
     4
\usepackage{../graphics}
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
     5
\usepackage{../grammar}
337
92a718b88e14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
     6
\usepackage{soul}
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
% beamer stuff 
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
     9
\renewcommand{\slidecaption}{APP 09, King's College London}
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
\newcommand{\bl}[1]{\textcolor{blue}{#1}}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
\begin{document}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    15
\begin{frame}[t]
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
\frametitle{%
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
  \begin{tabular}{@ {}c@ {}}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
  \\
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
  \LARGE Access Control and \\[-3mm] 
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
    20
  \LARGE Privacy Policies (9)\\[-6mm] 
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
  \end{tabular}}\bigskip\bigskip\bigskip
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
    23
  \normalsize
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
  \begin{center}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
  \begin{tabular}{ll}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
  Email:  & christian.urban at kcl.ac.uk\\
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
    27
  Office: & S1.27 (1st floor Strand Building)\\
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
  Slides: & KEATS (also homework is there)\\
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
  \end{tabular}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
  \end{center}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    32
\end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    33
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    34
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    35
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    36
  \begin{frame}[c]
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    38
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    39
  \includegraphics[scale=0.6]{../pics/bridge-limits.png}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    40
  \end{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    41
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    42
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    44
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    46
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    47
  \frametitle{Old-Fashioned Eng.~vs.~CS}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    48
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    49
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    50
  \begin{tabular}{@{}cc@{}}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    51
  \begin{tabular}{@{}p{5.2cm}} 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    52
  \includegraphics[scale=0.058]{../pics/towerbridge.jpg}\\ 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    53
  {\bf bridges}: \\
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    54
  \raggedright\small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    55
  engineers can ``look'' at a bridge and have a pretty good
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    56
  intuition about whether it will hold up or not\\ 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    57
  (redundancy; predictive theory)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    58
  \end{tabular} &
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    59
  \begin{tabular}{p{5cm}} 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    60
  \includegraphics[scale=0.265]{../pics/code.jpg}\\
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    61
  \raggedright
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    62
  {\bf code}: \\
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    63
  \raggedright\small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    64
  programmers have very little intuition about their code; 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    65
  often it is too expensive to have redundancy;
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    66
  not ``continuous'' 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    67
  \end{tabular}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    68
  \end{tabular}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    69
  \end{center}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    70
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    71
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    72
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    73
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    74
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    75
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    76
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    77
  \frametitle{Dijkstra on Testing}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    78
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    79
  \begin{bubble}[10cm]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    80
  ``Program testing can be a very effective way to show the
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    81
  presence of bugs, but it is hopelessly inadequate for showing
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    82
  their absence.''
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    83
  \end{bubble}\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    84
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    85
  unfortunately attackers exploit bugs (Satan's computer vs 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    86
  Murphy's)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    87
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    88
  \vfill
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    89
  \small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    90
  Dijkstra: shortest path algorithm, 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    91
  dining philosophers problem,
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    92
  semaphores
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    93
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    94
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    95
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    96
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    97
\begin{frame}[c]
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    98
\frametitle{\Large Proving Programs to be Correct}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    99
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   100
\begin{bubble}[10cm]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   101
\small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   102
{\bf Theorem:} There are infinitely many prime 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   103
numbers.\medskip\\
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   104
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   105
{\bf Proof} \ldots\\
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   106
\end{bubble}\bigskip
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   107
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   108
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   109
similarly\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   110
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   111
\begin{bubble}[10cm]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   112
\small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   113
{\bf Theorem:} The program is doing what 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   114
it is sup+ed to be doing.\medskip
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   115
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   116
{\bf Long, long proof} \ldots\\
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   117
\end{bubble}\bigskip\medskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   118
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   119
\small This can be a gigantic proof. The only hope is to have
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   120
help from the computer. `Program' is here to be understood to be
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   121
quite general (protocol, OS,\ldots).
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   122
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   123
\end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   124
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   125
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   126
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   127
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   128
  \frametitle{\Large{}Mars Pathfinder Mission 1997}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   129
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   130
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   131
  \includegraphics[scale=0.15]{../pics/marspath1.png}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   132
  \includegraphics[scale=0.16]{../pics/marspath3.png}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   133
  \includegraphics[scale=0.3]{../pics/marsrover.png}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   134
  \end{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   135
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   136
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   137
  \item despite NASA's famous testing procedures, the lander crashed frequently on Mars
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   138
  \item a scheduling algorithm was not used in the OS
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   139
  \end{itemize}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   140
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   141
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   142
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   143
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   144
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   145
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   146
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   147
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   148
  \begin{textblock}{11}(1,3)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   149
  \begin{tabular}{@{\hspace{-10mm}}l}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   150
  \begin{tikzpicture}[scale=1.1]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   151
  \node at (-2.5,-1.5) {\textcolor{white}{a}};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   152
  \node at (8,4) {\textcolor{white}{a}};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   153
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   154
    
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
   155
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   156
  \only<1>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   157
   \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   158
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   159
  \only<2>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   160
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   161
   \draw[fill, blue!50] (3,0) rectangle (5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   162
   \draw[fill, blue!100] (2,3) rectangle (3,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   163
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   164
  \only<3>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   165
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   166
   \draw[fill, blue!50] (3,0) rectangle (4.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   167
   \draw[fill, blue!50] (5.5,0) rectangle (6,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   168
   \draw[fill, blue!100] (2,3) rectangle (3,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   169
   \draw[fill, blue!100] (4.5,3) rectangle (5.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   170
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   171
  \only<4>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   172
   \node at (2.5,0.9) {\small locked a resource};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   173
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   174
   \draw[blue!50, very thick] (2,0) rectangle (4,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   175
   \draw[blue!100, very thick] (2,3) rectangle (3, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   176
   \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   177
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   178
  \only<5>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   179
   \node at (2.5,0.9) {\small locked a resource};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   180
   \draw[fill, blue!50] (1,0) rectangle (4,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   181
   \draw[blue!100, fill] (4,3) rectangle (5, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   182
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   183
  \only<6>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   184
   \node at (2.5,0.9) {\small locked a resource};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   185
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   186
   \draw[blue!50, very thick] (2,0) rectangle (4,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   187
   \draw[blue!100, very thick] (2,3) rectangle (3, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   188
   \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   189
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   190
  \only<7>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   191
   \node at (2.5,0.9) {\small locked a resource};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   192
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   193
   \draw[blue!50, very thick] (2.5,0) rectangle (4,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   194
   \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   195
   \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   196
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   197
  \only<8>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   198
   \node at (2.5,0.9) {\small locked a resource}; 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   199
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   200
   \draw[blue!50, very thick] (2.5,0) rectangle (4,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   201
   \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   202
   \draw[blue!100, very thick] (2.5,3) rectangle (3.5, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   203
   \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   204
   \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   205
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   206
  \only<9>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   207
   \node at (2.5,0.9) {\small locked a resource}; 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   208
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   209
   \draw[blue!50, very thick] (3.5,0) rectangle (5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   210
   \draw[blue!100, very thick] (3.5,3) rectangle (4.5, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   211
   \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   212
   \draw[red, <-, line width = 2mm] (3.5,-0.1) -- (3.5, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   213
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   214
  \only<10>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   215
   \node at (2.5,0.9) {\small locked a resource}; 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   216
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   217
   \draw[blue!50, very thick] (3.5,0) rectangle (5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   218
   \draw[blue!100, very thick] (3.5,3) rectangle (4.5, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   219
   \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   220
   \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   221
   \draw[red, <-, line width = 2mm] (3.5,-0.1) -- (3.5, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   222
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   223
  \only<11>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   224
   \node at (2.5,0.9) {\small locked a resource};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   225
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   226
   \draw[blue!50, very thick] (4.5,0) rectangle (6,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   227
   \draw[blue!100, very thick] (4.5,3) rectangle (5.5, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   228
   \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   229
   \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   230
   \draw[red, <-, line width = 2mm] (4.5,-0.1) -- (4.5, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   231
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   232
  \only<12>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   233
   \node at (2.5,0.9) {\small locked a resource}; 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   234
   \draw[fill, blue!50] (1,0) rectangle (2.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   235
   \draw[blue!50, very thick] (5.5,0) rectangle (7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   236
   \draw[blue!100, very thick] (5.5,3) rectangle (6.5, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   237
   \draw[red, fill] (2.5,1.5) rectangle (3.5,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   238
   \draw[red, fill] (3.55,1.5) rectangle (4.5,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   239
   \draw[red, fill] (4.55,1.5) rectangle (5.5,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   240
   \draw[red, <-, line width = 2mm] (5.5,-0.1) -- (5.5, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   241
   \node [anchor=base] at (6.3, 1.8) {\Large\ldots};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   242
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   243
  \only<13>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   244
   \node at (2.5,0.9) {\small locked a resource}; 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   245
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   246
   \draw[blue!50, very thick] (2,0) rectangle (4,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   247
   \draw[blue!100, very thick] (2,3) rectangle (3, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   248
   \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   249
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   250
  \only<14>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   251
   \node at (2.5,3.9) {\small locked a resource}; 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   252
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   253
   \draw[blue!50, fill] (2,3) rectangle (4,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   254
   \draw[blue!100, very thick] (4,3) rectangle (5, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   255
   \draw[blue!50, ->, line width = 2mm] (2,1) -- (2, 2.5);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   256
   \draw[red, <-, line width = 2mm] (2,-0.1) -- (2, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   257
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   258
  \only<15>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   259
   \node at (2.5,3.9) {\small locked a resource};  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   260
   \draw[fill, blue!50] (1,0) rectangle (2,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   261
   \draw[blue!50, fill] (2,3) rectangle (4,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   262
   \draw[blue!100, very thick] (4,3) rectangle (5, 3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   263
   \draw[red, <-, line width = 2mm] (2.5,-0.1) -- (2.5, -1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   264
   \draw[red, very thick] (2.5,1.5) rectangle (3.5,2.1); 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   265
  }
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   266
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   267
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   268
  \draw[very thick,->](0,0) -- (8,0);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   269
  \node [anchor=base] at (8, -0.3) {\scriptsize time};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   270
  \node [anchor=base] at (0, -0.3) {\scriptsize 0};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   271
  \node [anchor=base] at (-1.2, 0.2) {\small low priority};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   272
  \only<2->{\node [anchor=base] at (-1.2, 3.2) {\small high priority};}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   273
  \only<8->{\node [anchor=base] at (-1.5, 1.7) {\small medium pr.};}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   274
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   275
  \end{tikzpicture}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   276
  \end{tabular}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   277
  \end{textblock}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   278
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   279
  \begin{textblock}{0}(2.5,13)%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   280
  \small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   281
  \onslide<3->{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   282
  \begin{bubble}[8cm]%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   283
  Scheduling: You want to avoid that a high 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   284
  priority process is staved indefinitely.
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   285
  \end{bubble}}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   286
  \end{textblock}
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
   287
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   288
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   289
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   290
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   291
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   292
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   293
  \frametitle{\Large Priority Inheritance Scheduling}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   294
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   295
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   296
  \item Let a low priority process $L$ temporarily inherit 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   297
    the high priority of $H$ until $L$ leaves the critical 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   298
    section unlocking the resource.\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   299
  \item Once the resource is unlocked $L$ returns to its original 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   300
    priority level.
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   301
  \end{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   302
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   303
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   304
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   305
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   306
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   307
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   308
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   309
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   310
  \begin{textblock}{11}(1,3)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   311
  \begin{tabular}{@{\hspace{-10mm}}l}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   312
  \begin{tikzpicture}[scale=1.1]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   313
  \node at (-2.5,-1.5) {\textcolor{white}{a}};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   314
  \node at (8,4) {\textcolor{white}{a}};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   315
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   316
    
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   317
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   318
  \only<1>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   319
    \draw[fill, blue!50] (1,0) rectangle (6,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   320
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   321
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   322
    \node at (3.5,0.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   323
    \node at (5.7,0.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   324
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   325
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   326
    \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   327
    \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   328
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   329
  \only<2>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   330
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   331
    \draw[very thick, blue!50] (3,0) rectangle (6,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   332
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   333
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   334
    \node at (3.5,0.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   335
    \node at (5.7,0.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   336
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   337
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   338
    \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   339
    \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   340
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   341
  \only<3>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   342
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   343
    \draw[very thick, blue!50] (3,0) rectangle (6,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   344
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   345
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   346
    \node at (3.5,0.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   347
    \node at (5.7,0.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   348
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   349
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   350
    \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   351
    \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   352
    \draw[very thick,blue!100] (3,3) rectangle (4,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   353
    \node at (3.5,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   354
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   355
  \only<4>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   356
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   357
    \draw[very thick, blue!50] (3,0) rectangle (6,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   358
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   359
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   360
    \node at (3.5,0.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   361
    \node at (5.7,0.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   362
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   363
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   364
    \draw[very thick,blue!100] (3.5,0) -- (3.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   365
    \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   366
    \draw[very thick,blue!100] (3,3) rectangle (4,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   367
    \node at (3.5,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   368
    \draw[very thick,blue!100] (4,3) rectangle (5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   369
    \node at (4.5,3.3) {\small $B$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   370
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   371
  \only<5>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   372
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   373
    \draw[very thick, blue!50] (3,3) rectangle (6,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   374
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   375
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   376
    \node at (3.5,3.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   377
    \node at (5.7,3.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   378
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   379
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   380
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   381
    \draw[very thick,blue!100] (5.7,3) -- (5.7,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   382
    \draw[very thick,blue!100] (6,3) rectangle (7,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   383
    \node at (6.5,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   384
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   385
    \node at (7.5,3.3) {\small $B$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   386
    \draw[blue!50, ->, line width = 2mm] (3,1) -- (3, 2.5);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   387
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   388
  \only<6>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   389
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   390
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   391
    \draw[very thick, blue!50] (3.5,3) rectangle (6,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   392
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   393
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   394
    \node at (3.5,3.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   395
    \node at (5.7,3.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   396
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   397
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   398
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   399
    \draw[very thick,blue!100] (5.7,3) -- (5.7,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   400
    \draw[very thick,blue!100] (6,3) rectangle (7,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   401
    \node at (6.5,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   402
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   403
    \node at (7.5,3.3) {\small $B$}; 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   404
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   405
  \only<7>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   406
   \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   407
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   408
    \draw[very thick, blue!50] (3.5,0) rectangle (6,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   409
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   410
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   411
    \node at (3.5,3.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   412
    \node at (5.7,0.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   413
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   414
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   415
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   416
    \draw[very thick,blue!100] (5.7,0) -- (5.7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   417
    \draw[very thick,blue!100] (6,3) rectangle (7,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   418
    \node at (6.5,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   419
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   420
    \node at (7.5,3.3) {\small $B$};  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   421
    \draw[blue!50, <-, line width = 2mm] (3.5,1) -- (3.5, 2.5);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   422
    \draw[blue!50, <-, line width = 2mm] (4,3.3) -- (5.5,3.3);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   423
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   424
  \only<8>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   425
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   426
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   427
    \draw[very thick, blue!50] (4.5,0) rectangle (7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   428
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   429
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   430
    \node at (3.5,3.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   431
    \node at (6.7,0.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   432
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   433
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   434
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   435
    \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   436
    \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   437
    \node at (4,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   438
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   439
    \node at (7.5,3.3) {\small $B$};  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   440
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   441
  \only<9>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   442
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   443
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   444
    \draw[fill, blue!50] (4.5,0) rectangle (5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   445
    \draw[very thick, blue!50] (5,0) rectangle (7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   446
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   447
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   448
    \node at (3.5,3.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   449
    \node at (6.7,0.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   450
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   451
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   452
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   453
    \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   454
    \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   455
    \node at (4,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   456
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   457
    \node at (7.5,3.3) {\small $B$};  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   458
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   459
  \only<10>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   460
    \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   461
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   462
    \draw[fill, blue!50] (4.5,0) rectangle (5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   463
    \draw[very thick, blue!50] (5,0) rectangle (7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   464
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   465
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   466
    \node at (3.5,3.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   467
    \node at (6.7,0.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   468
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   469
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   470
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   471
    \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   472
    \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   473
    \node at (4,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   474
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   475
    \node at (7.5,3.3) {\small $B$};  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   476
    \draw[red, fill] (5,1.5) rectangle (6,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   477
    \draw[red, fill] (6.05,1.5) rectangle (7,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   478
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   479
  \only<11>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   480
   \draw[fill, blue!50] (1,0) rectangle (3,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   481
    \draw[fill, blue!50] (3,3) rectangle (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   482
    \draw[fill, blue!50] (4.5,0) rectangle (5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   483
    \draw[very thick, blue!50] (5,0) rectangle (7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   484
    \node at (1.5,0.9) {\small $A_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   485
    \node at (2.0,0.9) {\small $B_L$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   486
    \node at (3.5,3.9) {\small $A_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   487
    \node at (6.7,0.9) {\small $B_R$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   488
    \draw[very thick,blue!100] (1.5,0) -- (1.5,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   489
    \draw[very thick,blue!100] (2.0,0) -- (2.0,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   490
    \draw[very thick,blue!100] (3.5,3) -- (3.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   491
    \draw[very thick,blue!100] (6.7,0) -- (6.7,0.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   492
    \draw[fill,blue!100] (3.5,3) rectangle (4.5,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   493
    \node at (4,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   494
    \draw[very thick,blue!100] (7,3) rectangle (8,3.6);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   495
    \node at (7.5,3.3) {\small $B$};  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   496
    \draw[red, fill] (5,1.5) rectangle (6,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   497
    \draw[red, fill] (6.05,1.5) rectangle (7,2.1);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   498
    \draw[blue!50, ->, line width = 2mm] (7.1,0.4) -- (8, 0.4);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   499
    \draw[blue!50, ->, line width = 2mm] (7.1,4) -- (8,4);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   500
  }
76
dde58256fc35 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 75
diff changeset
   501
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   502
  \draw[very thick,->](0,0) -- (8,0);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   503
  \node [anchor=base] at (8, -0.3) {\scriptsize time};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   504
  \node [anchor=base] at (0, -0.3) {\scriptsize 0};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   505
  \node [anchor=base] at (-1.2, 0.2) {\small low priority};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   506
  \only<2->{\node [anchor=base] at (-1.2, 3.2) {\small high priority};}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   507
  \only<10->{\node [anchor=base] at (-1.5, 1.7) {\small medium pr.};}
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
   508
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   509
  \end{tikzpicture}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   510
  \end{tabular}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   511
  \end{textblock}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   512
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   513
  \begin{textblock}{0}(2.5,13)%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   514
  \small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   515
  \onslide<11>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   516
  \begin{bubble}[8cm]%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   517
  Scheduling: You want to avoid that a high 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   518
  priority process is staved indefinitely.
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   519
  \end{bubble}}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   520
  \end{textblock}
79
2eaca58f9bcc updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 78
diff changeset
   521
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
   522
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   523
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   524
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   525
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   526
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   527
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   528
  \frametitle{\Large Priority Inheritance Scheduling}
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
   529
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   530
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   531
  \item Let a low priority process $L$ temporarily inherit 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   532
    the high priority of $H$ until $L$ leaves the critical 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   533
    section unlocking the resource.\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   534
  \item Once the resource is unlocked $L$ returns to its original 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   535
    priority level. \alert{\bf BOGUS}\pause\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   536
  \item \ldots $L$ needs to switch to the highest 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   537
    \alert{remaining} priority of the threads that it blocks.
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   538
  \end{itemize}\bigskip
76
dde58256fc35 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 75
diff changeset
   539
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   540
  \small this error is already known since around 1999
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   541
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   542
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   543
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
76
dde58256fc35 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 75
diff changeset
   544
dde58256fc35 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 75
diff changeset
   545
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   546
  \begin{frame}[c]
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   547
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   548
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   549
  \includegraphics[scale=0.25]{../pics/p3.jpg}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   550
  \end{center}
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   551
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   552
   \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   553
  \item by Rajkumar, 1991
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   554
  \item \it ``it resumes the priority it had at the point of entry into the critical 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   555
  section''
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   556
  \end{itemize}
148
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 147
diff changeset
   557
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   558
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   559
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   560
     
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   561
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   562
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   563
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   564
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   565
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   566
  \includegraphics[scale=0.25]{../pics/p2.jpg}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   567
  \end{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   568
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   569
   \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   570
  \item by Jane Liu, 2000
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   571
  \item {\it ``The job $J_l$ executes at its inherited 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   572
    priority until it releases $R$; at that time, the 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   573
    priority of $J_l$ returns to its priority 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   574
    at the time when it acquires the resource $R$.''}\medskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   575
  \item \small gives pseudo code and totally bogus data structures  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   576
  \item \small interesting part ``{\it left as an exercise}''
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   577
  \end{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   578
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   579
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   580
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   581
     
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   582
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   583
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   584
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   585
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   586
  \includegraphics[scale=0.15]{../pics/p1.pdf}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   587
  \end{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   588
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   589
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   590
  \item by Laplante and Ovaska, 2011 (\$113.76)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   591
  \item \it ``when $[$the task$]$ exits the critical section that
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   592
        caused the block, it reverts to the priority it had
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   593
        when it entered that section'' 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   594
  \end{itemize}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   595
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   596
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   597
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   598
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   599
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   600
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   601
  \frametitle{Priority Scheduling}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   602
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   603
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   604
  \item a scheduling algorithm that is widely used in real-time operating systems
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   605
  \item has been ``proved'' correct by hand in a paper in 1983
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   606
  \item but this algorithm turned out to be incorrect, despite its ``proof''\bigskip\pause
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   607
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   608
  \item we corrected the algorithm and then {\bf really} proved that it is correct	
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   609
  \item we implemented this algorithm in a small OS called PINTOS (used for teaching at Stanford)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   610
  \item our implementation was much more efficient than their reference implementation
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   611
  \end{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   612
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   613
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   614
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   615
   
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   616
   
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   617
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   618
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   619
  \frametitle{Design of AC-Policies}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   620
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   621
  \Large
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   622
  \begin{quote}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   623
  ''what you specify is what you get but not necessarily what you want\ldots''
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   624
  \end{quote}\bigskip\bigskip\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   625
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   626
  \normalsize main work by Chunhan Wu (PhD-student)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   627
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   628
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   629
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   630
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   631
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   632
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   633
  \frametitle{Testing Policies}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   634
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   635
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   636
  \begin{tikzpicture}[scale=1]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   637
  %\draw[black!10,step=2mm] (-5,-3) grid (5,4);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   638
  %\draw[black!10,thick,step=10mm] (-5,-3) grid (5,4);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   639
  \draw[white,thick,step=10mm] (-5,-3) grid (5,4);
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   640
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   641
  \draw [black!20, line width=1mm] (0,0) circle (1cm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   642
  \draw [line width=1mm] (0,0) circle (3cm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   643
  \node [black!20] at (0,0) {\begin{tabular}{c}core\\[-1mm] system\end{tabular}};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   644
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   645
  \draw [red, line width=2mm, <-] (-2.1,2.1) -- (-3.5,3.2);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   646
  \node at (-3.5,3.6) {your system};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   647
  \node at (-4.8,0) {\Large policy $+$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   648
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   649
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   650
  \only<2>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   651
  \draw [black, fill=red, line width=0.5mm] (2,1) circle (3mm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   652
  \draw [red, line width=2mm, <-] (2.3,1.2) -- (3.5,2);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   653
  \node at (3.8,2.6) {\begin{tabular}{l}a seed\\[-1mm] \footnotesize virus, Trojan\end{tabular}};}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   654
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   655
  \only<3>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   656
  \draw [black, fill=red, line width=0.5mm] (2,1) circle (7mm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   657
  \node[white] at (2,1) {\small tainted};}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   658
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   659
  \only<4>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   660
  \begin{scope}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   661
  \draw [clip] (0,0) circle (2.955cm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   662
  \draw [black, fill=red, line width=0.5mm] (2,1) circle (9mm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   663
  \node[white] at (2,1) {\small tainted};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   664
  \end{scope}}
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   665
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   666
  \only<5->{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   667
  \begin{scope}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   668
  \draw [clip] (0,0) circle (2.955cm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   669
  \draw [black, fill=red, line width=0.5mm] (2,1) circle (13mm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   670
  \node[white] at (2,1) {\small tainted};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   671
  \end{scope}}
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   672
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   673
  \only<6->{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   674
  \draw[fill=white, line width=1mm] (1.265,2.665) arc (-35:183:5mm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   675
  \draw[fill=white, line width=1mm] (1.25,3.25) arc (-35:183:3mm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   676
  \node[black, rotate=10] at (1.9,3.6) {\LARGE\ldots};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   677
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   678
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   679
  \end{tikzpicture}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   680
  \end{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   681
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   682
  \end{frame}
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   683
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   684
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   685
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   686
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   687
  \frametitle{A Sound and Complete Test}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   688
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   689
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   690
  \item working purely in the \emph{dynamic world} does not work -\!-\!- infinite state space\bigskip
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   691
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   692
  \item working purely on \emph{static} policies also does not\\ work -\!-\!- because of over approximation
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   693
  \smallskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   694
  \begin{itemize}
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   695
  \item sup+e a tainted file has type \emph{bin} and
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   696
  \item there is a role \bl{$r$} which can both read and write \emph{bin}-files\pause
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   697
  \item then we would conclude that this tainted file can spread\medskip\pause
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   698
  \item but if there is no process with role \bl{$r$} and it will never been
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   699
  created, then the file actually does not spread
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   700
  \end{itemize}\bigskip\pause
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   701
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   702
  \item \alert{our solution:} take a middle ground and record precisely the information
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   703
  of the initial state, but be less precise about every newly created object.
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   704
  \end{itemize}
77
56dbc339ec87 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   705
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   706
  \end{frame}
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   707
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   708
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   709
\begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   710
\frametitle{Big Proofs in CS}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   711
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   712
Formal proofs in CS sound like science fiction? Completely irrelevant!
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   713
Lecturer gone mad?\pause
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   714
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   715
\begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   716
\item in 2008, verification of a small C-compiler
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   717
\begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   718
\item ``if my input program has a certain behaviour, then the compiled machine code has the same behaviour''
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   719
\item is as good as \texttt{gcc -O1}, but much less buggy 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   720
\end{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   721
\medskip 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   722
\item in 2010, verification of a micro-kernel operating system (approximately 8700 loc)
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   723
\begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   724
\item 200k loc of proof
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   725
\item 25 - 30 person years
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   726
\item found 160 bugs in the C code (144 by the proof)
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   727
\end{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   728
\end{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   729
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   730
\end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   731
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   732
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
149
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
   733
\begin{frame}[c]
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   734
\frametitle{Goal}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   735
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   736
Remember the Bridges example?
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   737
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   738
\begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   739
\item Can we look at our programs and somehow ensure
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   740
they are secure/bug free/correct?\pause\bigskip
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   741
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   742
\item Very hard: Anything interesting about programs is equivalent
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   743
to halting problem, which is undecidable.\pause\bigskip
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   744
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   745
\item \alert{Solution:} We avoid this ``minor'' obstacle by
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   746
      being as close as +sible of deciding the halting
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   747
      problem, without actually deciding the halting problem.
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   748
      $\quad\Rightarrow$ static analysis
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   749
\end{itemize}
87
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   750
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   751
\end{frame}
87
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   752
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   753
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   754
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   755
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   756
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   757
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   758
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   759
  \includegraphics[scale=0.4]{../pics/state.png}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   760
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   761
  
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   762
  \begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   763
  \item depending on some initial input, a program 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   764
  (behaviour) will ``develop'' over time.
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   765
  \end{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   766
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   767
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   768
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   769
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   770
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   771
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   772
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   773
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   774
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   775
  \includegraphics[scale=0.4]{../pics/state2.png}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   776
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   777
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   778
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   779
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   780
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   781
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   782
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   783
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   784
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   785
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   786
  \includegraphics[scale=0.4]{../pics/state3.jpg}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   787
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   788
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   789
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   790
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   791
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   792
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   793
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   794
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   795
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   796
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   797
  \includegraphics[scale=0.4]{../pics/state4.jpg}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   798
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   799
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   800
  \begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   801
  \item to be avoided
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   802
  \end{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   803
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   804
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   805
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   806
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   807
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   808
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   809
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   810
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   811
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   812
  \includegraphics[scale=0.4]{../pics/state5.png}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   813
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   814
  
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   815
  \begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   816
  \item this needs more work
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   817
  \end{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   818
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   819
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   820
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   821
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   822
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   823
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   824
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   825
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   826
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   827
  \includegraphics[scale=0.4]{../pics/state6.png}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   828
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   829
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   830
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   831
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   832
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   833
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   834
\begin{frame}[fragile]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   835
\frametitle{\large Concrete Example: Sign-Analysis}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   836
\mbox{}\\[-20mm]\mbox{}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   837
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   838
\bl{\begin{plstx}[rhs style=,one per line]
: \meta{Exp} ::= \meta{Exp} + \meta{Exp}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   839
         | \meta{Exp} * \meta{Exp}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   840
         | \meta{Exp} = \meta{Exp} 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   841
         | \meta{num}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   842
         | \meta{var}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   843
: \meta{Stmt} ::= \meta{label} :
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   844
         | \meta{var} := \meta{Exp}
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   845
         | jmp? \meta{Exp} \meta{label}
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   846
         | goto \meta{label}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   847
: \meta{Prog} ::= \meta{Stmt} \ldots\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   848
\end{plstx}}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   849
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   850
\end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   851
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   852
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   853
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   854
\begin{frame}[fragile]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   855
\frametitle{\large Concrete Example: Sign-Analysis}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   856
\mbox{}\\[-20mm]\mbox{}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   857
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   858
\bl{\begin{plstx}[rhs style=,one per line]
: \meta{Exp} ::= \meta{Exp} + \meta{Exp}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   859
         | \meta{Exp} * \meta{Exp}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   860
         | \meta{Exp} = \meta{Exp} 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   861
         | \meta{num}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   862
         | \meta{var}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   863
: \meta{Stmt} ::= \meta{label} :
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   864
         | \meta{var} := \meta{Exp}
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   865
         | jmp? \meta{Exp} \meta{label}
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   866
         | goto \meta{label}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   867
: \meta{Prog} ::= \meta{Stmt} \ldots\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   868
\end{plstx}}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   869
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   870
\begin{textblock}{0}(7.8,2.5)
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   871
\small
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   872
\begin{bubble}[5.6cm]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   873
\begin{lstlisting}[numbers=none,
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   874
                   basicstyle=\ttfamily,
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   875
                   language={},xleftmargin=3mm]
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   876
      a := 1
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   877
      n := 5 
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   878
top:  jmp? n = 0 done 
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   879
      a := a * n 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   880
      n := n + -1 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   881
      goto top 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   882
done:
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   883
\end{lstlisting}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   884
\end{bubble}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   885
\end{textblock}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   886
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   887
\end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   888
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   889
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   890
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   891
\begin{frame}[fragile]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   892
\frametitle{\large Concrete Example: Sign-Analysis}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   893
\mbox{}\\[-20mm]\mbox{}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   894
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   895
\bl{\begin{plstx}[rhs style=,one per line]
: \meta{Exp} ::= \meta{Exp} + \meta{Exp}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   896
         | \meta{Exp} * \meta{Exp}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   897
         | \meta{Exp} = \meta{Exp} 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   898
         | \meta{num}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   899
         | \meta{var}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   900
: \meta{Stmt} ::= \meta{label} :
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   901
         | \meta{var} := \meta{Exp}
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   902
         | jmp? \meta{Exp} \meta{label}
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   903
         | goto \meta{label}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   904
: \meta{Prog} ::= \meta{Stmt} \ldots\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   905
\end{plstx}}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   906
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   907
\begin{textblock}{0}(7.8,3.5)
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   908
\small
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   909
\begin{bubble}[5.6cm]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   910
\begin{lstlisting}[numbers=none,
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   911
                   basicstyle=\ttfamily,
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   912
                   language={},xleftmargin=3mm]
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   913
      n := 6
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   914
      m1 := 0
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   915
      m2 := 1
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   916
top:  jmp? n = 0 done
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   917
      tmp := m2
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   918
      m2 := m1 + m2
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   919
      m1 := tmp
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   920
      n := n + -1
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   921
      goto top
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   922
done:
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   923
\end{lstlisting}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   924
\end{bubble}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   925
\end{textblock}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   926
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   927
\end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   928
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   929
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   930
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   931
\begin{frame}[fragile]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   932
\frametitle{Eval}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   933
\mbox{}\\[-18mm]\mbox{}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   934
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   935
\small
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   936
\begin{center}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   937
\bl{\begin{tabular}{lcl}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   938
$[n]_{env}$ & $\dn$ & $n$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   939
$[x]_{env}$ & $\dn$ & $env(x)$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   940
$[e_1 + e_2]_{env}$ & $\dn$ & $[e_1]_{env} + [e_2]_{env}$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   941
$[e_1 * e_2]_{env}$ & $\dn$ & $[e_1]_{env} * [e_2]_{env}$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   942
$[e_1 = e_2]_{env}$ & $\dn$ & 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   943
$\begin{cases}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   944
1 & \text{if}\quad[e_1]_{env} = [e_2]_{env}\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   945
0 & \text{otherwise}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   946
\end{cases}$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   947
\end{tabular}}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   948
\end{center}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   949
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   950
\footnotesize
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   951
\begin{lstlisting}[numbers=none,xleftmargin=-5mm]
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   952
def eval_exp(e: Exp, env: Env) : Int = e match {
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   953
  case Num(n) => n
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   954
  case Var(x) => env(x)
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   955
  case Plus(e1, e2) => eval_exp(e1, env) + eval_exp(e2, env)
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   956
  case Times(e1, e2) => eval_exp(e1, env) * eval_exp(e2, env)
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   957
  case Equ(e1, e2) => 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   958
    if (eval_exp(e1, env) == eval_exp(e2, env)) 1 else 0
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   959
}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   960
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   961
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   962
\end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   963
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   964
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   965
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   966
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   967
\begin{frame}[fragile]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   968
\small
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   969
A program
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   970
\begin{bubble}[6cm]\footnotesize
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   971
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   972
                   language={},
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   973
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   974
                   xleftmargin=1mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   975
      a := 1
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   976
      n := 5 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   977
top:  jmp? n = 0 done 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   978
      a := a * n 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   979
      n := n + -1 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   980
      goto top 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   981
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   982
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   983
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   984
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   985
Some snippets
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   986
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   987
\footnotesize
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   988
\begin{columns}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   989
\begin{column}[t]{5cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   990
\begin{bubble}[4.5cm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   991
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   992
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   993
                   language={},xleftmargin=1mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   994
""    a := 1
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   995
      n := 5 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   996
top:  jmp? n = 0 done 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   997
      a := a * n 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   998
      n := n + -1 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   999
      goto top 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1000
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1001
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1002
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1003
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1004
\begin{column}[t]{5cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1005
\begin{bubble}[4.5cm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1006
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1007
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1008
                   language={},xleftmargin=1mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1009
top:  jmp? n = 0 done 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1010
      a := a * n 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1011
      n := n + -1 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1012
      goto top 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1013
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1014
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1015
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1016
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1017
\begin{column}[t]{2cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1018
\begin{bubble}[1.1cm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1019
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1020
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1021
                   language={},xleftmargin=1mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1022
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1023
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1024
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1025
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1026
\end{columns}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1027
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1028
\end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1029
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1030
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1031
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1032
\begin{frame}[fragile]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1033
\frametitle{Eval for Stmts}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1034
\mbox{}\\[-12mm]\mbox{}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1035
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1036
Let \bl{$sn$} be the snippets of a program
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1037
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1038
\small
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1039
\begin{center}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1040
\bl{\begin{tabular}{lcl}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1041
$[\texttt{nil}]_{env}$ & $\dn$ & $env$\medskip\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1042
$[\texttt{Label}(l:)::rest]_{env}$ & $\dn$ & $[rest]_{env}$\medskip\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1043
$[x \,\texttt{:=}\, e::rest]_{env}$ & $\dn$ & 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1044
$[rest]_{(env[x:= [e]_{env}])}$\medskip\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1045
$[\texttt{jmp?}\;e\;l::rest]_{env}$ & $\dn$ & 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1046
$\begin{cases}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1047
[sn(l)]_{env} & \text{if}\quad[e]_{env} = 1\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1048
[rest]_{env}  & \text{otherwise}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1049
\end{cases}$\medskip\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1050
$[\texttt{goto}\;l::rest]_{env}$ & $\dn$ & $[sn(l)]_{env}$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1051
\end{tabular}}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1052
\end{center}\bigskip
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1053
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1054
Start with \bl{$[sn(\mbox{\code{""}})]_{\varnothing}$}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1055
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1056
\end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1057
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1058
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1059
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1060
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1061
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1062
\begin{frame}[fragile]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1063
\frametitle{Eval in Code}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1064
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1065
\footnotesize
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1066
\begin{lstlisting}[language=Scala,numbers=none,xleftmargin=-5mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1067
def eval(sn: Snips) : Env = {
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1068
  def eval_stmts(sts: Stmts, env: Env) : Env = sts match {
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1069
    case Nil => env
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1070
    case Label(l)::rest => eval_stmts(rest, env)
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1071
    case Assign(x, e)::rest => 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1072
      eval_stmts(rest, env + (x -> eval_exp(e, env)))
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1073
    case Jmp(b, l)::rest => 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1074
      if (eval_exp(b, env) == 1) eval_stmts(sn(l), env) 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1075
      else eval_stmts(rest, env)
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1076
    case Goto(l)::rest => eval_stmts(sn(l), env)
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1077
  }
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1078
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1079
  eval_stmts(sn(""), Map())
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1080
}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1081
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1082
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1083
\end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1084
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1085
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1086
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1087
\begin{frame}[fragile]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1088
\frametitle{The Idea}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1089
\small
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1090
\mbox{}\bigskip\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1091
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1092
\begin{columns}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1093
\begin{column}{5cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1094
\begin{bubble}[4.5cm]\footnotesize
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1095
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1096
                   language={},
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1097
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1098
                   xleftmargin=1mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1099
      a := 1
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1100
      n := 5 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1101
top:  jmp? n = 0 done 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1102
      a := a * n 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1103
      n := n + -1 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1104
      goto top 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1105
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1106
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1107
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1108
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1109
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1110
\begin{column}{1cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1111
\raisebox{-20mm}{\LARGE\bf$\Rightarrow$}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1112
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1113
\begin{column}{6cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1114
\begin{bubble}[4.7cm]\footnotesize
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1115
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1116
                   language={},
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1117
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1118
                   xleftmargin=1mm,
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1119
                   escapeinside={(*}{*)}]
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1120
      a := (*\hl{'+'}*)
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1121
      n := (*\hl{'+'}*) 
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1122
top:  jmp? n = (*\hl{'0'}*) done 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1123
      a := a * n 
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1124
      n := n + (*\hl{'-'}*) 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1125
      goto top 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1126
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1127
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1128
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1129
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1130
\end{columns}\bigskip\bigskip
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1131
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1132
Replace all constants and variables by either 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1133
\pcode{+}, \pcode{-} or \pcode{0}. What we want to find out
337
92a718b88e14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 336
diff changeset
  1134
is what the sign of \texttt{a} and \texttt{n} is (they should 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1135
always positive).
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1136
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1137
\end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1138
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1139
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1140
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1141
  \begin{frame}[c]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1142
  \frametitle{Sign Analysis?}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1143
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1144
  
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1145
  \begin{columns}
334
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1146
  \begin{column}{3cm}
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1147
  \begin{tabular}{cc|l}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1148
  $e_1$ & $e_2$ & $e_1 + e_2$\\\hline{}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1149
  - & - & -\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1150
  - & 0 & -\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1151
  - & + & -, 0, +\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1152
  0 & $x$ & $x$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1153
  + & - & -, 0, +\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1154
  + & 0 & +\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1155
  + & + & +\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1156
  \end{tabular}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1157
  \end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1158
334
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1159
  \begin{column}{3cm}
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1160
  \begin{tabular}{cc|l}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1161
  $e_1$ & $e_2$ & $e_1 * e_2$\\\hline{}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1162
  - & - & +\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1163
  - & 0 & 0\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1164
  - & + & -\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1165
  0 & $x$ & 0\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1166
  + & - & -\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1167
  + & 0 & 0\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1168
  + & + & +\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1169
  \end{tabular}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1170
  \end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1171
  \end{columns}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1172
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1173
  \end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1174
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
  1175
334
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1176
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1177
\begin{frame}[fragile]
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1178
\mbox{}\\[-13mm]\mbox{}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1179
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1180
\small
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1181
\begin{center}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1182
\bl{\begin{tabular}{lcl}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1183
$[n]_{env}$ & $\dn$ & 
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1184
$\begin{cases}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1185
\{+\} & \text{if}\; n > 0\\
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1186
\{-\} & \text{if}\; n < 0\\
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1187
\{0\} & \text{if}\; n = 0
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1188
\end{cases}$\\
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1189
$[x]_{env}$ & $\dn$ & $env(x)$\\
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1190
$[e_1 + e_2]_{env}$ & $\dn$ & $[e_1]_{env} \oplus [e_2]_{env}$\\
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1191
$[e_1 * e_2]_{env}$ & $\dn$ & $[e_1]_{env} \otimes [e_2]_{env}$\\
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1192
$[e_1 = e_2]_{env}$ & $\dn$ & $\{0, +\}$\\
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1193
\end{tabular}}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1194
\end{center}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1195
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1196
\scriptsize
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1197
\begin{lstlisting}[language=Scala,numbers=none,xleftmargin=-5mm]
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1198
def aeval_exp(e: Exp, aenv: AEnv) : Set[Abst] = e match {
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1199
  case Num(0) => Set(Zero)
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1200
  case Num(n) if (n < 0) => Set(Neg)
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1201
  case Num(n) if (n > 0) => Set(Pos)
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1202
  case Var(x) => aenv(x)
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1203
  case Plus(e1, e2) => 
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1204
    aplus(aeval_exp(e1, aenv), aeval_exp(e2, aenv))
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1205
  case Times(e1, e2) => 
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1206
    atimes(aeval_exp(e1, aenv), aeval_exp(e2, aenv))
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1207
  case Equ(e1, e2) => Set(Zero, Pos)
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1208
}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1209
\end{lstlisting}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1210
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1211
\end{frame}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1212
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1213
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1214
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1215
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1216
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1217
  \begin{frame}[c]
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1218
  \frametitle{Sign Analysis}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1219
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1220
  \begin{itemize}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1221
  \item We want to find out whether \texttt{a} and \texttt{n}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1222
  are always positive?\medskip
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1223
  \item After a few optimisations, we can indeed find this out.
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1224
  \begin{itemize}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1225
  \item \texttt{if} returns \texttt{+} or \texttt{0}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1226
  \item branch into only one dircection if you know
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1227
  \item if $x$ is \texttt{+}, then $x + \texttt{-1}$ 
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1228
  cannot be negative 
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1229
  \end{itemize}\bigskip
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1230
  
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1231
  \item What is this good for? Well, you do not need 
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1232
  underflow checks (in order to prevent buffer-overflow
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1233
  attacks).
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1234
  \end{itemize}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1235
  
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1236
  \end{frame}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1237
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1238
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
  1239
76
dde58256fc35 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 75
diff changeset
  1240
\end{document}
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1241
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
  1242
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1243
%%% Local Variables:  
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1244
%%% mode: latex
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1245
%%% TeX-master: t
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1246
%%% End: 
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1247