Linux+: Operating System Intro 04 – Linux Kernel As I had covered in the article Linux+: Operating System Intro 02 – UNIX Foundation, the basics of a kernel were covered. Now, we can go into the Linux kernel in more detail. The kernel is the part of an Operating System (OS) which arbitrates between the user and the hardware. The kernel manages the memory, processes, files, networking, etc. The kernel is the part of the OS which is loaded into memory and manages everything. The Linux kernel has version numbers which are in a specific format: major.minor.patch When a major revision was made, the major number was incremented by one. If a minor revision was made, the minor number was incremented by one. Small bug fixes were noted as patches and would increment the patch number by one. If the minor number is even, then the release is considered to be stable. If the minor number is odd then it is a version for developers and considered not stable. This is only true for versions before version 3. NOTE: Stable versions are less prone for crashes and problems. The stable versions should be used in standard use. Unstable versions are for developers to be able to find and fix errors and crashes. The unstable versions are usually the versions which have new features that are being developed so they will be stable by the next “even” minor version. In 1994, the Linux 1.0 kernel was released. In 1995, the Linux kernel 1.2 was released. Version 1.2 supported the PCI bus, networks which were not TCP/IP, and firewall ability from the kernel. Linux kernel version 1.2 had also been ported, or compiled, for the Sun SPARC, SGI MIPS and even the Digital Equipment Corporation (DEC) Alpha system. The Linux 2.0 kernel was released in 1996. This version brought support for Symmetric Multiprocessing (SMP). SMP is the ability of the kernel to support more than one processor at a time in a system. The new kernel supported various systems as follows: X86 SPARC MIPS Alpha PowerPC Motorola 68000 Version 2.2 was released in 1999. The new version supported the 64-bit platform and had a significant performance increase. In 2001, Linux kernel version 2.4 came out. The kernel had been ported for the IA-64 systems and the IBM S/390 mainframe. The maximum capability of supported Random Access Memory (RAM) was 64 GB as well as support for SMP which allowed for 32 processors on x86 systems. Hardware support for Firewire and USB was included in the kernel as well. To find the latest version of the Linux kernel go to www.kernel.org. There are four types of categories given for kernel releases: Prepatch – these releases, or release candidates (rc), have new features that are not completely tested and may have glitches Mainline – introduces new features are released every 2-3 months Stable – these releases are considered stable, occur after a mainline release and may include patches Longterm – not updated often and are considered very stable With patches and other items to update in the kernel, such as drivers, there are loadable modules. A loadable module is not part of the kernel, but is loaded into the kernel when the kernel is loaded. The modules can then be removed, changed and added as needed. Instead of recompiling a kernel to add a new driver it is easier to compile the driver into a loadable module and include it to be loaded. There are many things which the kernel controls on a system. For the user, their main focus is the programs they need to use to perform their required tasks. The jargon for these various control features for programs is as follows: Processes Thread Virtual Memory Processes are the programs running on a system. A process can be a word processor, spreadsheet, database, etc. Each process requires resources such as Central Processor Unit (CPU) time, RAM and Hard Disk Drive (HDD) space. The kernel can manage all of these as needed. NOTE: The kernel can provide the needed resources as long as they are available. If drive space is required, but the hard disk is full, then the kernel cannot fulfill the required resources to the process. The process may fail if not programmed to handle errors properly. Threads are sets of instructions which are executed separately. Certain parts of a process can use one thread while another part can use another thread. As a result multiple portions of the code can be performed simultaneously so certain results are ready for another thread of code. Linux allows for multiple threads (multithreading). An example of a thread is a spreadsheet which has formulas within cells. When a specific cell is updated, the formula must be reapplied to make the changes appropriate. A second thread is used to make these changes. If a second thread were not used, the spreadsheet would pause and not allow the user to make any more changes until the formulas had all been checked and processed. Virtual Memory is when processes in RAM are copied to the HDD to free up RAM for other processes. The system may slow when data is being swapped from or to the RAM. Processes which are running but not being used can be moved to the HDD. When the process is interacted with by the user, it is moved back to RAM. Virtual Memory allows for a limited amount of RAM to support more processes than it normally could without Virtual Memory. NOTE: The Virtual Memory is sometimes referred to as the Swap File. The Linux Swap File is the Swap Partition.