Saturday, October 19, 2013

The Fundamentals of Unix


This chapter focuses on understanding the Unix architecture, the features of Unix operating systems and other aspects about Unix.


Unix Architecture

To explain the concepts in the most simplified way, let's take an example of your personal computer running Windows operating system. 

Your personal computer monitor, keyboard, processor, HDD, Memory, Optical drive, USB drive etc constitutes the Hardware. You just can't have only the hardware for functioning. You need a Software too. This software is your operating system ( Windows). The operating system comprises of Kernel, Command interpreter, applications, databases etc.  The kernel is the core of any operating system. The command prompt ( Non GUI) or a Mouse Click ( GUI) is where you give the input. This can be imagined to be a Interpreter for the user to give inputs. These inputs are passed on to the Operating system kernel for the actual processing. The output is finally given back to the hardware ( monitor or speaker or printer) mainly by the kernel.

With above the above example, I'd like to illustrate the Unix architecture in almost the similar fashion. Every Unix architecture consists of 
1) Hardware
2) Kernel
3) Shell
4) Applications
5) End user.

The schematic representation is illustrated below

Hardware 
This is the Physical component of your computer. It consists of Monitor, Mouse,Keyboard, Network Card, Memory, Processor.

Kernel.
The kernel is the core of the operating system. The kernel interacts with the machine hardware. It also interacts with the Software. Example : Linux Kernel.   The kernel consists of C language written sub-routines which makes it possible for it to communicate with the Hardware and Software. When you boot your machine, the kernel component gets loaded first.
Applications uses the services of kernel. These applications (software's) access kernel through system calls.
Kernel manages the machine's memory, it schedules system processes.

Shell
The Shell is a command line interpreter. It's an interface between the user and kernel. Any command you type in will be forwarded to the kernel for execution.

System calls
These are programs ( functions ) used by user program to access the kernel services to interact with hardware. Example : Open system call, Write system call.
When a user opens a new file. ie he clicks on the mouse and creates a new file, the input is read by shell which then passes to the kernel which calls the "Read system call" function. This read system call function gets executed which ultimately allows a new file to be created. The final output is visible on your hardware ( monitor)



Features of UNIX


1) Files and Process 
       Unix treats everything in the system as files. The hardware is also treated as a file. A directory is also treated as a file. 


2) Multiuser system
Unix allows multiprocessing or multiusers to access the system (CPU).


3) Multitasking system

UNIX is a multitasking system which allows a user to run multiple tasks concurrently. You can edit a file, print a file, e-mail a file and browse the internet simultaneously. 


4) Building Block architecture.

UNIX doesn't have a single command that can do a job at one shot. Instead it has thousand of commands which when combined can do any tasks with ease and perfection. Example ls and wc commands are combined using pipes to get the files listing and line count. 
In simple words, small commands are combined together to get your task done. 


5) UNIX tools

UNIX has beautiful structure of applications and toolkit. It has general purpose tools, text manipulation tools, filters, compilers, interpreters, networked applications, system administration tools and many more.


6) Pattern matching

UNIX has simple expression or characters called as meta characters which are used to match lengthy patterns and long listing of files. The metacharacter (*) is mostly used in pattern matching techniques.

7)  Documentation

UNIX has extensively written documentation about every single command, tools, and it's system. If you need any help or information on a command, you can easily refer to its documentation. 

No comments:

Post a Comment