Linux Kernal
A computer's primary function is to execute a programme, which is a preset set of instructions. A process is a term used to describe a programme that is currently running. Most special purpose computers are now designed to execute a single process, but a sophisticated system like a general purpose computer is designed to run multiple processes at the same time. Any process necessitates hardware resources such as memory, processor time, and storage space, among others.
In a General Purpose Computer that is executing multiple processes at the same time, we require a middle layer to manage the distribution of the computer's hardware resources efficiently and fairly across all of the processes. The kernel is the term for the middle layer. The kernel essentially virtualizes the computer's common hardware resources to provide each process with its own virtual resources. This gives the impression that the process is the only one running on the machine. In addition, the kernel is in charge of preventing and resolving disputes between processes.
The Linux kernel is a Unix-like operating system kernel that is free and open-source, monolithic, modular, and multitasking. Linus Torvalds invented and developed it for his i386-based PC in 1991, and it was quickly accepted as the kernel for the GNU operating system, which was built as a free replacement for UNIX. It has produced a vast variety of operating system distributions, often referred to as Linux, since then.
Linux is used on a wide range of computing platforms, including embedded devices, mobile devices (including Android), personal computers, servers, mainframes, and supercomputers. It can be customised for specific architectures and use cases using a set of simple commands (rather than manually modifying the source code before compilation); privileged users can even fine-tune kernel parameters at runtime. The GNU extensions of GCC to the normal C programming language, as well as architecture-specific instructions, are used to write the majority of the Linux kernel code (ISA). This results in a highly optimised executable (vmlinux) in terms of memory use and task execution times.
The Linux kernel mailing list is where day-to-day development conversations take place (LKML). The version control system git, which Torvalds designed as a custom substitute for BitKeeper, is used to track changes. Linux is published under the GNU General Public License version 2 (GPL-2.0-only) with an explicit syscall exception (Linux-syscall-note), but it also includes files that are licenced under other comparable licences.
Architecture and features
Linux is a monolithic kernel with a modular design (it can insert and remove loadable kernel modules at runtime, for example), and it supports most capabilities that were previously only available in closed source kernels of non-free operating systems. On the official manual pages, the UNIX and Unix-like operating systems convention is used throughout the rest of the text. The numbers after the names of commands, interfaces, and other features indicate the section (i.e., the sort of OS component or feature) to which they belong (for example, execve(2) refers to a system call, while exec(3) refers to a userspace library wrapper).
The following list and sections provide a non-exhaustive overview of Linux architectural design as well as some of its most notable features.
- On SMP and NUMA architectures, concurrent computing and even real parallel execution of numerous processes at once (each with one or more threads of execution) is possible (if there are enough CPU cores for ready-to-run jobs).
- Before commencing compilation, select and configure hundreds of kernel features and drivers (using one of the make
*config
family of commands).fine-tuning kernel behaviour at run-time (using the sysctl(8) interface to /proc/sys/) and manipulation of kernel settings before booting (typically by inserting instructions within the lines of the GRUB2 menu). - Configuration (again, using the make
*config
commands) and run-time modifications of the policies of the task schedulers that allow preemptive multitasking (both in user mode and, since the 2.6 series, in kernel mode) via nice(2), setpriority(2), and the family ofsched syscalls
; the Completely Fair Scheduler (CFS) has been the default scheduler of Linux since 2007, and it uses a red-black tree that can search, and insert. - With paged virtual memory, you may control your memory in a more advanced way.
- Mechanism for inter-process communication and synchronisation.
Development
Developer community
The Linux kernel developer community has around 5000โ6000 members. According to the Linux Foundation's "2017 State of Linux Kernel Development," which included commits for releases 4.8 to 4.13, roughly 1500 developers contributed from about 200-250 firms on average. A little more than 16% of the code was contributed by the top 30 developers. Intel (13.1 percent) and Red Hat (7.2 percent), Linaro (5.6 percent), IBM (4.1 percent), and the 'none' (8.2 percent) and 'unknown' (4.1 percent) categories are the top donors in terms of companies.
Source code management
Git is a source code management system used by the Linux development community. Git users use git-clone
to clone the newest version of Torvalds' tree and git-pull
to
maintain it up to date. Contributions are sent in the form of patches, which are text messages on the LKML (and often also on other mailing lists dedicated to particular
subsystems). The patches must follow a set of criteria and use a formal language to indicate, among other things, which lines of code should be removed and which should
be added to the given files. These patches can be processed automatically so that system administrators can apply them to make only minor modifications to the code or to
upgrade to the next version in stages. Linux is distributed also in GNU zip (gzip) and bzip2 formats.
Submitting code to the kernel
A developer who wishes to make a modification to the Linux kernel must first create and test the change. The modification will be provided as a single patch or as numerous patches of source code, depending on how big the change is and how many subsystems it affects. These changes are submitted as e-mails to the subsystem's maintainer, with the relevant mailing list in Cc, if the subsystem is maintained by a single maintainer. The mailing list's maintainer and readers will review the patches and provide feedback. The subsystem maintainer accepts the patches in the relevant Git kernel tree once the review process is completed. If the changes to the Linux kernel are regarded essential enough, Torvalds will get a pull request for the patches within a few days. Otherwise, at the next merging window, a pull request will be forwarded to Torvalds. The merge window normally lasts two weeks and begins right after the previous kernel version is released. The Credits directory in the Git kernel source tree lists all developers who have contributed to the Linux kernel, and the Maintainers directory lists all subsystem maintainers.
Programming language and coding style
Linux is written in a customised C programming language that is supported by GCC, a compiler that extends the C standard in many ways, including the use of inline chunks of code written in the target architecture's assembly language (in GCC's "AT&T-style" syntax). Since 2002, all code must follow the Linux Kernel Coding Style, which consists of 21 guidelines.
GNU toolchain
The GNU Compiler Collection (GCC or GNU cc) is the default compiler for the mainline Linux sources and it is invoked by a utility called make. Then, the GNU Assembler (more often called GAS or GNU as) outputs the object files from the GCC generated assembly code. Finally, the GNU Linker (GNU ld) is used to produce a statically linked executable kernel file called vmlinux. Both as and ld are part of GNU Binary Utilities (binutils). The above-mentioned tools are collectively known as the GNU toolchain.