UNIX Architecture

UNIX Architecture:

  • Kernel
  • Shell
  • File Systems

Kernel:

Kernel is the master control program of the operating system. It controls major all major sub programs such as I/O (input/output) management (i.e., accessing the peripheral devices), process management, file management, memory management, network management. File management program deals with all input and output which includes files and terminals, integration of storage devices. Process management deals with programs and program interaction i.e., how processes share CPU, memory and signals, inter process communications (system calls), decides how each process runs on the processor by taking turns and only write in the area of memory segment allocated to them.

Most variant of Kernel consist of:
– Scheduler – which tells how different processes will be sharing processing time of kernel with in a specific order
– Supervisor – gives permission to each process to use OS when it is scheduled
– Interrupt handler – handles requests coming from hardware (mouse, keyboard, disk drives) attached to OS that requires kernel services
– Memory Manager – decides how the system memory spaces will be shared among kernel services and users without creating conflicts.

Shell:

Shell provides a window for interaction between users and kernel of operating system. Shell interprets the commands entered by the user or supplied by a shell script and passes them to kernel for execution. It displays a command prompt window where user enters command. After return key is pressed, shell sends the command to kernel for execution in an order and when the command is finished, shell redisplays the prompt. A shell is another program like pwd, cd, cat etc, only difference is that its keep running at user’s terminal. If no input is provided by user, shell will remain idle. Shell is invoked before the command is executed. For e.g., for command cat abc.log, (which is used to view the content of abc.log file), the shell searches the file stores for the file containing the program cat and requests kernel through system calls to execute the program cat on abc.log file. Once cat abc.log command is finished executing, the shell returns command prompt to user for making it available for entering of next commands.




Most Commonly Used Shells

– /bin/sh The Bourne Shell / POSIX shell: Written by Steve Bourne of Bell Labs
– /bin/csh C shell: Written at University of California, Berkeley
– /bin/tcsh Enhanced C Shell (TENEX C Shell): Written by Ken Greer at Carnegie Mellon University
– /bin/ksh Korn shell: Written by David Korn of Bell Labs
– /bin/bash Bourne Again Shell: Written by Free Software Foundation under their GNU initiative.

File System:

A file system is a logical method of storing and organising data and a file is a smallest unit of data that can be stored.

Hierarchy of File System:

At the top of the file system has directory called ‘root’ which is denoted by ‘/’. Root has further divided in to various file systems such as /bin, /etc, /dev, /lib, /stand, /unix, /swap, /home, /tmp, /var.

  • /bin – it has executable binary files for commands and utilities.
  • /etc – it has system admin command and configuration files.
  • /dev – it has configuration files for setting up printer and terminals
  • /lib – it has library files for programs used by system and users
  • /tmp – it is used for storing temporary files both data and log files generated by applications, scripts.
  • /home – it has a home directory for each user in the system.
  • /usr – it has multiuser sharable system files and directories
  • /var – it has files of mail queue logs, the print spooler area, temporary storage files downloaded from internet
  • /sbin – it has binary files of system admin command.