General Overview Of UNIX System

Spread the love

First UNIX system was developed in 1969 and ran on systems from microprocessors to mainframes and provided a common execution environment across them. The system was divided into two parts :

  1. Programs and services: It is the part readily apparent to users e.g. shell, mail text editor etc.
  2. Operating System: That supports above-mentioned programs and service.

The early version of UNIX was developed after the end of development of Multics OS. In an attempt to improve their programming environment, Ken Thompson, Dennis Ritchie, and others sketched a paper design of a file system that later evolved into an early version of the UNIX file system. In 1973, the UNIX was rewritten in C.  1977 marked the year that the UNIX system was first “ported” to a non-PDP machine (that is, made to run on another machine with few or no changes), the Interdata 8/32. In the period from 1977 to 1982, Bel1 Laboratories combined several AT&T variants into a single system, known commercially as UNIX System III. Bell Laboratories later added several features to UNIX System III, calling the new product UNIX System V. However, people at the University of California at Berkeley had developed a variant to the UNIX system, providing some new, interesting features.

By the beginning of 1984, there were about 100,000 UNIX system installations
in the world. Reasons for the popularity and success of the UNIX system :

  1. The system was written in a high-level language, making it easy to read, understand, change, and move to other machines. Ritchie estimates that the first system in C was 20 to 40 percent larger and slower because it was not written in assembly language, but the advantages of using a higher-level language far outweigh the disadvantages.
  2. It had a simple user interface that had the power to provide the services that users want.
  3. It provided primitives that permit complex programs to be built from simpler programs.
  4. It used a hierarchical file system that allows easy maintenance and efficient implementation.
  5. It used a consistent format for files, the byte stream, making application programs easier to write.
  6. It provided a simple, consistent interface to peripheral devices.
  7. It was a multi-user, multiprocess system; each user can execute several processes simultaneously.
  8. It hid the machine architecture from the user, making it easier to write
    programs that run on different hardware implementations.

Although the operating system and many of the command programs are written in C, UNIX systems support other languages, including Fortran, Basic, Pascal, Ada, Cobol, Lisp, and Prolog. The UNIX system can support any language that had a compiler or interpreter and a system interface that maps user requests for operating system services to the standard set of requests used on UNIX systems.


Viewing the system as a set of layers, the operating system is commonly called the system kernel, or just the kernel, emphasizing its isolation from user programs. Programs such as the shell and editors (ed and vi) shown in the outer layers interact with the kernel by invoking a well defined set of system calls. The system calls instruct the kernel to do various operations for the calling program and exchange data between the kernel and the program. Several programs shown in the figure are in standard system configurations and are known as commands, but private user programs may also exist in this layer as indicated by the program whose name is a.out, the standard name for executable files produced by the C compiler.  Although the figure depicts a two-level hierarchy of application programs, users can extend the hierarchy to whatever levels are appropriate. Indeed, the style of programming favored by the UNIX system encourages combination of existing programs to accomplish a task.

