What is difference between monolithic and micro kernel? Essay
Sorry, but copying text is forbidden on this website!
The purpose of this report is to compare the most recent kernels used by Windows and Linux investigating the following aspects: file system, memory management, device management, security, and reliability. The kernel is the most important part of any operating system and has complete control of the computer systems e.g. application execution, memory and device management etc. It acts as a bridge between the application software and the hardware translating input/output requests into data processing instructions for the CPU.
The kernel is the first thing to load during the boot process and is always running throughout the duration of a computer session because its services are constantly required.
There are three main types of kernel OS architectures; monolithic kernel, microkernel and hybrid kernel. Monolithic kernels house all the system services (such as device drivers, file system & application IPC) inside the working kernel space and are typically used by the Linux OS. Microkernels isolate system services into the user space to keep the kernel as small as possible, containing only basic code to communicate between the hardware and operating system and are typically used by Mac OS X. Hybrid kernels is the combination of the benefits from monolithic kernels and microkernels. The file system and UNIX server remain in the user space whereas the Application IPC and device drivers operate in kernel space (see figure 1-1 below). The Hybrid kernel architecture is typically used by Windows.
(Figure 1-1; Diagram of the three main kernel architectures – Revolver 2017)
Currently, the Windows NT 10.0 kernel and Linux 4.0 kernel are the most recent kernels being used today, with Windows NT using a hybrid kernel architecture and Linux using a monolithic kernel architecture. Both of these kernels have been redeveloped for use in mobile operating systems. Linux uses a modified version of the 4.0 kernel in several mobile devices most notably all portable android based devices. The Windows NT kernels have been used in the Windows phone since the Windows 8 Phone replacing the older CE-based architecture. However, according to an article published in the Telegraph “Microsoft is finally killing off the Windows Phone operating system after 17 years”.
The purpose of the file system is to provide programs with a logical way of storing and retrieving data. A file system is basically a large index or database containing the location of every file on the hard disk or storage device. Data is organized into folders called directories with each directory containing multiple files and folders. Files on a storage system are sorted into sectors and these sectors are grouped into blocks to help optimize storage space.
Resilient File System (ReFS) is the new proprietary file system used by the Windows NT 10.0 kernel superseding the previous New Technology File System (NTFS). This file system uses an on-disk structure to store the files using a B+ tree. A B+ tree is a structure for storing and retrieving data, whereby the data is stored in a tree-like structure and each node contains a list of pointers to the lower level nodes in the tree. The tree provides a fixed number of items in a node (block). The main disadvantage of this system is that there is wasted space in the storage blocks as each node is never actually completely full as they must allow for extra data insertion later on. If the node is already “full” it is split into two nodes, distributing the keys evenly between the two nodes so the nodes are never actually completely full.
Linux has many different file systems and they are able to coexist with many operating systems. Linux currently supports 15 file systems all following the same structure. The most popular choice for the Linux file system is the ext (Extended File) family (ext2, ext3, and ext4). The Linux 4.0 kernel uses the ext4 file system which follows a hierarchal structure. At the top is a directory called the /root where every single file and directory starts. The root directory has a minimum 16 subdirectories each with a unique purpose. For example, the /boot directory has all the bootloader files, /tmp directory has all the temporary files and the /home directory stores all the user files. The benefits of the ext4 file systems used in the latest Linux kernel is its support for larger file sizes (up to 16 terabytes) and the availability to have 64,000 subdirectories. Linux splits applications across multiple locations so, for example, all the binary executable files are placed in /bin and all the configuration files are stored in /etc. This is can be good because if any of the files are corrupted they are isolated to one location, however, trying to find the problem can be more difficult as opposed to Windows where the application is stored in one directory.
The kernel is responsible for managing the computers primary memory (RAM) involving the allocation and reallocation of memory blocks based on user requirements. There are several techniques a kernel can use to manage its memory; single allocation, partitioned allocation, paging and virtual memory. Single allocation is the simplest form of memory management. All the computer’s memory (apart from the part reserved for the OS) is allocated to the single application. Partitioned allocation breaks the primary memory into separate contiguous partitions allowing for multiple applications to be run simultaneously. Paging is the process of dividing the memory space into pages of the equal size. Sometimes a contiguous space might not be available to an application process can then be separated into pages which can then be placed anywhere in the main memory without the need for a contiguous space.
Virtual memory comes into play when there is no longer enough physical memory in the RAM to run another process. When a computer runs out of RAM it will start moving the pages (or swap files) to the hard disk using this as virtual memory. An operating system will make a set of virtual addresses available to be used by a process when this occurs.
The kernel space in the Windows 10.0 architecture includes a Page Table Entry, Paged Pool, System Cache and a Non-Paged Pool. A Page Entry Table maps virtual addresses to physical addresses, a Paged Pool contains virtual memory that can be paged in and out, the System Cache retains recently used data for quick access and a Non-Paged Pool contains the virtual memory that is guaranteed to reside in the physical memory. Memory address space is shared equally between the kernel space and user space. The kernel address space is shared to all processes and each process has its own space in the user address space. This kernel also uses a process called demand paging. Basically, pages are evicted to the hard disk when memory is full and are only brought into the memory as and when they are required or recalled. Demand paging also only loads code in the RAM that is required to run the process and the rest is stored in the virtual memory until they are required. The Windows kernel uses a first in, first out (FIFO) page replacement algorithm to decide which pages to discard or swap when the memory is full.
Linux 4.0 kernel uses a variety of memory management techniques some of which are similar to Windows NT kernel. Linux utilizes demand paging, same as the Windows kernel, however, the page replacement algorithm is different in that it uses least recently used (LRU). This algorithm involves with every page having an age which changes every time the page is accessed. The more a page is accessed the younger it is. Old pages are the first to get swapped if the memory is full. Another way the Linux kernel manages its memory is to not duplicate the same code for multiple programs. If multiple instances of a program are being used only one copy of the code will be in the main memory at any one time.
Peripherals on a computer such as a keyboard, mouse, monitor etc. are controlled by the kernel through device drivers. Device drivers are computer programs that allow the operating system to communicate with the hardware devices. Security:
David A Rusling. (1999). The Linux Kernel. Available: http://www.tldp.org/LDP/tlk/fs/filesystem.html. Last accessed 07th Dec 2017.
D.A. Solomon. (1998). The Windows NT kernel architecture. Expert Seminars. 10, p40-47.
Jerry Hildenbrand. (2012). Linux for Mobile Devices. Available: https://www.androidcentral.com/android-z-what-kernel. Last accessed 05th Dec 2017.
Matthew Field. (2017). Microsoft is finally killing off the Windows Phone. Available: http://www.telegraph.co.uk/technology/2017/10/09/microsoft-finally-killing-windows-phone/. Last accessed 05th Dec 2017.
Matt Welsh (1996). Running Linux. 3rd ed. Sebastopol: O’Reilly.
Microsoft. (2017). Kernel-Mode Driver Architecture Design Guide.Available: https://docs.microsoft.com/en-us/windows-hardware/drivers/opbuildpdf/kernel/TOC.pdf?branch=live. Last accessed 07th Dec 2017.
Microsoft. (2017). Memory Management. Available: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366779(v=vs.85).aspx. Last accessed 08th Dec 2017.
Revolvy. (2017). Hybrid Kernel. Available: https://www.revolvy.com/main/index.php?s=Hybrid%20kernel&item_type=topic. Last accessed 5th Dec 2017.
Ravi. (2006). Monolithic kernel vs Microkernel. Available: http://www.aboutlinux.info/2006/05/monolithic-kernel-vs-microkernel-which.html. Last accessed 5th Dec 2017.
TechTerms. (2015). Microkernel. Available: https://techterms.com/definition/microkernel. Last accessed 5th Dec 2017.
Tim Fisher. (2017). What is File System? Available:
https://www.lifewire.com/ntfs-file-system-2625948. Last accessed 21st March 2017.
The Linux Information Project. (2004). Kernel Definition. Available: http://www.linfo.org/kernel.html. Last accessed 30th Nov 2017.