What’s in an Operating System?
An operating system is the middle layer of a basic computer stack, connecting application software to hardware. It performs many functions, including setting standards for applications to “talk to” the operating system.
For example, an application program may access a connected storage device by sending a call to the operating system, which converts it into commands specific to the device.
Kernel
The kernel is the most important component of an operating system. It controls internal processes and delivers hardware permissions to software applications. It also manages memory and input-output devices. The Kernel is also responsible for managing disk space.
The Kernel operates in privileged mode, meaning it can access the computer’s hardware and control its resources. However, it cannot access the user processes.
A computer can spawn dozens and even hundreds of processes simultaneously. However, each process can only access limited hardware resources such as CPU and physical memory pages. The kernel arbitrates which processes can use these limited resources and how much time each process has to do so. It can also prevent hardware from being damaged by malware or other unauthorized software programs.
Processor
The processor is a simple chip that performs the basic input-processing operations that enable a computer to operate. It is found in many electronic devices including computers, laptops and smartphones. It interprets instructions and processes them to provide the output that a user will interface with. It is made up of the Arithmetic Logic Unit (ALU), Control Unit, and registers.
The ALU performs arithmetic and logic functions with integer numbers, while the FPU manipulates floating-point numbers. It also contains a set of flags that can be used to indicate the results of certain operations.
When an instruction is read by the CPU, it goes through a decode step. This process converts the binary code into signals that control other parts of the processor. In addition to this, some instructions manipulate the program counter or modify bits in a flags register.
Memory
The operating system manages memory in order to support multiple processes. It uses paging to reduce the number of times a process must be read from disk and to prevent the operating system from running out of memory. Paging works by dividing memory into partitions that hold different types of programs. Each partition has a corresponding frame in physical memory. The OS then maps the logical address of each frame to a physical address using a page table.
A good page replacement algorithm is important because it determines which pages to evict from primary memory and which ones to bring in from secondary memory. This helps to minimize thrashing and improve performance. Other techniques for managing memory include stealing and reclaiming pages that are not used.
File system
A file system presents the contents of the operating system into a format that computer programs that interact with files can use. It also manages metadata for the files. It may be able to create, list, copy and move files, as well as alter their metadata.
It can store the length of a file’s contents in its metadata and identify free space on a storage device. It can also provide information about a file’s size, position and hierarchy in its directory.
File systems are based on a hierarchical structure of directories and subdirectories, which makes it easier for users to find files and folders. They can also support features like compression and encryption, and ensure that files are accessed in the correct order to prevent data corruption.
Firmware
Firmware is the low-level software that runs on a piece of hardware. It performs essential functions like turning screens on, starting up the device, and recognizing components like cameras and speakers. It’s also stored on a nonvolatile memory chip, protecting it from accidental deletion or damage.
In many computers, the BIOS (Basic Input/Output System) or UEFI firmware is responsible for initializing hardware before the operating system loads. Firmware is also present in smartphones, digital cameras, and even remote controls.
While firmware isn’t as visible to average users, it’s an important part of all the electronic devices we use. Unfortunately, hackers are always looking for new ways to exploit the firmware of these devices. They can deactivate core security features, brick systems, and steal sensitive information.