Many application subsystems and programs that provide a high-level view of system such as the shell, editors, SCCS (Source Code Control System), use lower-level services ultimately provided by the kernel, and they avail themselves of these services via the set of system calls.



  • File System
    • The UNIX file system is characterized by
      • a hierarchical structure,
      • consistent treatment of file data,
      • the ability to create and delete files,
      • dynamic growth of files,
      • the protection of file data,
      • the treatment of peripheral devices (such as terminals and tape units) as files.
    • The file system is organized as a tree with a single root node called root (“/”); every non-leaf node of the file system structure is a directory of files  and files at the leaf nodes of the tree are either directories or regular files or special device files. The name of a file is given by path name.. A path name is a sequence of component names separated by slash characters.
    • Programs in the UNIX system have no knowledge of the internal format in which the kernel stores file data, treating the data as an unformatted stream of bytes. The syntax of accessing the data in a file is defined by the system and is identical for all programs, but the semantics of the data are imposed by the program.
    • (list the names and attributes of files) can discover the files in a directory. Permission to access a file is controlled by access permissions associated with the file. Access permissions can be set independently to control read, write, and execute permission for three classes of users: the file owner, a file group, and everyone else.
    • The UNIX system treats devices as if they were files. Device: designated by special device files, occupy node positions in the file system directory structure. Programs access devices with the same syntax they use when accessing regular files; the semantics of reading and writing devices are to a large degree is same as reading and writing regular files. Devices are protected in the same way, that regular files are protected: by proper setting of their (file) access permissions.
    • The system call mknod creates a new directory.
  • Processing Environment
    • A program is an executable file, and a process is an instance of the program in execution.
    • Four major system calls used for process control: fork, exec, wait, and, discreetly, exit.
    • The shell interprets the first word of a command line as a command name: for many commands, the shell forks and the child process execs the command associated with the name, treating the remaining words on the command line as parameters to the command.
    • The shell allows three types of commands. First, a command can be an executable file that contains object code produced by compilation of source code (a C program for example). Second, a command can be an executable file that contains a sequence of shell command lines. Finally, a command can be an internal shell command (instead of an executable file).
    • Shell allows synchronized and asynchronized command execution. Commands executed asynchronously are said to execute in the background (command &).
  • Building Block Primitives
    • Capability to redirect I/O. Processes conventionally have access to three files: they read from their standard input file, write to their standard output file, and write error messages to their standard error file.
    • The shell recognizes the symbols “<“, “>”, and “2>” and sets up the standard input, standard output, and standard error appropriately before executing the processes. e.g.
      • nroff —mm < docl > docl.out 2> errors
    • The second building block primitive is the pipe, a mechanism that allows a stream of data to be passed between reader and writer processes. Processes can redirect their standard output to a pipe to be read by other processes that have redirected their standard input to come from the pipe.
    • The use of pipes frequently makes it unnecessary to create temporary files.


  • Among the services provided by the kernel are:
    • Controlling the execution of processes by allowing their creation, termination or suspension, and communication
    • Scheduling processes fairly for execution on the CPU. Processes share the CPU
      in a time-shared marmer: the CPU executes a process, the kernel suspends it when its time quantum elapses, and the kernel schedules another process to execute. The kernel later reschedules the suspended process.
    • Allocating main memory for an executing process. The kernel allows processes to share portions of their address space under certain conditions, but protects the private address space of a process from outside tampering. If the system runs low on free memory, the kernel frees memory by writing a process temporarily to secondary memory, called a swap device, lithe kernel writes entire processes to a swap device, the implementation of the UNIX system is called a swapping system; if it writes pages of memory to a swap device, it is called a paging system.
    • Allocating secondary memory for efficient storage and retrieval of user data.
    • Allowing processes controlled access to peripheral devices such as terminals, tape drives, disk drives, and network devices.


  • When a process executes a system call, the execution mode of the process changes from user mode to kernel mod.
  • The differences between the two modes are :
    • Processes in user mode can access their own instructions and data but not kernel instructions and data (or those of other processes). Processes in kernel mode, however, can access kernel and user addresses.
    • Some machine instructions are privileged and result in an error when executed in user mode.
    • The kernel is not a separate set of processes that run in parallel to user processes, but it is part of each user process.
  • Interrupts and Exceptions
    • The UNIX system allows devices such as I/O peripherals or the system clock to interrupt the CPU asynchronously. On receipt of the interrupt, the kernel saves its current context (a frozen image of what the process was doing), determines the cause of the interrupt, and services the interrupt.
    • Exceptions happen “in the middle” of the execution of an instruction, and the system attempts to restart the instruction after handling the exception; interrupts are considered to happen between the execution of two instructions, and the system continues with the next instruction after servicing the interrupt.
    • The UNIX system uses one mechanism to handle interrupts and exception conditions.
  • Processor Execution Levels
    • The kernel must sometimes prevent the occurrence of interrupts during critical activity, which could result in corrupt data if interrupts were allowed.
    • Setting the processor execution level to certain values masks off interrupts from that level and lower levels, allowing only higher-level interrupt.
  • Memory Management
    • When compiling a program, the compiler generates a set of addresses in the program that represent addresses of variables and data structures or the addresses of instructions such as functions. The compiler generates the addresses for a virtual machine as if no other program will execute simultaneously on the physical machine.