May 29, 2013    


 

 


Primary Operating System Functions

Any operating system has some core functions which are the primary reason for its existence. These can be referred to as kernel functions because they are built into the kernel of the operating system. The kernel for Linux is the file starting with the name /boot/vmlinuz. For example, a recent version of the Linux kernel, as of this writing, is vmlinuz-3.8.11-200.fc18.x86_64.

The Linux kernel performs the following basic functions.

  1. Memory management. The kernel allocates and deallocates memory and assigns physical memory locations based upon requests, either implicit or explicit, from application programs. In cooperation with the CPU, the kernel also manages access to memory to ensure that programs only access those regions of memory which have been assigned to them. Part of memory management includes managing the swap partition or file and the movement of memory pages between RAM and the swap space on the hard drive.
  2. Task management. The Linux kernel manages the execution of all tasks running on the system. The scheduler portion of the kernel allocates CPU time to each running process based on its priority and whether it is capable of running. A task which is blocked — perhaps it is waiting for data to be delivered from the disk, or for input from the keyboard — does not receive CPU time. The Linux kernel will also preempt a lower priority task when a task with a higher priority becomes unblocked and capable of running.
  3. Interprocess communication. Interprocess communication (IPC) is vital to any multitasking operating system. Many tasks must be synchronized or communicate with each other to ensure that their work is properly coordinated. The kernel manages a number of IPC methods. Shared memory is used when two tasks need to pass data between them. The Linux clipboard is a good example of shared memory. Data which is cut or copied to the clipboard is stored in shared memory. When the stored data is pasted into another application, that application looks for the data in the clipboard’s shared memory area. Named pipes can be used to communicate data between two programs. Data can be pushed into the pipe by one program and the other program can pull the data out of the other end of the pipe. A program may collect data very quickly and push it into the pipe. Another program may take the data out of the other end of the pipe and either display it on the screen or store it to the disk, but it can handle the data at its own rate.
  4. Device management. The kernel manages access to the physical hardware through the use of device drivers. Access to physical devices must be managed carefully or more than one application might attempt to control the same device at the same time. The Linux kernel manages this so that only one program actually has control of or access to a device at any given moment. One example of this is a COM port. Only one program can communicate through a COM port at any given time. If you are using the COM port to get your e-mail from the Internet, for example, and try to start another program which attempts to use the same COM port, the Linux kernel detects that the COM port is already in use. The kernel then uses the hardware error handler to display a message on the screen that the COM port is in use.
  5. I/O Management. The kernel is also responsible for managing I/O devices. This includes USB, parallel and serial port I/O, and file system I/O. The kernel does not actually handle physical access to the disk, but rather manages the requests for disk I/O submitted by the various running programs. It passes these requests on to the file system, whether it be EXT[2,3,4], VFAT, HPFS, CDFS (CD-ROM file system), or NFS (Network file system), and manages the transfer of data between the file system and the requesting programs.

Much of the code for actual implementation of these kernel level functions resides in libraries.

Utilities

In addition to its kernel functions, most operating systems provide a number of basic utility programs which enable users to manage the computer on which the operating system resides. These are the commands such as cp, ls, mv, and so on, as well as the various shells, such as BASH, KSH, CSH and so on, which make managing the computer so much easier.

These utilities are not truly part of the operating system; they are merely provided as useful tools by the packagers of the operating system. In Linux, these are the GNU Utilities.