slides/slides09.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Thu, 05 Nov 2015 02:11:13 +0000
changeset 422 abe178b3197e
parent 381 036a762b02cf
child 433 b1272782f902
permissions -rw-r--r--
finished ZKP protocols
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 
381
036a762b02cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
     9
\renewcommand{\slidecaption}{SEN 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
  \\
381
036a762b02cf updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 337
diff changeset
    19
  \LARGE Security Engineering (9)\\[-3mm] 
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
  \end{tabular}}\bigskip\bigskip\bigskip
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
    22
  \normalsize
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
  \begin{center}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
  \begin{tabular}{ll}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
  Email:  & christian.urban at kcl.ac.uk\\
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
    26
  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
    27
  Slides: & KEATS (also homework is there)\\
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
  \end{tabular}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
  \end{center}
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    31
\end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    32
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
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
  \begin{frame}[c]
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    37
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    38
  \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
    39
  \end{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    40
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    41
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    43
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    44
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    45
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    46
  \frametitle{Old-Fashioned Eng.~vs.~CS}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    47
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    48
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    49
  \begin{tabular}{@{}cc@{}}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    50
  \begin{tabular}{@{}p{5.2cm}} 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    51
  \includegraphics[scale=0.058]{../pics/towerbridge.jpg}\\ 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    52
  {\bf bridges}: \\
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    53
  \raggedright\small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    54
  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
    55
  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
    56
  (redundancy; predictive theory)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    57
  \end{tabular} &
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    58
  \begin{tabular}{p{5cm}} 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    59
  \includegraphics[scale=0.265]{../pics/code.jpg}\\
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    60
  \raggedright
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    61
  {\bf code}: \\
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    62
  \raggedright\small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    63
  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
    64
  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
    65
  not ``continuous'' 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    66
  \end{tabular}
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{center}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    69
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    70
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    71
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    72
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    73
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    75
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    76
  \frametitle{Dijkstra on Testing}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    77
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    78
  \begin{bubble}[10cm]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    79
  ``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
    80
  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
    81
  their absence.''
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    82
  \end{bubble}\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    83
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    84
  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
    85
  Murphy's)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    86
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    87
  \vfill
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    88
  \small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    89
  Dijkstra: shortest path algorithm, 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    90
  dining philosophers problem,
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    91
  semaphores
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    92
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    93
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    94
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
\begin{frame}[c]
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    97
\frametitle{\Large Proving Programs to be Correct}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    98
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    99
\begin{bubble}[10cm]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   100
\small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   101
{\bf Theorem:} There are infinitely many prime 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   102
numbers.\medskip\\
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   103
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   104
{\bf Proof} \ldots\\
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   105
\end{bubble}\bigskip
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   107
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   108
similarly\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   109
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   110
\begin{bubble}[10cm]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   111
\small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   112
{\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
   113
it is sup+ed to be doing.\medskip
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   114
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   115
{\bf Long, long proof} \ldots\\
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   116
\end{bubble}\bigskip\medskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   117
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   118
\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
   119
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
   120
quite general (protocol, OS,\ldots).
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   121
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   122
\end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   123
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   124
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   125
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   126
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   127
  \frametitle{\Large{}Mars Pathfinder Mission 1997}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   128
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   129
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   130
  \includegraphics[scale=0.15]{../pics/marspath1.png}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   131
  \includegraphics[scale=0.16]{../pics/marspath3.png}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   132
  \includegraphics[scale=0.3]{../pics/marsrover.png}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   133
  \end{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   134
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   135
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   136
  \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
   137
  \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
   138
  \end{itemize}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   139
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   140
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   141
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   142
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   143
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   144
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   145
  
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
  \begin{textblock}{11}(1,3)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   148
  \begin{tabular}{@{\hspace{-10mm}}l}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   149
  \begin{tikzpicture}[scale=1.1]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   150
  \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
   151
  \node at (8,4) {\textcolor{white}{a}};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   152
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   153
    
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
   154
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   155
  \only<1>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   156
   \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
   157
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   158
  \only<2>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   159
   \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
   160
   \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
   161
   \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
   162
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   163
  \only<3>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   164
   \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
   165
   \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
   166
   \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
   167
   \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
   168
   \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
   169
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   170
  \only<4>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   171
   \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
   172
   \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
   173
   \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
   174
   \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
   175
   \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
   176
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   177
  \only<5>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   178
   \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
   179
   \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
   180
   \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
   181
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   182
  \only<6>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   183
   \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
   184
   \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
   185
   \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
   186
   \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
   187
   \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
   188
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   189
  \only<7>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   190
   \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
   191
   \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
   192
   \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
   193
   \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
   194
   \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
   195
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   196
  \only<8>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   197
   \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
   198
   \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
   199
   \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
   200
   \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
   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[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
   203
   \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
   204
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   205
  \only<9>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   206
   \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
   207
   \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
   208
   \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
   209
   \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
   210
   \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
   211
   \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
   212
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   213
  \only<10>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   214
   \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
   215
   \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
   216
   \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
   217
   \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
   218
   \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
   219
   \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
   220
   \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
   221
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   222
  \only<11>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   223
   \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
   224
   \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
   225
   \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
   226
   \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
   227
   \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
   228
   \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
   229
   \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
   230
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   231
  \only<12>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   232
   \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
   233
   \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
   234
   \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
   235
   \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
   236
   \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
   237
   \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
   238
   \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
   239
   \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
   240
   \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
   241
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   242
  \only<13>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   243
   \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
   244
   \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
   245
   \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
   246
   \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
   247
   \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
   248
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   249
  \only<14>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   250
   \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
   251
   \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
   252
   \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
   253
   \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
   254
   \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
   255
   \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
   256
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   257
  \only<15>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   258
   \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
   259
   \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
   260
   \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
   261
   \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
   262
   \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
   263
   \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
   264
  }
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   265
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   266
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   267
  \draw[very thick,->](0,0) -- (8,0);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   268
  \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
   269
  \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
   270
  \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
   271
  \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
   272
  \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
   273
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   274
  \end{tikzpicture}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   275
  \end{tabular}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   276
  \end{textblock}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   277
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   278
  \begin{textblock}{0}(2.5,13)%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   279
  \small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   280
  \onslide<3->{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   281
  \begin{bubble}[8cm]%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   282
  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
   283
  priority process is staved indefinitely.
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   284
  \end{bubble}}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   285
  \end{textblock}
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
   286
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   287
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   288
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
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
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   292
  \frametitle{\Large Priority Inheritance Scheduling}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   293
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   294
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   295
  \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
   296
    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
   297
    section unlocking the resource.\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   298
  \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
   299
    priority level.
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   300
  \end{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   301
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   302
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   303
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
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
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   307
  
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
  \begin{textblock}{11}(1,3)
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   310
  \begin{tabular}{@{\hspace{-10mm}}l}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   311
  \begin{tikzpicture}[scale=1.1]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   312
  \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
   313
  \node at (8,4) {\textcolor{white}{a}};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   314
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   315
    
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   316
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   317
  \only<1>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   318
    \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
   319
    \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
   320
    \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
   321
    \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
   322
    \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
   323
    \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
   324
    \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
   325
    \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
   326
    \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
   327
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   328
  \only<2>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   329
    \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
   330
    \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
   331
    \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
   332
    \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
   333
    \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
   334
    \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
   335
    \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
   336
    \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
   337
    \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
   338
    \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
   339
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   340
  \only<3>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   341
    \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
   342
    \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
   343
    \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
   344
    \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
   345
    \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
   346
    \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
   347
    \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
   348
    \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
   349
    \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
   350
    \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
   351
    \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
   352
    \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
   353
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   354
  \only<4>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   355
    \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
   356
    \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
   357
    \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
   358
    \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
   359
    \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
   360
    \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
   361
    \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
   362
    \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
   363
    \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
   364
    \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
   365
    \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
   366
    \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
   367
    \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
   368
    \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
   369
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   370
  \only<5>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   371
    \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
   372
    \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
   373
    \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
   374
    \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
   375
    \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
   376
    \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
   377
    \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
   378
    \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
   379
    \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
   380
    \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
   381
    \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
   382
    \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
   383
    \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
   384
    \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
   385
    \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
   386
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   387
  \only<6>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   388
    \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
   389
    \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
   390
    \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
   391
    \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
   392
    \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
   393
    \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
   394
    \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
   395
    \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
   396
    \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
   397
    \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
   398
    \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
   399
    \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
   400
    \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
   401
    \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
   402
    \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
   403
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   404
  \only<7>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   405
   \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
   406
    \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
   407
    \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
   408
    \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
   409
    \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
   410
    \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
   411
    \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
   412
    \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
   413
    \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
   414
    \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
   415
    \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
   416
    \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
   417
    \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
   418
    \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
   419
    \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
   420
    \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
   421
    \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
   422
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   423
  \only<8>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   424
    \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
   425
    \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
   426
    \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
   427
    \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
   428
    \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
   429
    \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
   430
    \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
   431
    \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
   432
    \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
   433
    \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
   434
    \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
   435
    \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
   436
    \node at (4,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   437
    \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
   438
    \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
   439
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   440
  \only<9>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   441
    \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
   442
    \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
   443
    \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
   444
    \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
   445
    \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
   446
    \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
   447
    \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
   448
    \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
   449
    \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
   450
    \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
   451
    \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
   452
    \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
   453
    \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
   454
    \node at (4,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   455
    \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
   456
    \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
   457
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   458
  \only<10>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   459
    \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
   460
    \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
   461
    \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
   462
    \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
   463
    \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
   464
    \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
   465
    \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
   466
    \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
   467
    \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
   468
    \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
   469
    \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
   470
    \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
   471
    \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
   472
    \node at (4,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   473
    \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
   474
    \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
   475
    \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
   476
    \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
   477
  }
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   478
  \only<11>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   479
   \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
   480
    \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
   481
    \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
   482
    \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
   483
    \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
   484
    \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
   485
    \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
   486
    \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
   487
    \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
   488
    \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
   489
    \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
   490
    \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
   491
    \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
   492
    \node at (4,3.3) {\small $A$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   493
    \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
   494
    \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
   495
    \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
   496
    \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
   497
    \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
   498
    \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
   499
  }
76
dde58256fc35 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 75
diff changeset
   500
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   501
  \draw[very thick,->](0,0) -- (8,0);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   502
  \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
   503
  \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
   504
  \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
   505
  \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
   506
  \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
   507
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   508
  \end{tikzpicture}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   509
  \end{tabular}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   510
  \end{textblock}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   511
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   512
  \begin{textblock}{0}(2.5,13)%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   513
  \small
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   514
  \onslide<11>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   515
  \begin{bubble}[8cm]%
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   516
  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
   517
  priority process is staved indefinitely.
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   518
  \end{bubble}}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   519
  \end{textblock}
79
2eaca58f9bcc updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 78
diff changeset
   520
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
   521
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   522
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   523
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
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
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   527
  \frametitle{\Large Priority Inheritance Scheduling}
146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 145
diff changeset
   528
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   529
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   530
  \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
   531
    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
   532
    section unlocking the resource.\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   533
  \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
   534
    priority level. \alert{\bf BOGUS}\pause\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   535
  \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
   536
    \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
   537
  \end{itemize}\bigskip
76
dde58256fc35 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 75
diff changeset
   538
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   539
  \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
   540
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   541
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   542
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
76
dde58256fc35 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 75
diff changeset
   543
dde58256fc35 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 75
diff changeset
   544
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   545
  \begin{frame}[c]
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   546
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   547
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   548
  \includegraphics[scale=0.25]{../pics/p3.jpg}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   549
  \end{center}
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   550
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   551
   \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   552
  \item by Rajkumar, 1991
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   553
  \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
   554
  section''
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   555
  \end{itemize}
148
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 147
diff changeset
   556
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   557
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   558
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   559
     
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   560
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   561
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   562
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   563
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   564
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   565
  \includegraphics[scale=0.25]{../pics/p2.jpg}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   566
  \end{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   567
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   568
   \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   569
  \item by Jane Liu, 2000
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   570
  \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
   571
    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
   572
    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
   573
    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
   574
  \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
   575
  \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
   576
  \end{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   577
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   578
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   579
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
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
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   583
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   584
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   585
  \includegraphics[scale=0.15]{../pics/p1.pdf}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   586
  \end{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   587
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   588
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   589
  \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
   590
  \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
   591
        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
   592
        when it entered that section'' 
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   593
  \end{itemize}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   594
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   595
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   596
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
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
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   600
  \frametitle{Priority Scheduling}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   601
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   602
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   603
  \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
   604
  \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
   605
  \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
   606
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   607
  \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
   608
  \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
   609
  \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
   610
  \end{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   611
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   612
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   613
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
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
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   618
  \frametitle{Design of AC-Policies}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   619
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   620
  \Large
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   621
  \begin{quote}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   622
  ''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
   623
  \end{quote}\bigskip\bigskip\bigskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   624
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   625
  \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
   626
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   627
  \end{frame}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   628
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   629
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   630
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   631
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   632
  \frametitle{Testing Policies}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   633
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   634
  \begin{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   635
  \begin{tikzpicture}[scale=1]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   636
  %\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
   637
  %\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
   638
  \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
   639
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   640
  \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
   641
  \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
   642
  \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
   643
  
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   644
  \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
   645
  \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
   646
  \node at (-4.8,0) {\Large policy $+$};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   647
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
  \only<2>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   650
  \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
   651
  \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
   652
  \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
   653
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   654
  \only<3>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   655
  \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
   656
  \node[white] at (2,1) {\small tainted};}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   657
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   658
  \only<4>{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   659
  \begin{scope}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   660
  \draw [clip] (0,0) circle (2.955cm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   661
  \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
   662
  \node[white] at (2,1) {\small tainted};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   663
  \end{scope}}
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   664
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   665
  \only<5->{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   666
  \begin{scope}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   667
  \draw [clip] (0,0) circle (2.955cm);
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   668
  \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
   669
  \node[white] at (2,1) {\small tainted};
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   670
  \end{scope}}
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   671
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   672
  \only<6->{
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   673
  \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
   674
  \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
   675
  \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
   676
  }
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
  \end{tikzpicture}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   679
  \end{center}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   680
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   681
  \end{frame}
83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   682
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   685
  \begin{frame}[c]
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   686
  \frametitle{A Sound and Complete Test}
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   687
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   688
  \begin{itemize}
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   689
  \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
   690
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   691
  \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
   692
  \smallskip
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   693
  \begin{itemize}
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   694
  \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
   695
  \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
   696
  \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
   697
  \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
   698
  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
   699
  \end{itemize}\bigskip\pause
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   700
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   701
  \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
   702
  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
   703
  \end{itemize}
77
56dbc339ec87 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   704
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   705
  \end{frame}
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   706
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   707
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   708
\begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   709
\frametitle{Big Proofs in CS}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   710
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   711
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
   712
Lecturer gone mad?\pause
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   713
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   714
\begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   715
\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
   716
\begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   717
\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
   718
\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
   719
\end{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   720
\medskip 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   721
\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
   722
\begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   723
\item 200k loc of proof
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   724
\item 25 - 30 person years
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   725
\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
   726
\end{itemize}
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
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   729
\end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   730
147
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
   731
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
149
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 148
diff changeset
   732
\begin{frame}[c]
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   733
\frametitle{Goal}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   734
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   735
Remember the Bridges example?
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   736
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   737
\begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   738
\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
   739
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
   740
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   741
\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
   742
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
   743
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   744
\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
   745
      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
   746
      problem, without actually deciding the halting problem.
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   747
      $\quad\Rightarrow$ static analysis
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   748
\end{itemize}
87
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   749
331
54a1fbe96b14 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   750
\end{frame}
87
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 86
diff changeset
   751
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   752
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
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   755
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   756
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   757
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   758
  \includegraphics[scale=0.4]{../pics/state.png}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   759
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   760
  
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   761
  \begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   762
  \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
   763
  (behaviour) will ``develop'' over time.
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   764
  \end{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   765
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   766
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   767
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   771
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   772
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   773
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   774
  \includegraphics[scale=0.4]{../pics/state2.png}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   775
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   776
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   777
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   778
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   782
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   783
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   784
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   785
  \includegraphics[scale=0.4]{../pics/state3.jpg}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   786
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   787
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   788
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   789
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   793
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   794
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   795
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   796
  \includegraphics[scale=0.4]{../pics/state4.jpg}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   797
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   798
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   799
  \begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   800
  \item to be avoided
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   801
  \end{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   802
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   803
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   804
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   808
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   809
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   810
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   811
  \includegraphics[scale=0.4]{../pics/state5.png}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   812
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   813
  
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   814
  \begin{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   815
  \item this needs more work
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   816
  \end{itemize}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   817
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   818
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   819
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
  \begin{frame}[c]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   823
  \frametitle{What is Static Analysis?}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   824
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   825
  \begin{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   826
  \includegraphics[scale=0.4]{../pics/state6.png}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   827
  \end{center}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   828
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   829
  \end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   830
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
\begin{frame}[fragile]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   834
\frametitle{\large Concrete Example: Sign-Analysis}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   835
\mbox{}\\[-20mm]\mbox{}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   836
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   837
\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
   838
         | \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{num}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   841
         | \meta{var}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   842
: \meta{Stmt} ::= \meta{label} :
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   843
         | \meta{var} := \meta{Exp}
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   844
         | jmp? \meta{Exp} \meta{label}
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   845
         | goto \meta{label}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   846
: \meta{Prog} ::= \meta{Stmt} \ldots\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   847
\end{plstx}}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   848
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   849
\end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   850
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
\begin{frame}[fragile]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   854
\frametitle{\large Concrete Example: Sign-Analysis}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   855
\mbox{}\\[-20mm]\mbox{}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   856
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   857
\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
   858
         | \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{num}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   861
         | \meta{var}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   862
: \meta{Stmt} ::= \meta{label} :
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   863
         | \meta{var} := \meta{Exp}
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   864
         | jmp? \meta{Exp} \meta{label}
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   865
         | goto \meta{label}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   866
: \meta{Prog} ::= \meta{Stmt} \ldots\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   867
\end{plstx}}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   868
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   869
\begin{textblock}{0}(7.8,2.5)
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   870
\small
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   871
\begin{bubble}[5.6cm]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   872
\begin{lstlisting}[numbers=none,
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   873
                   basicstyle=\ttfamily,
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   874
                   language={},xleftmargin=3mm]
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   875
      a := 1
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   876
      n := 5 
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   877
top:  jmp? n = 0 done 
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   878
      a := a * n 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   879
      n := n + -1 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   880
      goto top 
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   881
done:
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   882
\end{lstlisting}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   883
\end{bubble}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   884
\end{textblock}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   885
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   886
\end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   887
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
\begin{frame}[fragile]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   891
\frametitle{\large Concrete Example: Sign-Analysis}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   892
\mbox{}\\[-20mm]\mbox{}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   893
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   894
\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
   895
         | \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{num}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   898
         | \meta{var}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   899
: \meta{Stmt} ::= \meta{label} :
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   900
         | \meta{var} := \meta{Exp}
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   901
         | jmp? \meta{Exp} \meta{label}
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   902
         | goto \meta{label}\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   903
: \meta{Prog} ::= \meta{Stmt} \ldots\\
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   904
\end{plstx}}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   905
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   906
\begin{textblock}{0}(7.8,3.5)
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   907
\small
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   908
\begin{bubble}[5.6cm]
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   909
\begin{lstlisting}[numbers=none,
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   910
                   basicstyle=\ttfamily,
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   911
                   language={},xleftmargin=3mm]
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   912
      n := 6
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   913
      m1 := 0
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   914
      m2 := 1
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   915
top:  jmp? n = 0 done
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   916
      tmp := m2
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   917
      m2 := m1 + m2
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   918
      m1 := tmp
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   919
      n := n + -1
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   920
      goto top
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   921
done:
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   922
\end{lstlisting}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   923
\end{bubble}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   924
\end{textblock}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   925
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   926
\end{frame}
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   927
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
   928
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   929
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   930
\begin{frame}[fragile]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   931
\frametitle{Eval}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   932
\mbox{}\\[-18mm]\mbox{}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   933
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   934
\small
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   935
\begin{center}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   936
\bl{\begin{tabular}{lcl}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   937
$[n]_{env}$ & $\dn$ & $n$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   938
$[x]_{env}$ & $\dn$ & $env(x)$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   939
$[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
   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$ & 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   942
$\begin{cases}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   943
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
   944
0 & \text{otherwise}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   945
\end{cases}$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   946
\end{tabular}}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   947
\end{center}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   948
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   949
\footnotesize
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   950
\begin{lstlisting}[numbers=none,xleftmargin=-5mm]
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   951
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
   952
  case Num(n) => n
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   953
  case Var(x) => env(x)
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
   954
  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
   955
  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
   956
  case Equ(e1, e2) => 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   957
    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
   958
}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   959
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   960
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   961
\end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   962
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
\begin{frame}[fragile]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   967
\small
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   968
A program
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   969
\begin{bubble}[6cm]\footnotesize
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   970
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   971
                   language={},
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   972
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   973
                   xleftmargin=1mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   974
      a := 1
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   975
      n := 5 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   976
top:  jmp? n = 0 done 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   977
      a := a * n 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   978
      n := n + -1 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   979
      goto top 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   980
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   981
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   982
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   983
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   984
Some snippets
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   985
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   986
\footnotesize
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   987
\begin{columns}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   988
\begin{column}[t]{5cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   989
\begin{bubble}[4.5cm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   990
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   991
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   992
                   language={},xleftmargin=1mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   993
""    a := 1
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   994
      n := 5 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   995
top:  jmp? n = 0 done 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   996
      a := a * n 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   997
      n := n + -1 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   998
      goto top 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
   999
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1000
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1001
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1002
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1003
\begin{column}[t]{5cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1004
\begin{bubble}[4.5cm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1005
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1006
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1007
                   language={},xleftmargin=1mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1008
top:  jmp? n = 0 done 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1009
      a := a * n 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1010
      n := n + -1 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1011
      goto top 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1012
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1013
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1014
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1015
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1016
\begin{column}[t]{2cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1017
\begin{bubble}[1.1cm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1018
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1019
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1020
                   language={},xleftmargin=1mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1021
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1022
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1023
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1024
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1025
\end{columns}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1026
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1027
\end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1028
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
\begin{frame}[fragile]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1032
\frametitle{Eval for Stmts}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1033
\mbox{}\\[-12mm]\mbox{}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1034
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1035
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
  1036
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1037
\small
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1038
\begin{center}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1039
\bl{\begin{tabular}{lcl}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1040
$[\texttt{nil}]_{env}$ & $\dn$ & $env$\medskip\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1041
$[\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
  1042
$[x \,\texttt{:=}\, e::rest]_{env}$ & $\dn$ & 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1043
$[rest]_{(env[x:= [e]_{env}])}$\medskip\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1044
$[\texttt{jmp?}\;e\;l::rest]_{env}$ & $\dn$ & 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1045
$\begin{cases}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1046
[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
  1047
[rest]_{env}  & \text{otherwise}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1048
\end{cases}$\medskip\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1049
$[\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
  1050
\end{tabular}}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1051
\end{center}\bigskip
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1052
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1053
Start with \bl{$[sn(\mbox{\code{""}})]_{\varnothing}$}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1054
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1055
\end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1056
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
\begin{frame}[fragile]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1062
\frametitle{Eval in Code}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1063
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1064
\footnotesize
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1065
\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
  1066
def eval(sn: Snips) : Env = {
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1067
  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
  1068
    case Nil => env
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1069
    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
  1070
    case Assign(x, e)::rest => 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1071
      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
  1072
    case Jmp(b, l)::rest => 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1073
      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
  1074
      else eval_stmts(rest, env)
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1075
    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
  1076
  }
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
  eval_stmts(sn(""), Map())
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1079
}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1080
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1081
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1082
\end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1083
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
\begin{frame}[fragile]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1087
\frametitle{The Idea}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1088
\small
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1089
\mbox{}\bigskip\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1090
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1091
\begin{columns}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1092
\begin{column}{5cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1093
\begin{bubble}[4.5cm]\footnotesize
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1094
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1095
                   language={},
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1096
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1097
                   xleftmargin=1mm]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1098
      a := 1
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1099
      n := 5 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1100
top:  jmp? n = 0 done 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1101
      a := a * n 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1102
      n := n + -1 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1103
      goto top 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1104
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1105
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1106
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1107
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1108
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1109
\begin{column}{1cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1110
\raisebox{-20mm}{\LARGE\bf$\Rightarrow$}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1111
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1112
\begin{column}{6cm}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1113
\begin{bubble}[4.7cm]\footnotesize
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1114
\begin{lstlisting}[numbers=none,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1115
                   language={},
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1116
                   basicstyle=\ttfamily,
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1117
                   xleftmargin=1mm,
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1118
                   escapeinside={(*}{*)}]
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1119
      a := (*\hl{'+'}*)
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1120
      n := (*\hl{'+'}*) 
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1121
top:  jmp? n = (*\hl{'0'}*) done 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1122
      a := a * n 
336
3cb200fa6d6a updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 335
diff changeset
  1123
      n := n + (*\hl{'-'}*) 
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1124
      goto top 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1125
done:
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1126
\end{lstlisting}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1127
\end{bubble}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1128
\end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1129
\end{columns}\bigskip\bigskip
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1130
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1131
Replace all constants and variables by either 
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1132
\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
  1133
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
  1134
always positive).
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1135
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1136
\end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1137
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
  \begin{frame}[c]
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1141
  \frametitle{Sign Analysis?}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1142
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
  \begin{columns}
334
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1145
  \begin{column}{3cm}
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1146
  \begin{tabular}{cc|l}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1147
  $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
  1148
  - & - & -\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1149
  - & 0 & -\\
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 & $x$ & $x$\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1152
  + & - & -, 0, +\\
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
  + & + & +\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1155
  \end{tabular}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1156
  \end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1157
334
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1158
  \begin{column}{3cm}
333
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1159
  \begin{tabular}{cc|l}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1160
  $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
  1161
  - & - & +\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1162
  - & 0 & 0\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1163
  - & + & -\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1164
  0 & $x$ & 0\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1165
  + & - & -\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1166
  + & 0 & 0\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1167
  + & + & +\\
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1168
  \end{tabular}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1169
  \end{column}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1170
  \end{columns}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1171
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1172
  \end{frame}
cf02511469d6 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 332
diff changeset
  1173
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
  1174
334
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1175
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1176
\begin{frame}[fragile]
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1177
\mbox{}\\[-13mm]\mbox{}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1178
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1179
\small
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1180
\begin{center}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1181
\bl{\begin{tabular}{lcl}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1182
$[n]_{env}$ & $\dn$ & 
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1183
$\begin{cases}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1184
\{+\} & \text{if}\; n > 0\\
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
\{0\} & \text{if}\; n = 0
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1187
\end{cases}$\\
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1188
$[x]_{env}$ & $\dn$ & $env(x)$\\
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1189
$[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
  1190
$[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
  1191
$[e_1 = e_2]_{env}$ & $\dn$ & $\{0, +\}$\\
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1192
\end{tabular}}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1193
\end{center}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1194
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1195
\scriptsize
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1196
\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
  1197
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
  1198
  case Num(0) => Set(Zero)
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1199
  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
  1200
  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
  1201
  case Var(x) => aenv(x)
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1202
  case Plus(e1, e2) => 
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1203
    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
  1204
  case Times(e1, e2) => 
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1205
    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
  1206
  case Equ(e1, e2) => Set(Zero, Pos)
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1207
}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1208
\end{lstlisting}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1209
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1210
\end{frame}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1211
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
  \begin{frame}[c]
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1217
  \frametitle{Sign Analysis}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1218
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1219
  \begin{itemize}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1220
  \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
  1221
  are always positive?\medskip
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1222
  \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
  1223
  \begin{itemize}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1224
  \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
  1225
  \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
  1226
  \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
  1227
  cannot be negative 
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1228
  \end{itemize}\bigskip
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1229
  
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1230
  \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
  1231
  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
  1232
  attacks).
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1233
  \end{itemize}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1234
  
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1235
  \end{frame}
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1236
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6f08b13c0242 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 333
diff changeset
  1237
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
  1238
76
dde58256fc35 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 75
diff changeset
  1239
\end{document}
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1240
332
8eab185fb187 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 331
diff changeset
  1241
75
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1242
%%% Local Variables:  
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1243
%%% mode: latex
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1244
%%% TeX-master: t
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1245
%%% End: 
df7cf3d07bd8 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
  1246