\subsection{Anonymous Shared Memory (ashmem)}
\begin{frame}
  \frametitle{Shared memory mechanism in Linux}
  \begin{itemize}
  \item Shared memory is one of the standard IPC mechanisms present in most OSes
  \item Under Linux, they are usually provided by the POSIX SHM
    mechanism, which is part of the System V IPCs
  \item \path{ndk/docs/system/libc/SYSV-IPC.html} illustrates all the
    love Android developers have for these
  \item The bottom line is that they are flawed by design in Linux,
    and lead to code leaking resources, be it maliciously or not
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Ashmem}
  \begin{itemize}
  \item Ashmem is the response to these flaws
  \item Notable differences are:
    \begin{itemize}
    \item Reference counting so that the kernel can reclaim resources
       which are no longer in use
    \item There is also a mechanism in place to allow the kernel to
      shrink shared memory regions when the system is under memory
      pressure.
    \end{itemize}
  \item The standard use of Ashmem in Android is that a process opens
    a shared memory region and share the obtained file descriptor
    through Binder.
  \end{itemize}
\end{frame}
