Chapter:Chapter 01 – What is an Operating System and Why is it Important?
Subsection: 04. Introduction to Operating Systems
Topic: Operating System Features
Date Composed: 12-28-96 06:10:13 PM Date Modified: 01-04-97 03:22:00 PM
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. Warp’s kernel is the file OS2KRNL. Note that the file name has no extension.
The OS/2 kernel performs the following basic functions.
- 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 SWAPPER.DAT file and the movement of memory pages between RAM and the swapper file on the hard drive.
- Task management. The OS/2 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 OS/2 kernel will also preempt a lower priority task when a task with a higher priority becomes unblocked and capable of running.
- 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 OS/2 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.
Semaphores can be used to coordinate the activity of two programs or two separate threads within a single program. When one task sets the semaphore, for example, the other task cannot proceed until the first has reset the semaphore.
- 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 OS/2 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 such as HyperAccess Lite, the OS/2 kernel detects that the COM port is already in use. The kernel then uses the hardware error handler (HARDERR.EXE) to display a message on the screen that the COM port is in use.
- I/O Management.The kernel is also responsible for managing I/O devices. This includes 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 FAT, 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 dynamic link libraries such as DOSCALL1.DLL. The command processor, CMD.EXE is also part of the kernel. Some basic command line commands are also included in the kernel as part of the file CMD.EXE. The commands are called Internal commands because they are a part of the kernel. The COPY and DEL commands are examples of internal commands.
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 external commands such as XCOPY, FDISK, FORMAT, DISKCOPY, 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 external tools.