Chapter:Chapter 02 – Inside OS/2 Warp
Subsection: 01. Base Operating System Architecture
Topic: The OS/2 Kernel
Date Composed: 11-14-98 10:08:30 PM Date Modified: 11-15-98 06:17:07 PM
The kernel of any operating system provides the core functions for that operating system. It is the part of the operating system that performs basic functions such as allocating hardware resources like memory and CPU time. The OS/2 kernel functions reside in the OS2KRNL executable file which is loaded during boot. 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.
During the boot process, the kernel is also responsible for loading and processing the CONFIG.SYS file.
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.
Over the years, as new versions of OS/2 have appeared, the kernel of the operating system has changed. Most of these changes have been relatively minor to incorporate support for new features or functions.
The primary changes in the OS/2 kernel have been for Symmetric MultiProcessing (SMP). All versions of Warp including Warp 3, Warp Connect, and Warp 4, have a uniprocessor kernel. Warp Server has a uniprocessor kernel. Warp Server SMP has an SMP kernel. Warp Server for e-business is shipped with both the uniprocessor and the SMP kernel. When installing Warp Server for e-business, you can select whether to install the uniprocessor or the SMP kernel.
Recommendation: When installing Warp Server for e-business, it is a valid choice to install the SMP kernel on a uniprocessor computer. Because the uniprocessor kernel is somewhat faster on a uniprocessor system than the SMP kernel is, I recommend installing the uniprocessor kernel on a uniprocessor system.