ROLE OF THE KERNEL The Kernel The core of your operating system. The kernel is the core of your operating system. It manages the communication between hardware & software. The operating system has other parts built on top of the Kernel. • Graphical user interface • Networking • System utilities The kernel has several specific roles in ensuring your computer functions. Program Execution The kernel is responsible for executing processes. It controls the passing of instructions to the CPU. It ensures that each program gets enough processing time. It will terminate processes where required. Interrupts The kernel handles interrupts. An interrupt is an event that occurs outside of the currently executing program. • e.g. when you click on the mouse or press a key So a device using this type of operating system can only do one thing at a time. The kernel informs the CPU of the event so that it can handle it. The kernel also ensures the state of the current process is stored to be returned to. Modes The kernel controls switch the CPU between modes. The CPU can switch between two modes. • Kernel Mode - The CPU will have unrestricted access to the hardware. Certain instructions can only run in kernel mode. • User Mode - the CPU cannot directly access hardware. The CPU is in user mode when it is running applications. The kernel will control switching the CPU between kernel and user modes. This stops applications from damaging our operating system. It also ensures application crashes don’t crash our entire system. Memory Management The kernel assigns memory to each open application in order to allow them to run. Running applications must be loaded into main memory from disk. The kernel will allocate a portion of memory to active applications. It also deallocates memory when the application is no longer in use. It can also use virtual memory to extend memory when the RAM is used up. Multi-Tasking The kernel will manage which application gets processing time. Every application you have running needs to be assigned some processing time. Processors only perform a single task at a time though. The kernel will assign small amounts of the processor time to each application. This makes it appear as if they’re running simultaneously. Disk Access The kernel handles all data i/o to peripherals including to the disk drives. It will manage all the saving and loading of data to and from the disk. We can only read/write data one piece at a time to/from the disk. The kernel will manage this, creating a queue for disk access and managing priorities. It can then pass the data between the disk and memory as required. File Systems The kernel will implement file systems that will control how data is stored and retrieved. File systems structure data into files and folders to structure this data. Without file systems, all the data in your hard disk would be one unidentifiable mass. Your kernel will usually allow for different file systems to be used, such as: • FAT32 – limited maximum storage capacities but excellent compatibility. • exFAT – much larger capacity than FAT32, still good compatibility (though slightly less than FAT32). • NTFS – massive storage capacity but not great compatibility outside of Windows. Has lots of additional features. Device Drivers The kernel uses device drivers to ensure peripherals can communicate with the computer. Drivers are small software programs that control devices you connect to your PC. • You can think of it as a translator between the peripheral and your computer. Your kernel will have a range of generic drivers to work for most devices. You can also install additional device drivers for other specific devices. Without drivers, most peripherals wouldn’t be compatible with most computer systems.