% CVSId: $Id: kernel_overview.tex,v 1.2 2005/04/11 19:52:28 muli Exp $

\documentclass[final, total, pdf, colorBG, slideColor]{prosper}

\title{The Linux kernel} 
\subtitle{Past, Present and Future - the Linux way}
\author{Muli Ben-Yehuda}
\email{mulix@mulix.org}
\institution{IBM Haifa Research Labs}

\slideCaption{The Linux Kernel - HRL 2003}

\begin{document}

\maketitle

\begin{slide}{The Linux Kernel}

\begin{itemize}

\item linux is a free (speech and beer) UNIX like operating system,
developed by thousands of volunteers around the world - including
yours truly
\item started as a hobby, grew and matured with the years
\item countless man years went into it, some paid, some for fun 
\item one of the leading server operating systems today \dots
\item \dots and one of the leading embedded operating systems
\item poised to take over the desktop? Hebrew support? 

\end{itemize} 

\end{slide} 

\begin{slide}{The beginning}

\begin{tiny}\begin{tt}
\begin{verbatim}
From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
Date: 25 Aug 91 20:57:08 GMT

Hello everybody out there using minix -
I'm doing a (free) operating system (just a hobby, won't be big and
professional like gnu) for 386(486) AT clones. This has been brewing
since april, and is starting to get ready. I'd like any feedback on
things people like/dislike in minix, as my OS resembles it somewhat
(same physical layout of the file-system (due to practical reasons)
among other things). I've currently ported bash(1.08) and gcc(1.40),
and things seem to work.This implies that I'll get something practical
within a few months, andI'd like to know what features most people
would want. Any suggestions are welcome, but I won't promise I'll
implement them :-)  
Linus (torvalds@kruuna.helsinki.fi)
PS. Yes - it's free of any minix code, and it has a multi-threaded fs.
It is NOT protable (uses 386 task switching etc), and it probably never
will support anything other than AT-harddisks, as that's
all I have :-(
\end{verbatim}
\end{tt}\end{tiny}

\end{slide}

\begin{slide}{Linux - kernel or system?}

Linux is the name given to the Linux kernel by its creator, Linus
Torvalds. In common usage, Linux also refers to the entire suite of
software installed on a machine, including libraries and end user
applications, most of which came from the GNU project. How do we know
which is which? by context. 

As a side note, there are ``Linux distributions'' that do not use the
Linux kernel, and at least theoretically, the Linux kernel could be
used by other operating systems. 

\end{slide} 

\begin{slide}{How does it work?}

\begin{itemize} 

\item UNIX like kernel, exposing POSIX interfaces to user space
(system calls), but only where POSIX isn't braindead. We can aford to
implement things our own way if they give substantial performance
improvement
\item complete from-scrach implementation of a monolithic kernel
\item emphasis on pragmatic solutions - Linux is not a toy or research
OS! Having said that, we play with it plenty ;-) 
\item most of the kernel is platform independent, supports many
different platforms and hardware flavors 
\item same codebase runs on everything from wrist watches to super
computers

\end{itemize} 

\end{slide}

\begin{slide}{How is it developed?}

\begin{itemize}

\item (there used to be) a stable branch and experimental branch -
      2.4 was the last stable branch. With 2.6, the kernel maintainers
      are experimenting with various new schemes that blur the
      distinction between stable and experimental). 
\item (there used to be) {\bf long} formal release cycles, but closely
      adhering to the ``release early, release often'' principle for
      development snapshots
\item many people, companies and organizations, each pushing to have
      their prefered patches merged. Only one person can actually
      merge things - Linus Torvalds, a benevolet dictator
\item Linus's job is to say {\bf NO}
\item IBM contributes heavily to Linux development, via the LTC and
      OSDL 

\end{itemize} 

\end{slide} 

\begin{slide}{The past}

\begin{itemize}

\item Linux 1.0 - March 1994, i386 only, UP only

\item Linux 1.2 - March 1995, no longer i386: Alpha, Sparc and Mips
are now supported 

\item Linux 2.0 - June 1996, initial SMP support (guess who sponsored
the work...) 

\item Linux 2.2 - January 1999, many improvments all over the
system. Considered one of the better Linux kernel trees, many people
are still using it.

\end{itemize} 

\end{slide} 

\begin{slide}{The old stable branch}

Linux 2.4 is the latest stable release tree. It is in wide usage and
obviously works, but has its share of problems and flaws (obviously,
those are fixed in the latest and greatest, 2.6)

\begin{itemize} 

\item highly divergent vendor trees. The Linux vendors, such as
redhat and SuSE, are under a lot of customer pressure and thus have a
different view of what should go in the kernels they distribute. 

\item development of the 2.4 kernel tree has ground to an almost
standstill. (Almost) all new development occurs in the 2.5 kernel. 

\item having said that, most(?) commercial kernel code is still being
written on 2.4 and even 2.2 

\end{itemize} 

\end{slide} 

\begin{slide}{2.6}

\medskip
\medskip 
\center {\huge Linux 2.6}

\end{slide} 

\begin{slide}{VM Changes} % 3

\begin{itemize}

\item the actual 'reverse mappings' part of Rik van Riel's rmap vm was
merged. The VM paging algorithm should be smarter now, and VM
behaviour under certain loads should improve. Slight performance hit
due to copying the pte chains on fork. 

\item what is rmap? rmap  allows the VM to know, given a physical
memory page, which processes are using it - more intelligent decisions
on heavy load and swapout.  

\item better behaviour under load, better behaviour on ``enterprise
machines''. The kernel booted with 32Gb and 64Gb of memory on 32 bit
machines! (work done mostly by LTC members)

