\begin{frame}
  \frametitle{Motivation}
  \begin{columns}
    \begin{column}{0.59\linewidth}
      \includegraphics[height=0.8\textheight]{img/computers-everywhere}
      %\burl{http://images.slideplayer.com/26/8674558/slides/slide_3.jpg}
    \end{column}
    \begin{column}{0.39\linewidth}
      \begin{itemize}
        \item What can a computer do?
        \item How do you choose one?
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{Learning outcome based on syllabus}
  \begin{itemize}
    \item Describe the components of a computer and their interaction
      (ISGA01)
    \item Give an account of the components of a computer and their
      interaction (ISGA06)
    \item Give an account of the components of a computer and how they interact
      (ISGA90)
  \end{itemize}
  \vfill\centering
  \smartdiagramset{
    sequence item height=1.75cm,
    sequence item width=2.5cm,
    sequence item text width = 2.4cm,
  }
  \smartdiagram[sequence diagram]{%
    What is a computer?,%
    How is information processed?,%
    Hardware components and purpose?%
  }
\end{frame}

%\begin{frame}
%  \frametitle{The first computers}
%  %The first computer? Z3 by Konrad Zuse (Germany, 1941)}
%  \begin{columns}
%    \begin{column}{0.59\textwidth}
%      \includegraphics[width=\textwidth]{img/z3}
%      %\burl{https://www.livescience.com/20718-computer-history.html}
%    \end{column}
%    \begin{column}{0.39\textwidth}
%      % Say but not in slide:
%      % - Brief history of Zuse (it's a funny story)
%      % - Z3 destroyed in world-war II, rebuild in 1960 and now in museum
%      % - MUL -> 3s :)
%      \begin{itemize}
%        \item 2000 `brain cells'
%        \item Program is a punched film\footnotemark
%        \item Keyboard for input
%        \item Lamps for output
%      \end{itemize}
%      Other:
%      \begin{itemize}
%        \item ENIAC (1946)
%      \end{itemize}
%    \end{column}
%  \end{columns}
%  \footnotetext[1]{\tiny{Play with punch cards: \burl{https://www.vintageisthenewold.com/living-like-the-pioneers-code-fortran-in-a-punch-card/}}}
%\end{frame}

\begin{frame}
  \frametitle{A typical computer}
  \centering\includegraphics[width=0.7\textwidth]{img/binary}
  %\burl{http://amusementpark3.blogspot.com/2010/10/blog-entry-41.html}
\end{frame}

\begin{frame}
  \frametitle{Current computer definitions in Swedish and English}
  \begin{itemize}
    \item Digital enhet f\"{o}r ber\"{a}kning, symbolbehandling och
      kommunikation\footnote{%
        \burl{https://www.ne.se/uppslagsverk/encyklopedi/l\%C3\%A5ng/dator}
      }
    \item An electronic device for storing and processing data, typically in
      binary form, according to instructions given to it in a variable program%
      \footnote{%
        \burl{https://en.oxforddictionaries.com/definition/computer}
      }
    \item A computer is a device that can be instructed to carry out sequences
      of arithmetic or logical operations automatically via computer
      programming\footnote{%
        \burl{https://en.wikipedia.org/wiki/Computer}
      }
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Information theory}
  \begin{columns}
    \begin{column}{0.79\textwidth}
      \begin{itemize}
        \item The smallest piece of information is binary
        \item One `bit' represents a zero or a one
        \item Example of sending a single bit?
        \item Example of sending multiple bits?
        %  
      \end{itemize}
    \end{column}
    \begin{column}{0.19\textwidth}
      \centering\includegraphics[width=\textwidth]{img/light-bulb}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{What does this mean?}
  \centering\Huge{\texttt{%
    01011001%
    01101111%
    01100100%
    01100001%
  }}
  \large\vfill\pause
  \alert{Many different things...}
  \vfill
  \centering
  \begin{itemize}
    \item 32-bit unsigned integer: 1500472417
    \item 32-bit floating point: $4.21143045\cdot 10^{15}$
    \item Groups of 8 bits: 89,~111,~100,~97
      \begin{itemize}
        \item Byte
        \item Number between 0--255 (\alert{why?})
      \end{itemize}
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Information theory continued}
  \begin{columns}
    \begin{column}{0.49\textwidth}
      Decimal numbers as we know them:
      \begin{flalign*}
        107 &=
          \textcolor{red}{1}\cdot100 +
          \textcolor{red}{0}\cdot10 +
          \textcolor{red}{7}\cdot1 \\
            &=
          \textcolor{red}{1}\cdot\textcolor{blue}{10}^2 +
          \textcolor{red}{0}\cdot\textcolor{blue}{10}^1 +
          \textcolor{red}{7}\cdot\textcolor{blue}{10}^0
      \end{flalign*}
      A position is associated with 0--9 \\
      A position is weighted by $10^i$, $i\geq0$\\
      This is known as base \textcolor{blue}{10} \\
      \vspace{1cm}
      \pause
      \alert{Why is this intuitive for us?}
      \pause
    \end{column}
    \begin{column}{0.49\textwidth}
      Binary numbers follow the same idea:
      \begin{flalign*}
         1101 &=
          \textcolor{red}{1}\cdot8 +
          \textcolor{red}{1}\cdot4 +
          \textcolor{red}{0}\cdot2 +
          \textcolor{red}{1}\cdot1 \\
            &=
          \textcolor{red}{1}\cdot\textcolor{blue}{2}^3 +
          \textcolor{red}{1}\cdot\textcolor{blue}{2}^2 +
          \textcolor{red}{0}\cdot\textcolor{blue}{2}^1 +
          \textcolor{red}{1}\cdot\textcolor{blue}{2}^0 = 13
      \end{flalign*}
      A position is associated with 0--1 \\
      A position is weighted by $2^i$, $i\geq0$\\
      This is known as base \textcolor{blue}{2} \\
      \vspace{1cm}
      \pause
      \alert{Why is this intuitive for a computer?}
    \end{column}
  \end{columns}
  \centering
  \vfill
