\begin{frame}
\frametitle{2 Phase Locking Protocol}
2 PL is the concurrency control protocol used in most DBMSs:
\begin{goal}{2 Phase Locking (2 PL)}
Each transaction must get,
\begin{itemize}
\item an \emph{S-lock} on an object \emph{before reading} it, and
\item an \emph{X-lock} on an object \emph{before writing} it.
\end{itemize}
A transaction \alert{cannot get new locks once it releases any lock}.
\end{goal}
\pause
\smallskip
\begin{tcenter}
\begin{tikzpicture}[nodes={black,scale=.8}]
\draw [thick,->] (0,0) -- node [at end,above] {time} (7cm,0);
\draw [thick,->] (0,0) -- node [at end,left] {\#of locks held} (0,1.5cm);
\draw [red,very thick] (0,0) -- node [sloped,above] {lock phase} (2.5cm,1.5cm) -- (3.5cm,1.5cm) -- node [sloped,above] {release phase} (5.5cm,0cm);
\end{tikzpicture}
\end{tcenter}
\smallskip
\pause
\begin{block}{Theorem}
Any schedule that confirms to 2 PL is conflict-serializable.
\end{block}
\end{frame}