Linux+: Operating System Intro 02 – UNIX Foundation UNIX is an Operating System (OS) that can be versatile for users. To be flexible, there must be the ability for configuration. To provide the needed functionality, UNIX is made up of three parts: Kernel Configuration files Utility programs (shell) 1. Kernel When a computer is powered on, it checks the Complimentary Metal Oxide Semiconductor (CMOS), which stores the system configuration, for the boot drive. Once the boot drive is determined the boot loader is executed from the drive and the kernel is loaded. The kernel is the program which is the core of the installed OS, in this case UNIX. The kernel contains all the necessary code to mange the hardware devices, memory and the Central Processor Unit (CPU). You can think of the kernel as being the bridge between all the applications (software) and the system (hardware). The software is any application which can be part of the OS such as a text editor, a shell or any utility. The programs pass code to the kernel which can interpret the commands and send them to the processor. The commands can also cause the kernel to allocate memory space or even initialize a device, such as a printer. The hardware portion can consist of scheduling commands through the processor, allocating memory space in the Random Access Memory (RAM) or even enforce file access based on permissions. The kernel also provides a list of System Calls. System Calls are processes which are needed by applications, but should not be managed by the applications. Any request from an application to the kernel is a System Call. For example, applications need to create, modify or delete files. An application can send a System Call to the kernel to delete a file. The kernel makes the request of the hardware, in this case the Hard Disk Drive (HDD), and the file is deleted if the user’s permissions allow it. In the case of UNIX, the kernel is a monolithic kernel. A monolithic kernel is one in which all device drivers are included. One possible drawback is that a faulty driver can crash the whole OS. It can be stated that a monolithic kernel has all necessary code to execute applications and access all devices all within the kernel. NOTE: Monolithic kernels are not portable since the drivers can be different for every system. It may be possible to include numerous drivers, but this can cause the kernel to become quite large. Larger kernels can consume more RAM which cuts down on system resources. When code is updated or added to the kernel, it can be recompiled and the old kernel can be updated to include the new changes and additions. 2. Configuration files By itself, the kernel would make the OS a very strict environment. To help make the OS more flexible you make configuration changes. The configuration files hold the information that makes needed changes to UNIX. These can set changes for the shell program when executed. Configuration files on a UNIX system are sometimes placed in a directory prefixed with a period. The period hides the directory and its contents. An example of a system configuration file is the File Systems Table (fstab) file. The listings within the file determine which HDD are mounted automatically. The fstab also allows parameters to be given for each mount command. 3. Utility programs (shell) Utility programs are included with a UNIX distribution package, but the files are not part of the kernel. Utility programs, when updated, can simply be placed over the older version of the file. As long as a new version of a utility is compatible with the kernel version it should work unless code has been modified in the kernel to cause an issue. When a user logs into a UNIX system they are presented with a shell. The shell is a command-line interpreter that accepts the user input and sends it to the kernel to be managed as a system call. Any results created the command should be presented on the screen to the user, if any should be generated. There are a few common shells which exist for UNIX: Bourne Shell (sh) Bourne Again Shell (bash) C Shell (csh) Korn Shell (ksh) TC Shell (tcsh) Since typing commands can become tedious and errors can occur scripts can be made to reduce typing and errors. A script is a set of commands which may be entered more frequently than others. A script can contain one or more commands. Entering the name of the script will start the script running which will in turn execute each line in the script as a single command. The script will end when the end of the script is reached or a command is listed which will terminate the script.