\end{frame}

\begin{frame}
  \frametitle{Now you can proudly wear this T-shirt!}
  \centering\includegraphics[height=0.8\textheight]{img/binary-joke}
\end{frame}

\begin{frame}
  \frametitle{Be aware of different unit systems}
  \begin{columns}
    \begin{column}{0.49\textwidth}
      \begin{tabular}{ccc}
        \toprule
        \textbf{unit} & \textbf{abbreviation} & \textbf{meaning} \\
        \midrule
        kilo & k & $10^3$ \\
        mega & M & $10^6$ \\
        giga & G & $10^9$ \\
        tera & T & $10^{12}$ \\
        \bottomrule
      \end{tabular}\\
      \vspace{6pt}
      (Decimal numbers as we know them)
      \vfill
    \end{column}
    \begin{column}{0.49\textwidth}
      \begin{tabular}{ccc}
        \toprule
        \textbf{unit} & \textbf{abbreviation} & \textbf{meaning} \\
        \midrule
        kibi & Ki & $2^{10}$ \\
        mebi & Mi & $2^{20}$ \\
        gibi & Gi & $2^{30}$ \\
        tebi & Ti & $2^{40}$ \\
        \bottomrule
      \end{tabular}\\
      \vspace{6pt}
      (Binary numbers, note $2^{10}=1024$)\\
    \end{column}
  \end{columns}
  \pause
  \vfill\centering
  \alert{``I bought a 500~GB hard drive, but Windows says it is 465.7~GB?''}
\end{frame}

