COMP421
Unix Environment for Programmers
Lecture 02: System overview____________________________________

Jeff Wiegley, Ph.D.
Computer Science
jeffw@csun.edu

08/29/2005

1


Unix___________________________________________________

“Unix” has come to mean two different compenents simultaneously:

  1. Operating System (Kernel): Responsible for protecting and allocating resources in a fair manner.
  2. A collection of applications and utilities that provide productivity.

2


Basic operating system architecture:______________



3


Kernel:________________________________________________

Technically “Linux” only refers to the Linux kernel (as provided by linux-2.6.13.tar.bz2 for example).

GNU/Linux or Linux/GNU refers to the everything including the kernel.

4


Library routines:_____________________________________

5


Shell:__________________________________________________

The “Shell” is the interactive application that a person is presented with upon logging on to the system.

6


Applications:_________________________________________

Applications are everything else the user uses (and to a large extent the shell is just another application).

Unix Applications (sort of) fall into two broad classifications;

  1. Utilities: Small programs that do some type of limited processing but do it very efficiently and very flexibly.

    These are sometimes called “filters” because their input and output can be chained together through I/O redirection to produce very complicated and accurate results very, very quickly.

  2. Applications: Major, single purpose, stand alone programs.

7


File system:___________________________________________

The Unix kernel treats almost every resource as a file and presents it to the use as a file.

Files are, of course, files that can be read and written using a file descriptor.

But memory network communication are also “files”.

Even the input and output from programs is treated as a file. (Which is why you can “pipe” the output from one program as input to another program.)

8


Files and Directories:________________________________

Unix doesn’t have C:/> or D:/> drives because drives are not presented to the user as discrete seperate filesystems.

Instead Unix “mounts” drives under a single filesystem.

The top most directory is simply called “/” or the “root” filesystem.

Entries in the filesystem can be one of:

9


Typical filesystem:___________________________________

For example this lecture file is:

/home/jeffw/Northridge/Semesters/Current/COMP421/Lectures/lecture02.tex

All of the data can be read on the hard drive at /dev/hda since the kernel represents the first harddrive as that file. (/dev/hdb is the second IDE drive). Sounds scary except the permissions for /dev/hda are:

brw-rw---- 1 root disk 3, 0 2005-08-22 14:38 /dev/hda

which means only the root user can access that file (and therefor the harddrive directly) [the b” means it’s a “block special file”.

10


Quick nomenclature:_________________________________

/home/jeffw/Northridge/Semesters/Current/COMP421/Lectures/lecture02.tex

Is known as a Path or pathname. This particular one is an absolute path since its reference goes all the way to the root.

The current working directory is the directory that a relative path would be relative to when given.

Lectures/lecture02.tex

Is a relative path. And depending on what my current working directory is might be COMP421 lectures or COMP598EA lectures.

The current working directory is not specific to an interactive shell. Running programs have a current working directory that relative paths are suffixed to when issuing commands such as

open(somefilename,O RDONLY).

11