Operating System - silverlain/IT-0-Machines GitHub Wiki

[August 2016] Kernel

AKA nucleus, is a computer program that constitutes the central core of a computer's OS. It has complete control over everything that occurs in the system. As such, it is the first program loaded on startup, and then manages the remainder of startup, as well as input/output requests from software, translating them into data processing instructions for the CPU. It is also responsible for managing memory, and for managing and communicating with computing peripherals like printers and speakers. The critical code of the kernel is usually loaded into a protected area of memory which prevents it from being overwritten by other parts of the OS or by applications. The kernel performs its tasks in kernel space, whereas everything a user normally does (such as writing text in a text editor or running programs in a GUI) is done in user space. This prevents user data and kernel data from interfering with each other and diminishing performance or impacting stability. When a process makes requests of the kernel, the request is called a system call. Various kernel designs differ in how they manage system calls and resources (ex. monolithic kernels executes all OS instructions in same address space to improve performance, while microkernels run OS background processes in user space to make the OS more modular and easier to maintain).

[August 2016] Process

An instance of a computer program being executed, containing the program code and its current activity. Depending on the OS, may be made up of multiple threads of execution that execute instructions concurrently. A program is a passive collection of instructions, while a process is the actual execution of those instructions. Several processes may be associated with the same program - for example, opening up several instances of the same program often means more than one process is being executed. Multitasking allows multiple processes to share processors (CPUs) and other system resources, with each processor switching between tasks that are being executed without having to wait for each task to finish.

[August 2016] Thread

The smallest sequence of programmed instructions that can be managed independently by a scheduler, which is typically part of the operating system. A thread is in most cases a component of a process. Multiple threads can exist within one process and execute concurrently while sharing resources such as memory, while different processes are typically independent and don't share these resources. The threads of a process share its executable code and the values of its variables at any given time. Processes have separate address spaces, whereas threads share their address space. Context switching between threads in the same process is typically faster than context switching between processes. Scheduling of threads by the OS can be done at the kernel level or user level, and either preemptively or cooperatively, with preemptive considered the superior approach as it allows the OS to determine when a context switch should occur (with the disadvantage that the system may make a context switch at an inappropriate time).