
%\documentclass[colorBG,slideColor,troispoints,pdf]{prosper}
\documentclass[colorBG,total,slideColor,pdf]{prosper}
%\documentclass[colorBG,slideColor,ps]{prosper}

\usepackage{alltt,key,xr,cols,rcs,acro,nick,%
  graphicx,varioref,explanation,booktabs,multicol,textcomp,amstext}
\usepackage[nolineno,noindent]{lgrind}

%\definecolor{green}{rgb}{0,1,0}

\RCS $Revision: 1.0 $

\renewcommand*{\bs}{\texttt{\char '134}} % Backslash `\'
%\newcommand*{\labTitle}{LDAP Directories}1
\newcommand*{\subject}{Operating Systems and Systems Integration}
\newcommand*{\emphcolour}[1]{\emph{\red#1}}

\providecommand*{\RPM}{\acro{RPM}\xspace}
\providecommand*{\CD}{\acro{CD}\xspace}
\providecommand*{\IPC}{\acro{IPC}\xspace}
\providecommand*{\UID}{\acro{UID}\xspace}
\providecommand*{\GID}{\acro{GID}\xspace}
\providecommand*{\SMP}{\acro{SMP}\xspace}
\providecommand*{\API}{\acro{API}\xspace}
\providecommand*{\OK}{\acro{OK}\xspace}
\providecommand*{\IETF}{\acro{OK}\xspace}
\providecommand*{\MS}{\acro{MS}\xspace}
\providecommand*{\LILO}{\acro{LILO}\xspace}
\providecommand*{\HCI}{\acro{HCI}\xspace}
\providecommand*{\KDE}{\acro{KDE}\xspace}
\providecommand*{\MBR}{\acro{MBR}\xspace}
\providecommand*{\BSD}{\acro{BSD}\xspace}
\providecommand*{\MB}{\acro{MB}\xspace}
\providecommand*{\XP}{\acro{XP}\xspace}
\providecommand*{\HAL}{\acro{HAL}\xspace}
\providecommand*{\DLL}{\acro{DLL}\xspace}
\providecommand*{\QNX}{\acro{QNX}\xspace}


\title{\mbox{}\blue{}The Linux Operating System}%
\subtitle{An Overview}
\author{Nick Urbanik \texttt{<nicku(at)nicku.org>}\\
  \footnotesize{}Copyright Conditions: GNU FDL (see
  \url{http://www.gnu.org/licenses/fdl.html})}%
\institution{A computing department}%
\slideCaption{OSSI --- Overview of Linux --- ver. \RCSRevision}
%%%\Logo{\includegraphics[width=15mm]{ict-logo-smaller}}

%\makeatother
\newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp}
\newcommand{\kbk}{\ttfamily}
\newcommand{\kwd}{\em}
%\newcommand{\url}{\ttfamily}
\newcommand{\usb}{\em}
\newcommand{\sco}{\ttfamily}
\newcommand{\uin}{\ttfamily}
\newcommand{\pgn}{\normalfont\ttfamily}
\newcommand{\var}{\ttfamily}
\newcommand{\sig}{\ttfamily}
\newcommand{\fn}{\pgn}
\newcommand{\str}{\pgn}
\newcommand{\cmdn}{\ttfamily}
\newcommand{\rr}{\raggedright}
\newcommand{\myss}{\Large}
\newcommand{\myfs}{\large}
\newcommand{\myts}{\normalsize}
\newcommand{\mns}{\LARGE}
\newcommand{\ns}{\normalsize}
\renewcommand{\footnotesize}{\myfs}

\begin{document}
\maketitle

\begin{slide}{Objectives}
\label{sld:overview-objects}

Having completed this module, you will have an overview of a Linux
system, including its:

\begin{itemize}
\item Underlying philosophy
\item System layering --- kernel vs. applications
\item Core services
\item Multiuser and timesharing facilities
\item File System
\item Network Services
\item Desktop and X windowing system
\end{itemize}
\end{slide}




\begin{slide}{Generic Features of Unix}
\label{sld:overview-features-of-linux}

\begin{itemize}
\item Component-based systems
\item Very popular with technically skilled
\item Not `solution' oriented
\item Building blocks not the building
\item Highly network-aware
\item Robust, powerful, reliable
\end{itemize}
\end{slide}



\begin{slide}{Linux --- The Kernel of a System}
\label{sld:overview-components-of-gnulinux}
  \begin{figure}[htbp]
    \begin{center}
      \tiny
      \input{kernel-layering.tex}        
      \caption{kernel-layering}
      \label{fig:Kernel layering}
    \end{center}
  \end{figure}
\begin{itemize}
\item What is {\em called} Linux is actually a collection of
  components from many sources
  \begin{itemize}
  \item freely copiable, under `open source' licences
  \end{itemize}
\item Linux is, strictly, just the {\kwd kernel} which provides:
  \begin{itemize}
  \item A common interface between {\kwd user process} and hardware
  \item Minimal functions to user applications, i.e. system calls
  \item Scheduling
   %\includegraphics[width=280pt]{../images/overview2}
  \end{itemize}
\end{itemize}
\end{slide}

\begin{slide}{Fundamental Characteristics of Linux}
\label{sld:overview-characteristics-of-linux}
\begin{itemize}
\item Multi-tasking
\item Multi-user access
\item Multi-processor
\item Architecture independence 
\item POSIX 1003.1 plus basic System V and BSD
\item Protected memory mode
\item Multiple filesystem types
\item Comprehensive networking (TCP/IP and others)
\item Multiple executable formats (MS-DOS, iBCS UNIX, SCO, etc)
\end{itemize}
\end{slide}


\begin{slide}{Multiuser Multitasking and Time-sharing}
\label{sld:overview-multiuser}
\begin{itemize}
\item Designed as a multi-user system
  \begin{itemize}
  \item Each user's shells, apps and commands are separate processes
  \item Number of simultaneous users limited only by:
  \begin{itemize}
  \item CPU speed and available memory
  \item Min. response times required by users/apps
  \end{itemize}
  \end{itemize}
\item Multi-tasking:
  \begin{itemize}
  \item Many jobs can be under way at the same time
  \item Jobs truly {\em simultaneous} on multi-cpu
  \end{itemize}
\item Time-sharing:
  A single cpu is shared by all processes
  \begin{itemize}
  \item Processes exec briefly, passing cpu to others
  \item {\kwd Process switches} occur in miliseconds or less
  \item Kernel gives process a sense of total control
  \end{itemize}
\end{itemize}
\end{slide}

\begin{slide}{Protected memory mode}
\label{sld:overview-protected-mem-mode}

\begin{itemize}
\item Uses the processor's protection mechanisms
\item Prevent access to memory already allocated to kernel or other processes
\item Bad programs can't crash the system
\begin{itemize}
  \item Theoretically
\end{itemize}
\end{itemize}
\end{slide}


\begin{slide}{Multiple Filesystem Types}
\label{sld:overview-fs-types}

\begin{itemize}
\item Native FS is ext3 (Third Extended File System)
  \begin{itemize}
  \item File names up to 255 chars
  \item More secure than conventional UNIX
  \end{itemize}
\item Others include:
  \begin{itemize}
  \item MS-DOS (FAT16), VFAT, FAT32
  \item ISO9660 (CD-ROM)
  \item HPFS (OS/2)
  \item NTFS (Windows NT)
  \item reiserfs, XFS, other journalling file systems for Linux,
  \item UPS, SysV and other proprietory UNIX
  \item NFS (Unix network file system)
  \item SMB / CIFS (MS Windows file sharing)
  \end{itemize}
\end{itemize}
\end{slide}







\begin{slide}{The Many Faces of a GNU/Linux System}
\label{sld:overview-faces-of-gnulinux-system}

\begin{itemize}
\item The user may see up to five aspects of Linux:
  \begin{itemize}
  \item the {\kwd filesystem}
  \item {\kwd processes}
  \item the {\kwd shell}
  \item the X {\kwd windowing system}
  \item {\kwd Inter-Process Communication} (IPC)
  \end{itemize}
\item The system is very highly configurable
\item Different users may experience totally different views of the
  same system
\item Multiple simultaneous users are normal
  \begin{itemize}
\item Linux is designed from the ground up as a {\kwd multi-user
    system}, NOT a `personal' system
  \end{itemize}
\end{itemize}
\end{slide}






\begin{slide}{The Filesystem}
\label{sld:overview-filesystem}

\begin{itemize}
\item The filesystem contains all data in the system
\item A name in the filesystem can refer to:
  \begin{itemize}
  \item a {\kwd data file}, which can be:
    \begin{itemize}
    \item a {\kwd plain file}
    \item a {\kwd directory}
    \end{itemize}
  \item a {\kwd device} (disk, tape etc.)
  \item internal memory
  \item OS information (the {\kwd proc} system)
  \end{itemize}
\item Directories are groups of files
\begin{itemize}
  \item Grouped in hierarchical {\kwd trees} 
\end{itemize}
\item Files are fully specified with their {\kwd pathname}
\item An original Unix structure; copied by most OSs
\end{itemize}
\end{slide}




\begin{slide}{Filenames}
\label{sld:overview-filenames}


\begin{itemize}
\item Maximum length depends on filesystem type
  \begin{itemize}
  \item Most allow up to 255 characters
  \end{itemize}
\item Can use almost any character in a filename, but avoid ambiguity by sticking to:
  \begin{itemize}
  \item (A-Z) Uppercase letters
  \item (a-z) Lowercase letters
  \item (0-9) Numbers
  \item (.)   Full-stop
  \item (,)   Comma
  \item (\_)  Underscore
  \item (-)  Hyphen
  \end{itemize}
\item Should convey meaningful info about contents
\item Type longer filenames using completion for:
  \begin{itemize}
  \item Filenames
  \item Pathnames
  \item Commands
  \end{itemize}
\end{itemize}
\end{slide}





\begin{slide}{Filename Extensions and File Types}
\label{sld:overview-filename-extensions-and-file-types}

\begin{itemize}
\item Filenames {\em don't} determine other attributes of file, 
  \begin{quote}
    i.e. do not, {\em automatically}, cause command interpreters to
    treat them in a particular way
  \end{quote}
\item However:
  \begin{itemize}
  \item Extensions can enable meaningful naming and automatic file
    manipulation
  \item C compilers and some other programs {\em do} depend on specific file
    extensions to carry out particular tasks  
  \end{itemize}
\item Common conventions for extensions: \\[16pt]
  \begin{table}[htbp]
    \begin{center}
{\scriptsize
      \begin{tabular}{|l|l|}  \hline
Filename      &   Meaning of Extension   \\ \hline \hline
program.c     &   C programming source file   \\ \hline  
program.o     &   Object code   \\ \hline 
program.sh    &   Shell executable   \\ \hline 
letter.txt    &   Text file of a letter   \\ \hline 
letter.ps     &   Postscript version of same letter file   \\ \hline 
letter.ps.gz  &   {\pgn gzip} compressed version of same   \\ \hline 
letter.tar.bz2 &   {\pgn tar} archive of same compressed by {\pgn bzip2}   \\ \hline 
letter.tgz    &   {\pgn tar} archive of same compressed by {\pgn gzip}   \\ \hline 
letter.tar.gz &   Another, more common, way of naming {\fn *.tgz}   \\ \hline 
letter.Z      &   Same file compressed with outdated {\pgn compress} utility   \\ \hline 

      \end{tabular}
}
      \caption{Common conventions for filename extensions}
      \label{tab:common-conventions-for-filename-extensions}
    \end{center}
  \end{table}
\end{itemize}
\end{slide}


\begin{slide}{Hidden Filenames}
\label{sld:overview-hidden-filenames}

\begin{itemize}
\item Filenames beginning with a full-stop are {\em hidden}
\item Typically used:
  \begin{itemize}
  \item To hide personal configuration files
  \item To avoid cluttering dirs with rarely used files
  \end{itemize}
\item Every dir contains 2 special hidden files:

  \begin{tabular}{ll}
       &                             \\
  .    &  The current directory file \\ 
  ..   &  The parent directory file  \\
  \end{tabular}
\end{itemize}
\end{slide}





\begin{slide}{The Shell ({\pgn bash})}
\label{sld:overview-the-shell}

\begin{itemize}
\item A {\kwd shell} is a program that you interact with
\vspace{10pt}

% \input{overview3.tex}
%\includegraphics[viewport= 14 14 602 582,width=200pt]{../images/overview3}
\includegraphics{../images/overview3-shell}
\item Can be any program, but is normally a {\kwd command interpreter}
\item A command interpreter is usually started when you log in (but
  this is just one way)
\item The `standard' Linux command interpreter is a {\kwd {\pgn Bourne}
    shell} look-alike called {\pgn bash}~\footnote{{\pgn Bash} has
    more functions than true {\pgn Bourne} shells; incorporating most of the
    innovations added by the {\pgn C} and {\pgn Korn} shells.  {\pgn
      Bash} functions and flags differ between implementations of UNIX
    and Linux.  The version of {\pgn bash} in current Linux releases
    tends to be the most fully functional {\pgn Bourne} shell around.}
\item The command line syntax provided by {\pgn bash} enables
  manipulation of files \& processes
\item The command-line frightens beginners but is the preferred home
  of the skilled
\end{itemize}
\end{slide}


\begin{slide}{Key Features of the Bash Shell}
\label{sld:overview-bash-key-features}

\begin{itemize}
\item Command history
\item Command aliasing
\item Shell scripting
\item Filename completion
\item Command completion
\item Command line editing ({\pgn emacs} and {\pgn vi} styles)
\item Job control
\item Key Bindings
\item Directory stacking
\item Tilde directory notation 
\item Help function, e.g. {\myts \begin{alltt}
$ \textbf{help history}
history: history [n] [ [-awrn] [filename]]
    Display the history list with line numbers.  Lines listed with
    with a `*' have been modified.  Argument of N says to list only
    the last N lines.  Argument `-w' means to write out the current
    history file;
\end{alltt}%
}%$
\end{itemize}
\end{slide}




\begin{slide}{Interacting with a Linux `Terminal'}
\label{sld:overview-interact-with-terminal}

\begin{itemize}
\item Linux can support any number of `terminal' types
  \begin{itemize}
  \item nowadays, monitor/keyboard combinations
  \item previously, dumb terminals
  \item occasionally, printers (debugging servers) 
  \end{itemize}
\item Most will use the {\kwd console} or a windowed terminal, but if
  not:
  \begin{itemize}
  \item Linux usually keeps a database of terminal capabilities in
    {\fn /etc/termcap}~\footnote{AT\&T flavours of UNIX use {\fn
        /usr/lib/terminfo} to store the same information and Linux
      can, if necessary.}
  \item If your terminal type is not recorded in {\fn /etc/termcap},
    you'll have problems running certain programs e.g.
    
    \begin{itemize}
    \item cursor driven apps ({\pgn top}, {\pgn linuxconf}, {\pgn vi} etc)
    \end{itemize}
  \item The {\kwd environmental variable} {\var TERM} tells programs
    what terminal type you are using
\end{itemize}
\end{itemize}
\end{slide}





\begin{slide}{Software Tools: The UNIX Philosophy}
\label{sld:overview-linux-philosophy}


\begin{itemize}
\item True UNIX-like systems treat programs as {\em tools}
\begin{itemize}
\item Each tool should:
  \begin{itemize}
  \item Do just one thing well
  \item Be generic (untied to specific applications)
  \end{itemize}
\item For new jobs, build new tools
\item (Re-)combine, don't complicate old tools
\end{itemize}
\item Linux can do this because it has:
\begin{itemize}
\item two simple {\em objects}:
  \begin{itemize}
  \item the file
  \item the process
  \end{itemize}
\item simple methods of {\em connecting}:
  \begin{itemize}
  \item processes to files
  \item processes to processes \\[12pt]
\includegraphics[width=0.6\slideWidth]%
{../images/linux_overview_unix_philosophy}
  \end{itemize}
\end{itemize}
\end{itemize}
\end{slide}




\begin{slide}{Tasks/Processes}
\label{sld:overview-processes}

\begin{itemize}
\item A {\kwd program} is an execut{\em able} object, stored in a file
\item A {\kwd process} is an execut{\em ing} object, i.e.~\footnote{Processes are often called {\em tasks}, as in `multi-tasking'}
  \begin{itemize}
  \item an {\em instance} of a program currently being run 
  \end{itemize}
\item Existing processes can `{\kwd fork}' to create other processes
  \begin{itemize}
  \item the only way to make new processes
  \end{itemize}
\item A user may run multiple copies of same program
\item Multiple users may run single/multiple copies
\item System tracks {\kwd ownership} and {\kwd permission}
\end{itemize}
\end{slide}



\begin{slide}{Process Communication}
\label{sld:overview-process-communication}

\begin{itemize}
\item Processes may need to co-operate by
  \begin{itemize}
  \item sharing files
  \item signalling events
  \item direct transfer of data
  \item pipelines (data streams)
  \item synchronising with each other
  \end{itemize}
\item Linux provides facilities for:
  \begin{itemize}
  \item signals
  \item shared memory
  \item pipes, both named and unnamed
  \item semaphores
  \item and others
  \end{itemize}
\item Processes may use network connections for communication,
  permitting {\kwd client-server} model
  \begin{itemize}
  \item Common for shared services like printing
  \end{itemize}
\end{itemize}
\end{slide}



\begin{slide}{Re-directing I/O to and from Files}
\label{sld:overview-pipes-anon-io}

\begin{itemize}
  \item Most processes will take input from the keyboard and output to the
        screen
  \item Both input and output streams can be {\kwd re-directed} to/from files
  \item Output to a file (creating or overwriting):\\
  {\sco \$ ls > my-system.txt}
  \item Appending output to a file:
  {\sco \$ who >{}> my-system.txt}
\end{itemize}
\end{slide}
{\center
\includegraphics{../images/linux_overview_redirect_IO_1}}



\begin{slide}{Re-directing I/O to and from Files (continued)}
\label{sld:overview-pipes-anon-io-continued}
\begin{itemize}
  \item Take input from one file, output to another:
  \mbox{\sco \$ sort  < /etc/passwd > pwd.sorted}\\[46pt]
\begin{center}
  %\includegraphics[width=220pt]{../images/linux_overview_redirect_IO_2}
  \includegraphics{../images/linux_overview_redirect_IO_2}
\end{center}
\end{itemize}
\end{slide}




\begin{slide}{Pipes \& Tools}
\label{sld:overview-pipes-and-tools}

\begin{itemize}
\item Linux tools act as filters:
  \begin{itemize}
  \item taking data from input streams, modifying it, sending it elsewhere
  \item expecting data to come from other tools
  \item producing output which {\em any} other tool can process, e.g. ASCII text
  \end{itemize}
\item One tool's output is connected to another's input:
  \begin{itemize}
  \item {\em Indirectly}, via a file created by the first tool
  \item {\em Directly}, via a {\kwd pipe} or {\kwd pipeline}
  \end{itemize}
  
\item For example, to page through a reverse-sorted version of your
  password file on screen:

{\sco \$ sort -r < /etc/passwd | less}\\[48pt]
{\center
\includegraphics{../images/linux_overview_pipes_and_tools}}
\end{itemize}
\end{slide}


\begin{slide}{Linux as a Programming Environment}
\label{sld:overview-programming-env}

\begin{itemize}
\item {\em Hierarchical Filestore}
\item Extensive set of {\em powerful tools}
  \begin{itemize}
  \item for software production, admin and support
  \end{itemize}
\item A {\em common system interface}
  \begin{itemize}
  \item only one set of procedures to learn
  \end{itemize}
\item Processes interface with {\em anonymous files}
  \begin{itemize}
  \item programs output to files or devices identically
  \end{itemize}
\item {\em Modular architecture} provides for a completely customised
  OS, e.g.
  \begin{itemize}
  \item An OS dedicated solely to graphics rendering
  \item A general-purpose system on one floppy
  \end{itemize}
\item {\em Flexible user interface} allows for uniquely customised
    programming environments
\end{itemize}
\end{slide}

\begin{slide}{Networking} 
\label{sld:overview-networking}

\begin{itemize}
\item Linux is a network operating system. 
\item The Internet network protocols (TCP/IP) are implemented in the kernel
\item Although other media are supported (e.g. radio, infra-red),
  links are usually across:
  \begin{itemize}
  \item Ethernet
  \item Serial Line (Point-to-point)
  \end{itemize}
\item Proprietory file/print serving protocols supported:
  \begin{itemize}
  \item Appletalk
  \item DECNET
  \item IPX / Novell Netware
  \item SMB / CIFS (MS Windows/NT)
  \end{itemize}
\end{itemize}
\end{slide}


\begin{slide}{TCP/IP}
\label{sld:overview-tcpip}
\begin{itemize}
\item A suite of Internet-standard protocols and apps for managing
  data transfers
\item Depicted as a `stack'
  \begin{itemize}
  \item hardware and transport control protocols at the bottom
  \item user applications (e.g. browsers) at the top 
  \end{itemize}
\item Client-server apps provide facilities for:
\begin{itemize}
\item Remote login
\item File transfer
\item Resource sharing (e.g. expensive peripherals)
\item Remote command execution
\item Email (internet/intranet/extranet) 
\item Web browsing
\end{itemize}
\end{itemize}
\end{slide}


\begin{slide}{Documentation}
\label{sld:overview-documentation}
\begin{itemize}
\item Copious, but fragmented and/or duplicated
\vspace{10pt}
  \begin{table}[htbp]
    \begin{center}
      \setlength{\extrarowheight}{0pt}\tiny
  \begin{tabular}[t]{|>{\PBS\rr}p{120pt}|>{\PBS\rr}p{243pt}|} \hline 
{\kwd Programmer's Manual} {\fn /usr/man} & The classic `{\kwd man pages}', first stop for skilled users, worth learning \\ \hline 
{\pgn info} pages &  hypertext browsable texts, often identical or updated versions of man pages \\ \hline 
{\fn /usr/share/doc/{\usb program-name}} &  ascii/html docs installed with the named program \\ \hline 
{\kwd Howtos} &  Tutorials on Linux-related topics, available on-line if installed (usually in {\fn /usr/share/doc}) \\ \hline 
www & Recently-released programs are usually documented on authorised web sites, many (including older tools) are documented by third-party sites  \\ \hline
  \end{tabular}
      \caption{Sources of Linux Documentation}
      \label{tab:sources-of-linux-docs}
    \end{center}
  \end{table}



\item Linux man pages divided into sections: 
\vspace{10pt}
{\myfs
  \begin{enumerate}
  \item User Commands
  \item {\kwd System calls}
  \item Subroutines (inc library routines)
  \item Devices (inc network interfaces)
  \item File Formats
  \item Games
  \item Miscellaneous
  \item System Administration
  \end{enumerate}
}

\vspace{10pt}
\item The {\pgn apropos} command word searches the description line in man pages.  Thus:

\begin{alltt}
$ \textbf{apropos printer}
\end{alltt}
will find man pages relating to printers, e.g.

{\scriptsize
\begin{verbatim}
lp (4)   - line printer devices
lpd (8)  - line printer spooler daemon
lprm (1) - remove jobs from the line printer spooling queue
\end{verbatim}
}



\end{itemize}
\end{slide}



\begin{slide}{Using the {\kwd man pages} (On-Line Manual)}
\label{sld:overview-on-line-manual}

\begin{itemize}
  
\item Use {\pgn man} to see man pages on a named command, e.g
\begin{verbatim}
$ man date
\end{verbatim}%$
\item The result should be something like:
  
  {\scriptsize
\begin{verbatim}
DATE(1)                        FSF                        DATE(1)

NAME
       date - print or set the system date and time

SYNOPSIS
       date [OPTION]... [+FORMAT]
       date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
\end{verbatim}
    }
\item {\sco DATE(1)} Shows page is in manual section 1
\item To view a page from a certain section use:
  
  {\cmdn \$ man -S {\usb section-number} {\usb command-name}}
\item Square brackets surround optional arguments
\begin{verbatim}
ls  [-abcdfgiklmnpqrstuxABCFGLNQRSUX1]
\end{verbatim}

\end{itemize}
\end{slide}
\end{document}
