Introduction to UNIX System
Unix is an Operating System that is truly the base of all Operating Systems like Ubuntu, Solaris, POSIX, etc. It was developed in the 1970s by Ken Thompson, Dennis Ritchie, and others in the AT&T Laboratories. It was originally meant for programmers developing software rather than non-programmers.
Unix and the C were found by AT&T and distributed to government and academic institutions, which led to both being ported to a wider variety of machine families than any other operating system. The main focus that was brought by the developers in this operating system was the Kernel. Unix was considered to be the heart of the operating System. System Structure of Unix OS are as follows:
Figure – system structure
- Layer-1: Hardware –
It consists of all hardware related information.
- Layer-2: Kernel –
It interacts with hardware and most of the tasks like memory management, task scheduling, and management are done by the kernel.
- Layer-3: Shell commands –
Shell is the utility that processes your requests. When you type in a command at the terminal, the shell interprets the command and calls the program that you want.
There are various commands like cp, mv, cat, grep, id, wc, nroff, a.out and more.
- Layer-4: Application Layer –
It is the outermost layer that executes the given external applications.
Figure – kernel and its block diagram
This diagram shows three levels: user, kernel, and hardware.
- The system call and library interface represent the border between user programs and the kernel. System calls look like ordinary function calls in C programs. Assembly language programs may invoke system calls directly without a system call library. The libraries are linked with the programs at compile time.
- The set of system calls into those that interact with the file subsystem and some system calls interact with the process control subsystem. The file subsystem manages files, allocating file space, administering free space, controlling access to files, and retrieving data for users.
- Processes interact with the file subsystem via a specific set of system calls, such as open (to open a file for reading or writing), close, read, write, stat (query the attributes of a file), chown (change the record of who owns the file), and chmod (change the access permissions of a file).
- The file subsystem accesses file data using a buffering mechanism that regulates data flow between the kernel and secondary storage devices. The buffering mechanism interacts with block I/O device drivers to initiate data transfer to and from the kernel.
- Device drivers are the kernel modules that control the operator of peripheral devices. The file subsystem also interacts directly with “raw” I/O device drivers without the intervention of the buffering mechanism. Finally, the hardware control is responsible for handling interrupts and for communicating with the machine. Devices such as disks or terminals may interrupt the CPU while a process is executing. If so, the kernel may resume execution of the interrupted process after servicing the interrupt.
- Interrupts are not serviced by special processes but by special functions in the kernel, called in the context of the currently running process.
Difference between Unix and Linux –
Linux is essentially a clone of Unix. But, basic differences are shown below:
Linux Unix The source code of Linux is freely available to its users The source code of Unix is not freely available general public It has graphical user interface along with command line interface It only has command line interface Linux OS is portable, flexible, and can be executed in different hard drives Unix OS is not portable Different versions of Linux OS are Ubuntu, Linux Mint, RedHat Enterprise Linux, Solaris, etc. Different version of Unix are AIS, HP-UX, BSD, Iris, etc. The file systems supported by Linux are as follows: xfs, ramfs, vfat, cramfsm, ext3, ext4, ext2, ext1, ufs, autofs, devpts, ntfs The file systems supported by Unix are as follows: zfs, js, hfx, gps, xfs, vxfs