Knowledge

How OSs work in General

The basic job of an operating system

An operating system, or OS, is the basic software that lets people use a computer and run applications. When you save a document, the OS helps the application write it to storage. When several applications need the processor, the OS shares processor time among them. It also manages memory, devices, files, and networks so each application does not have to control the hardware by itself.

Think of turning on a computer and opening a program. Several layers start in order before the program is ready. The first layer is firmware, small startup software built into the computer. On a modern PC, UEFI firmware initializes enough hardware to continue booting and selects a boot entry. That entry commonly points to an EFI application, such as an operating-system loader on the EFI System Partition. Older PCs may use BIOS firmware and a different startup path.

From power button to applications

The loader finds and starts the kernel, the central part of the OS. It may pass startup settings and an initial RAM file system, a small temporary file system used while the kernel starts. The kernel discovers hardware, starts available device drivers, mounts the main file system, and starts the first user-space process. A service manager such as systemd often runs first on Linux distributions; it starts other services and the login environment according to the computer's configuration.

Firmware, loader, kernel, and desktop are separate parts of startup. A computer can run without a graphical interface. A desktop environment is a set of user-space applications; it is not part of the kernel. A service is a background program that provides a function such as networking or printing.

The kernel and applications

The kernel has privileges that ordinary applications do not. It schedules runnable threads, manages virtual memory, handles system calls, and controls access to files and devices. Applications run in user space, where direct hardware access is restricted. A system call is a request an application makes to the kernel. For example, when a program opens a file, the kernel checks the request and returns the file or an error.

Device drivers handle communication with hardware. Their placement depends on the OS: many Linux drivers run in kernel space, while Windows also supports drivers that run in user mode. A driver talks to a device; an interface helps a person or program use the computer. Window systems, command shells, and accessibility tools are user-space software.

Windows, macOS, Linux distributions, and Android differ in design, licensing, hardware support, interfaces, and bundled software. Linux is a kernel. A Linux distribution combines that kernel with libraries, services, package management, and applications.

Check a few Linux layers

On Linux, uname -a prints kernel and machine information, ps -p 1 -o comm= shows the name of process 1, and cat /proc/cmdline prints the command line passed to the kernel at startup. These commands reveal only a few details, but each points to a different layer. Other operating systems use different names and startup designs; check their documentation for the boot sequence, kernel and user-mode boundary, and process or driver model.

Interactive exercises

Materials

Check yourself
Q:

How OS manages to run multiple application simultaneously?

Q:

What is the main goals of OS?

Q:

Do you need OS to start a program?

Do you know that ...?
- Many OSs can "trick" programs into using memory scattered around the hard disk and RAM as if it is one continuous chunk of memory, called virtual memory.
- Normally every thread is executed during 20ms

Hence, only about 50 threads could execute during a second, while many processes contains hundreds of threads. To manage this chaos, OS provides priority level to all programs and ensures that every program has some execution time

- There are more than a hundred of different OSs

*nix-based family, mobile OSs, Windows of all kinds, OSs for embded devices, OSs for specific devices, etc

Skillsets
Skillset Linux administrator preview
image descriptionLinux administrator
by Infinite Education
3080 users
Skillset Junior C# Programmer preview
image descriptionJunior C# Programmer
by Infinite Education
2827 users
Skillset Web Backend Developer preview
image descriptionWeb Backend Developer
by Infinite Education
2092 users
Skillset Linux for backend developer preview
image descriptionLinux for backend developer
by Artem Naumenko (fb)
16 users
Skillset ASP.NET Core Developer preview
image descriptionASP.NET Core Developer
by balonich
14 users
Skillset Rod c# preview
image descriptionRod c#
by Andressa Neves
3 users
Skillset Skyeng linux system administrator preview
image descriptionSkyeng linux system administrator
by Vitaliy Okulov
3 users