\begin{frame}
  \frametitle{Amercian Standard Code for Information Interchange}
  \begin{columns}
    \begin{column}{0.79\textwidth}
      \centering\includegraphics[height=0.9\textheight]{img/ascii}
      %\burl{https://simple.wikipedia.org/wiki/ASCII\#/media/File:ASCII-Table-wide.svg}
    \end{column}
    \begin{column}{0.24\textwidth}
      \begin{itemize}
        \item 89: Y
        \item 111: o
        \item 100: d
        \item 97: a
        \pause
        \item \aa, \"{a}, \"{o}?
          \begin{itemize}
            \item UTF-8
            \item UTF-16
            \item UTF-32
          \end{itemize}
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{Divide yourself into small groups}
  %% Name required (or optional) parts in a typical computer
  \centering
  \includegraphics[height=0.5\textheight]{img/group}
  \\\Huge{Interactive exersice}
\end{frame}

\begin{frame}
  \frametitle{My office setup\footnote{\burl{https://www.dustinhome.se/favorites/index/9620211}}}
  \begin{columns}
    \begin{column}{0.49\textwidth}
      Computer case containing:
        \begin{itemize}
          \item Central Processing Unit (CPU)
          \item Random Access Memory (RAM)
          \item Solid State Drive (SSD)
          \item Hard drive (HDD)
          \item Power Supply Unit (PSU)
          \item Fan for CPU cooling
          \item Motherboard
        \end{itemize}
    \end{column}
    \begin{column}{0.49\textwidth}
      \centering
      \includegraphics[height=0.4\textheight]{img/case1}
      \includegraphics[height=0.4\textheight]{img/case2}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{Central Processing Unit (CPU) \titlefloatright{`Processor'}}
  \begin{columns}
    \begin{column}{0.59\textwidth}
      \begin{itemize}
        \item Does most of the computing
        \item Instruction set
          \begin{itemize}
            \item load
            \item store
            \item add
            \item conditional jump
            \item ...
          \end{itemize}
        \item Registers
        \item Clock speed
        \item Number of cores
      \end{itemize}
    \end{column}
    \begin{column}{0.39\textwidth}
      \centering
      \includegraphics[width=\textwidth]{img/cpu}
      Intel Core i7 7700K / 4.2~GHz processor LGA1151 Socket
    \end{column}
  \end{columns}
  \vfill\pause\centering\alert{Is faster clock speed always better?}
\end{frame}

\begin{frame}
   \frametitle{Gordon Moore predicted the number of transitors on a dense 
    integrated circuit}
   \begin{columns}
    \begin{column}{0.59\textwidth}
       \includegraphics[width=\textwidth]{img/moores-law}
       \burl{https://en.wikipedia.org/wiki/Moore\%27s\_law\#/media/File:Moore\%27s\_Law\_Transistor\_Count\_1971-2016.png}
    \end{column}
    \begin{column}{0.49\textwidth}
      \begin{itemize}
        \item Moore's law
          \begin{itemize}
            \item 1965: doubles every year
            \item 1975: doubles every two years
            \item $\approx$2025: dead
          \end{itemize}
        \item David House
          \begin{itemize}
            \item 18 months $\rightarrow$ 2x performance
          \end{itemize}
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{Different types of memory, all storing zeros and ones only!}
  \begin{columns}
    \begin{column}{0.49\textwidth}
      \input{img/memory}
    \end{column}
    \begin{column}{0.49\textwidth}
      \begin{itemize}
        \item HDD: `h\aa{}rddisk'
        \item SSD: `typ en h\aa{}rddisk'
        \item RAM: `internminne eller arbetsminne'
        \item Cache: on and nearby the CPU 
        \item Register: on the CPU
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{Different types of memory continued}
  \begin{columns}
    \begin{column}{0.33\textwidth}
      \centering
      HDD \\
      \includegraphics[width=\textwidth]{img/hdd}\\
      WD Blue 4TB 3.5" Serial ATA-600 \\
    \end{column}
    \begin{column}{0.33\textwidth}
      \centering
      SSD \\
      \includegraphics[width=\textwidth]{img/ssd} \\
      Crucial MX500 500GB Serial ATA-600 \\
    \end{column}
    \begin{column}{0.33\textwidth}
      \centering
      RAM \\
      \includegraphics[width=\textwidth]{img/ram} \\
      CORSAIR V LPX 32GB (2X16) DDR4 2400MHZ \\
    \end{column}
  \end{columns}
  \vspace{1cm}

  \pause
  \begin{columns}
    \begin{column}{0.49\textwidth}
      \begin{itemize}
        % biggest different is no moving vs moving parts
        % # most important from my point of view
        % - life time: no moving parts -> survive longer
        % - speed: no moving parts -> less work to do stuff
        % - price per GB: ssd much more expensive due to underlying tech
        % # important depending on use-case
        % - noise (ssd < hdd)
        % - temperature (ssd < hdd)
        % - energy consumption (ssd < hdd)
        % - weight (ssd < hdd)
        %
        % See more at: https://www.netonnet.se/Content/Info/ssd
        \item Trade-offs between SSD and HDD?
      \end{itemize}
    \end{column}
    \begin{column}{0.49\textwidth}
      \begin{itemize}
        % Depends on your use-case!
        \item How much RAM do you need?
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{Motherboard (or, the thing everything is attached to)
    \titlefloatright{`Moderkort'}}
  % ATX power connector: this is where you connect PSU
  % IDE connector: for hard drive, dvd, etc (newer: SATA)
  % North bridge or `memory controller': controls transfers between CPU
  %   and RAM; hence it is nearby both of these components
  % South bridge or `input/output controller': manages controllers between
  %   peripheral devices.
  % The term `bridge' is generally used when connecting two buses
  % Dynamic Vs Static ram -> has to do with underlying tech; static is
  %   faster but more expensive
  % CMOS Backup battery: to remember important stuff while shutdown, e.g.,
  %   BIOS settings and date.
  % AGP slot: for some graphic cards (legacy, nowadays PCI)
  % PCI slots: attach various extension cards here (i.e., daughter boards),
  %   e.g., network, audio, and graphic cards
  \begin{columns}
    \begin{column}{0.69\textwidth}
      \centering\includegraphics[width=\textwidth]{img/motherboard}
    \end{column}
    \begin{column}{0.29\textwidth}
      Contains at least:
      \begin{itemize}
        \item Processor slot
        \item Memory slot
        \item Connectors, e.g.,
          \begin{itemize}
            \item Power
            \item SATA
            \item SCSI
            \item ...
          \end{itemize}
        \item Control circuits
          \begin{itemize}
            \item BIOS
            \item Cache
            \item ...
          \end{itemize}
      \end{itemize}
    \end{column}
  \end{columns}
  \pause
  \vfill
  \centering\alert{What should you think about when you buy hardware?}
  % BIOS: Basic Input Output System
  %   - the first software to run when a computer is started
  %   - identifies and configures hardware, e.g., hard drive, CPU, memory, etc.
  %   - instructs the computer how to perform a number basic operations, e.g.,
  %   controlling the keyboard and booting the OS.
\end{frame}

\begin{frame}
  \frametitle{A newer motherboard: ASUS PRIME Z370-P \titlefloatright{Manual\footnote{%
    \burl{https://www.asus.com/us/Motherboards/PRIME-Z370-P/HelpDesk\_Manual/}
  }}}
  \centering\includegraphics[height=0.85\textheight]{img/new-motherboard2}
\end{frame}

\begin{frame}
  \frametitle{A newer motherboard continued}
  \centering\includegraphics[height=0.85\textheight]{img/moderkort}
\end{frame}

\begin{frame}
  \frametitle{Expantion cards usually use PCI(e)\titlefloatright{`Instickskort'}}
  \begin{columns}
    \begin{column}{0.33\textwidth}
      \hfill
      \centering
      % - It's common with 2000+ cores
      % - It has its own dedicated RAM (e.g., 8GB)
      % - Not so general purpose as a CPU, but it's good at what it does...
      % - Fun with GPUs? Cryptocurrency mining and password cracking!
      \alert{Graphics card} for complex math, geometry, and coloring
        (`grafikkort')
      \includegraphics[height=0.4\textheight]{img/graphics-card}
      %\burl{https://www.techpowerup.com/img/16-12-20/917a7803f315.jpg}\\
    \end{column}
    \begin{column}{0.33\textwidth}
      \hfill
      \centering
      \alert{Audio card} for enhanced sound experiences
        (`ljudkort')
      \includegraphics[height=0.4\textheight]{img/audio-card}
      %\burl{https://images-na.ssl-images-amazon.com/images/I/411rdurQRkL.jpg}
    \end{column}
    \begin{column}{0.33\textwidth}
      \hfill
      \centering
      % For special needs, e.g., WiFi or 10GBit/s Ethernet
      \alert{Network card} for data exchange over a computer network
        (`n\"{a}tverkskort')
      \includegraphics[height=0.4\textheight]{img/network-card}
    \end{column}
  \end{columns}
  \pause
  \vspace{0.5cm}
  \centering\alert{Is my office setup without graphics, sound, and Internet?!}
\end{frame}

\begin{frame}
  \frametitle{A few common external connectors}
  \begin{columns}
    \begin{column}{0.49\textwidth}
      \vbox to 0.8\textwidth{%
        \centering
        \alert{USB}\vspace{6pt}\\
        \includegraphics[width=0.8\textwidth]{img/usb1}
        \includegraphics[width=0.8\textwidth]{img/usb2}
        %\burl{https://www.bhphotovideo.com/explora/amp/computers/tips-and-solutions/thunderbolt-3-usb-31-usb-type-c-making-sense-connections}
        \vfill
        External HDD and devices
      }
    \end{column}
    \begin{column}{0.49\textwidth}
      \vbox to 0.8\textwidth{%
        \begin{columns}
          \begin{column}{0.49\textwidth}
            \centering\alert{HDMI}\vspace{6pt}\\
            \includegraphics[height=0.3\textheight]{img/hdmi}
          \end{column}
          \begin{column}{0.49\textwidth}
            \centering\alert{DP}\vspace{6pt}\\
            \includegraphics[height=0.3\textheight]{img/dp}
          \end{column}
        \end{columns}
        \centering\vfill
        Mainly video and audio
      }
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{You will find the same basic components in every computer---Raspberry Pi}
  \begin{columns}
    \begin{column}{0.69\textwidth}
      \centering\includegraphics[height=0.8\textheight]{img/raspberrypi}\\
      \burl{https://www.raspberrypi.org/}
    \end{column}
    \begin{column}{0.29\textwidth}
      All components are embedded on a SoC:
      \begin{itemize}
        \item CPU
        \item Memory
        \item Connectors
        \item Control circuits
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{You will find the same basic components in every computer---MBP}
  \centering\includegraphics[height=0.8\textheight]{img/mbp}
  \burl{https://www.ifixit.com/Teardown/MacBook+Pro+15-Inch+Touch+Bar+Teardown/73395}
\end{frame}


\begin{frame}
  \frametitle{You will find the same basic components in every computer---iPhone}
  \centering\includegraphics[height=0.8\textheight]{img/iphone}
  \burl{https://www.ifixit.com/Teardown/iPhone+5s+Teardown/17383}
\end{frame}

\begin{frame}
  \frametitle{In the labs you will (de)assemble a computer}
  \begin{columns}
    \begin{column}{0.59\textwidth}
      \centering\includegraphics[width=\textwidth]{img/build-pc}
      %\burl{https://cdn.fstoppers.com/styles/large-16-9/s3/lead/2017/05/best\_pc\_build\_for\_adobe\_premiere.jpg}
    \end{column}
    \begin{column}{0.39\textwidth}
      \begin{itemize}
        \item Be grounded
        \item Be ``stern but fair''
        \item Be careful with cables
          \begin{itemize}
            \item Jank? No...
            \item Pull? Gently!
            \item Wiggle? If you must!
          \end{itemize}
        \item Attach in the right direction
        \item Avoid touching circuit boards
        \item Ask if you need help
      \end{itemize}
    \end{column}
  \end{columns}
\end{frame}

\begin{frame}
  \frametitle{Nervous? Prepare yourself by watching a computer being built}
  \centering\includegraphics[height=0.8\textheight]{img/video}
  \burl{https://www.youtube.com/watch?v=0bUghCx9iso}
\end{frame}
