Thursday, October 27, 2011

Studying FreeBSD, Part 0: Preparatory Materials

So, I am disappointed with Ubuntu's Unity interface, and immediate switch to Gnome 3. Out of disgust, I am switching to FreeBSD.

However, I would like to study the source code to be prepared for anything! How do this? I outline my thoughts in this post...

In the Beginning, there was Unix 6 (And it WAS Good!)


So FreeBSD traces its roots back to V6. Today, there is a modern version of V6 for the x86 machine: xv6 [mit.edu].

Some may find Lions' Commentary [lemis.com] to be useful as well.

This is a little bit dated, but fortunately the xv6 team has decent documentation [mit.edu] which explains a lot regarding operating systems.

One may be tempted to refer to Maurice J. Bach's excellent text Design and Implementation of the Unix System, but resist this urge! Bach's text discusses UNIX System V (1986 version), whereas V6 is a decade older.

FreeBSD derives from BSD-lite, which is in turn based on V6 not SysV!

On the second day, there was the SHELL (and it was GOOD!)


FreeBSD comes with the Almquist Shell, and the C-shell.

Should we worry about the C-shell, which is a preloaded shell used in FreeBSD? There are 10 reasons not to use the C-shell [grymoire.com]:
  1. The Ad Hoc Parser
  2. Multiple-line quoting difficult
  3. Quoting can be confusing and inconsistent
  4. If/while/foreach/read cannot use redirection
  5. Getting input a line at a time
  6. Aliases are line oriented
  7. Limited file I/O redirection
  8. Poor management of signals and sub-processes
  9. Fewer ways to test for missing variables
  10. Inconsistent use of variables and commands.
So...perhaps it is best to use something like ASH. This is the default shell for root, and it is a clone of the original Bourne shell.

The positive aspects to it: it's minimal, lightweight, doesn't consume a lot of memory.

The negative aspects to it: because it's so Spartan, it has no bells or whistles to speak of.

Perhaps I will eventually write up something on advanced ASH scripting one day...

No comments: