There are two important divisions in UNIX operating system architecture.
In simple words you can say –
- Kernal – interacts with the machine’s hardware
- Shell – interacts with the user
The kernel of UNIX is the hub (or core) of the UNIX operating system. Kernel is a set of routines mostly written in C language.
User programs that need to access the hardware (like hard disk or terminal) use the services of the Kernel, which performs the job on the user’s behalf.
User interacts with the Kernal by using System calls. Kernel allocates memory and time to programs and handles the file store and communications in response to system calls.
As an illustration of the way that the unix shell and the kernel work together, suppose a user types mv myfile myfile1 (which has the effect of renaming the file myfile). The unix shell searches the file store for the file containing the program mv, and then requests the kernel, through system calls, to execute the program mv on myfile. When the process mv myfile has finished running, the unix shell then returns the UNIX prompt to the user, indicating that it is waiting for further commands.
Some other functions performed by the kernel in unix system are:
- Managing the machine’s memory and allocating it to each process and decides their priorities.
- Scheduling the work done by the CPU so that the work of each user is carried out as efficiently as is possible.
- Organizing the transfer of data from one part of the machine to another.
- Accepting instructions from the unix shell and carrying them out.
- Enforcing the access permissions that are in force on the file system
The kernel has to do a lot of this work even if no user program is running. It is often called the operating system – a program’s gateway to the computer’s resources.
UNIX Shell acts as a medium between the user and the kernel in unix system. When a user logs in, the login program checks the username and password and then starts another program called the shell.
Computers don’t have any inherent capability of translating commands into action. This requires a command line interpreter (CLI) and this is handled by the “Outer Part” of the operating system i.e. Shell. It interprets the commands the user types in and arranges for them to be carried out.
The commands are themselves programs: when they terminate, the shell gives the user another prompt (% on our systems).
In every unix system, the user can customize his own shell, and users can use different shells on the same machine.
The shell keeps a list of the commands you have typed in. If you need to repeat a command, use the cursor keys to scroll up and down the list or type history for a list of previous commands.
You can use any one of these unix shells if they are available on your system. And you can switch between the different unix shells once you have found out if they are available.
- TC shell (tcsh)
- Korn shell (ksh)
- Bourne Again SHell (bash)
- Bourne shell (sh)
- C shell (csh)
When you enter a command through the keyboard (Input), the unix shell thoroughly examines the input for special characters. If it finds any special characters it rebuilds a simplified command line, and finally communicates with the Kernel to verify that the command is executed.