OS/2 Kernel

From EDM2
Jump to: navigation, search

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.

OS/2 Warp uses a hybrid kernel, it tries to combine the benefits of microkernel and monolithic kernel architectures.

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.



The files that compose the OS/2 kernel are:

File Name Comments Alternatives
OS2KRNL OS/2 Kernel OS/4 Project
OS2LDR OS/2 Loader Freeware Versions
SCREEN01.SYS Screen device driver for family 1 machines (non-MCA). Called by OS2LDR.
SCREEN02.SYS Screen device driver for family 2 machines (MCA). Called by OS2LDR.
PRINT01.SYS Print device driver from family 1 machines (non-MCA) Freeware Versions
PRINT02.SYS Print device driver from family 2 machines (MCA)
KBDBASE.SYS Keyboard base device driver. Freeware Versions
CLOCK01.SYS Clock device driver for family 1 machines (NON-MCA. Called by OS2KRNL. Freeware Versions
CLOCK02.SYS Clock device driver for family 2 machines (MCA). Called by OS2KRNL.
RESOURCE.SYS Resource Management Driver. Called by OS2KRNL.
UNICODE.SYS Unicode driver. Called by OS2KRNL.



  • Some of the OS/2 kernel Drivers source code are available on the IBM DDK under a non open source friendly license, but freeware versions of this drivers can be produced.
  • OS/4 Project is working on a clone version of the OS2KRNL file.