Ken Thompson, Dennis Ritchie, and their team developed an Operating System called Unix (Uniplexed Information Computing System) in 1970 in the AT&T laboratory. So, Unix dates from 1970 and it is pretty old. However, most of us might not have used Unix in our lives. The reason is pretty simple. Unix was developed for the programmers/software developers to build software. It was not initially created for use by the common public.
However, from Unix, we got many other Operating Systems like Ubuntu, Solaris, etc. These operating systems are also used more commonly by the public, especially Ubuntu. So, it becomes important and interesting to know about the architecture of the Unix Operating System as it is the architecture that helps the Unix Operating System be efficient for software developers and also helps in building other Operating Systems.
In this article, we will understand the Unix Architecture, Features of Unix, and advantages of Unix Architecture in detail. So, let’s get started.
What is the Unix Operating System?
Well, we know that Unix is an Operating System. Like any other Operating System, Unix also acts as an interface between the user and the hardware, i.e. the user and the computer itself. Unix mainly focuses on the concept of Kernel and Shell division of an Operating System due to which it is so powerful.
- Kernel: The kernel is a program in the Operating System software that keeps on running in the background when the machine is on and it is responsible for allocating the resources to the processes, handling and coordinating the multiple processes running together.
- Shell: However, since the kernel is such an essential program in the Operating System and performs almost all of the major tasks, it should not be directly accessible to the user. So, there is a program between the user and the kernel that helps the user interact with the kernel. This program is called the shell.
Features of Unix Operating System
Following are the features of the Unix operating system that date from the very first version to the latest versions of Unix:
- Multitasking Operating System: In Unix, a user can run multiple tasks/processes simultaneously. For example, a user can run a text editor and can also open a web browser at the same time. However, it is important to note that “multitasking” is not what actually happens behind the scenes. The Unix operating system can only execute one process at a time. However, multiple processes are brought into the main memory and context switching happens in the main memory. This means that a process executes only for a fixed interval of time (called the time quantum) and after it has executed that many units of time, it gets removed and some other process executes. Now, this process will also execute for quantum time, and then it will also get switched by some other process. So, the turn of the first process will come again and it will execute from where it left. This happens so fast that it creates an illusion of multitasking, i.e. multiple processes being run at the same time. This multitasking feature can also be seen in Windows OS.
- Multiuser Operating System: In Unix, multiple users can run their own tasks/processes simultaneously. Hence, Unix is called a multiuser OS. However, the case is the same as multitasking. Each user executes his/her own process for quantum units of time and then the process gets context switched and the other user’s process starts executing. Then, after some time, the first user’s process will again be executed from where it left. This happens really fast and creates an illusion of a multiuser operating system.
- Small Commands and Pipelining: The Unix is a programmer-friendly software as it relies more on the commands rather than GUI (Graphical User Interface). To provide convenience to the programmers, UNIX has a small command for every small task we do in Unix. For example, the ls command is used to list all the files and directories inside the current directory in which we are working. Another example is the wc command, which is used to count words and bytes for files. Pipelining of commands is a concept of connecting multiple small commands using a pipe “ | ” symbol to perform complex instructions. For example, the above 2 commands can be pipelined as “$ ls | wc”. This command can count the number of files in the directory.
- The Powerful Unix Toolkit: Unix has a toolkit, that is, it has multiple applications that help in performing multiple tasks. For example, Unix has compilers and interpreters, text manipulation tools, system administration tools, etc. Whenever a new version of Unix is released, some of the old programs/applications are either modified or removed from the toolkit and some new applications are added.
So, these were some of the topmost features of the Unix Operating System. Apart from this, the ease of programming in Unix because of the above features and the amazing Unix documentation helps increase its power more. Now that we have some basic idea about Unix and its features, let us learn about Unix Architecture.
Have a look at the image shown below:
The Unix architecture has 4 layers. These layers are as shown below:
Hardware: Hardware is the most simple and least powerful layer in the Unix Architecture. Hardware is the components that are humanly visible. Whatever hardware is connected to a Unix operating system-based machine, comes in the hardware layer.
Kernel: This is the most powerful layer of the Unix architecture. The kernel is responsible for acting as an interface between the user and the hardware for the effective utilization of the hardware. The kernel handles the hardware effectively by using the device drivers. The kernel is also responsible for process management. So, the main 2 features of the kernel are process management and file management.
- Process Management: The processes that execute within the operating system require a lot of management in terms of memory being allocated to them, the resource allocation to the process, process synchronization, etc. All this is done by the Kernel in Unix OS. This is done using various Operating System Techniques like paging, framing, virtual memory, swapping, context-switching, etc.
- File Management: File management involves managing the data stored in the files. This also includes the transmission of data stored in these files to the processes as and when they request it.
Shell: We understood the importance of the kernel and that it handles most of the important and complex tasks of Unix OS. Since the kernel is such an important program of the Unix Operating System, its direct access to the users can be dangerous. Hence, the Shell comes into the picture. Shell is an interpreter program that interprets the commands entered by the user and then sends the requests to the kernel to execute those commands. When the execution of the process is completed, the shell again sends a request to the kernel to display the program/information on the screen to the user. So, Kernel is an interface between the user and the hardware and the Shell is an interface between the user and the Kernel. The shell can be used for opening a file, writing into the files, executing programs, etc. There are 3 types of shells in the Unix Operating system.
- Bourne Shell (sh): It is the most widely available shell on Unix OS devices across the world. This was the first shell available in the Unix OS. It is simply called a shell.
- C Shell (csh): The University of California (Berkeley) developed C Shell is another Unix shell that removes some of the obsolete features or problems from the Bourne Shell. So, it enhances the performance of the Bourne Shell.
- Korn Shell (ksh): The name of the Korn Shell is based on its creator, David Korn. This shell enhances the C shell further by removing the shortcomings of the C shell and also enhancing the user interaction of the Bourne Shell.
Applications/Application Programs: The last layer of the Unix architecture is the Application Program layer. As the name suggests, this outermost layer of Unix Architecture is responsible for executing the application programs.
Types of Unix
- IBM AIX
Now that we have understood the complete architecture of Unix OS, let us understand some of the advantages of Unix OS.
Advantages of Unix OS
- Less Memory Usage: The kernel is responsible for process management and it manages the processes in such an efficient manner that Unix programs use less memory while running.
- Safe and Secure: The kernel is an interface between the user and the hardware and the Shell is an interface between the user and the kernel. So, there is no way a user can interact directly with the hardware or the kernel. Hence, Unix is highly secure. Also, Unix and Unix-based OS are considered safe from viruses. Hence, there is no need to install any external anti-virus software in Unix OS.
- Portable: Unix is portable. This means that Unix can be installed on any computer or laptop. This is because it is developed using C language and C language is a high-performing and highly portable programming language.
- Multitasking and Multiuser: We have talked about this feature of Unix OS and it is very important in today’s world where time is everything and the OS executing multiple programs saves time. However, we have discussed the concept of context-switching using which this illusion of multitasking and multiuser is created.
So, these were some of the advantages of the Unix OS.
We hope that you have understood the Unix Architecture in-depth and have understood the features and advantages of Unix OS as well. It is very important to know the architecture of UNIX OS in-depth if you are a programmer as it is the most programmer-friendly OS. So, with this, we conclude our discussion on Unix Architecture. We hope to see you again at InterviewBit.