\end{itemize} 

\end{slide}

\begin{slide}{Kernel Preemption} % 4

\begin{itemize}

\item wsers should notice much lower latencies especially in demanding
  multimedia applications.
\item code which is SMP safe should mostly be preempt safe. But, there
  are still cases where preemption must be temporarily disabled where
  we do not. These areas occur in places where per-CPU data is used. 
\item several subsystems are not known to be preempt safe -
  be careful when enabling preempt. 
\item if you get ``xxx exited with preempt count=n'' messages in syslog,
  don't panic, these are non fatal, but are somewhat unclean.
  (Something is taking a lock, and exiting without unlocking)

\end{itemize} 

\end{slide}

\begin{slide}{Scheduler Improvements} % 5

\begin{itemize}

\item Ingo Molnar reworked the process scheduler to use an O(1)
 algorithm.  
\item users should notice no changes with low loads, and increased
  scalability with large numbers of processes, especially on large SMP systems.
\item utilities for changing behaviour of the scheduler (binding
  processes to CPUs etc). http://tech9.net/rml/schedutils. 
\item sched\_yield() and yield() can now make you sleep for a {\em long}
  time. 
\item 2.5 adds system calls for manipulating a task's processor
  affinity: sched\_getaffinity() and sched\_setaffinity()
\item work on the scheduler, especially in the area of interactive
      performance, is on-going

\end{itemize} 

\end{slide}

\begin{slide}{Threading improvements} % 6

\begin{itemize}

\item lots of work went into threading improvements.  Some of the features of this work are:
\begin{itemize} 
  \item  generic pid allocator (arbitrary number of PIDs with no slowdown,
     unified pidhash). 
  \item  POSIX thread signals stuff (atomic signals, shared signals, etc.)
  \item  threaded coredumping support
  \item  sys\_exit() speedups (O(1) exit)
  \item  generic, improved futexes
\end{itemize} 
\item users should notice is a significant speedup in basic thread
  operations this is true even for old-threading userspace libraries such
  as LinuxThreads.
\item Native Posix Threading Library (NPTL). A userspace threading
library utilizing the new threading improvements. 

\end{itemize} 

\end{slide}

\begin{slide}{IO subsystem} % 8 

\begin{itemize}

\item considerable throughput improvements over 2.4 due to much
  reworking of the block and the memory management layers.

\item assorted changes throughout the block layer meant various block
  device drivers had a large scale cleanup whilst being updated to
  newer APIs.

\item O\_DIRECT improvements, size and alignment of data per device,
  not filesystem. 

\item block devices can now access up to 16TB on 32-bit architectures,
  and up to 8EB on 64bit architectures.

\item AIO is now included in the kernel, but seems to offer no
  substantial benefits?

\end{itemize} 

\end{slide}

\begin{slide}{OProfile} % 15

A system wide performance profiler has been included in 2.5.
With this option compiled in, you'll get an oprofilefs filesystem
which you can mount, that the userspace utilities talk to.
The userspace utilities for this are very young, and still being developed.
You can find out more at
http://oprofile.sourceforge.net/oprofile-2.5.html

Oprofile is pretty useful, from experience. It allows you to profile
both userspace applications and the kernel (hence the ``system wide''
moniker). 

\end{slide}

\begin{slide}{what is UML?}

User Mode Linux (UML, hereafter) is a port of Linux (the kernel) to
run as a program inside Linux (the system). Instead of working
directly with the hardware, UML uses the host's system call
interface in place of the hardware. Surprisingly enough, it actually
works. 

\end{slide} 

\begin{slide}{what is it good for?}

\begin{itemize}

\item testing and debugging kernel patches, without requiring a reboot
\item private servers on shared hosts
\item experimenting with system administration scenarios
\item teaching operating systems ;-) 
\item UML clusters... 
\item (when UML-win32 comes of age) running Linux on windows machine -
tapping into unused resources at night

\end{itemize} 

\end{slide}

\begin{slide}{how does it work?}

\begin{itemize} 

\item A UML process executes a system call instruction (int 0x80)
\item via ptrace, the tracing thread is woken up 
\item the tracing thread annuls the system call on behalf of the UML
process, and then forces the kernel to execute the system call
\item the system call is executed, and when it is done, the tracing
thread is woken up again 
\item the tracing thread manipulates the UML process state to think it
completed the system call 
\item the UML process continues 

\end{itemize} 

\end{slide} 

\begin{slide}{more goodies}

(In no particular order) Infiniband, SELinux, Ingo's RT work, seccomp,
4K stacks, auditing framework, kernel events, laptop mode, IO
schedulers, sched domains, circular pipe buffers, CKRM, kprobes,
kexec, debugfs, four-level page tables, inotify, futexes, fuse,
reiser4, NX support, address space randomization, netpoll,
VIRTUALIZATION.

\end{slide}

\begin{slide}{more info}

The Linux kernel:
\begin{itemize}
\item http://www.kernel.org
\item Understanding the Linux Kernel, by Bovet and Cesati, 2nd edition
\item the linux-kernel mailing list -
http://marc.theaimsgroup.com/?l=linux-kernel 
\item the kernelnewbies community - http://www.kernelnewbies.org 
\end{itemize} 

What's new in 2.6: 
\begin{itemize}
\item http://www.codemonkey.org.uk/post-halloween-2.5.txt
\end{itemize} 

User Mode Linux: 
\begin{itemize}
\item http://user-mode-linux.sf.net
\end{itemize} 

\end{slide} 

\begin{slide}{Q, A, M and T?}

\end{slide}

\end{document} 
