`

What is OS?

An Operating System (OS) is a system software that manages computer hardware and software resources, providing common services for computer programs. It acts as an intermediary between users and hardware, enabling users to interact with the system and applications to access hardware resources.

Key Roles of OS

Types of OS

OS Components

OS Components

Kernel

Core of OS, manages hardware and system resources. Operates in a privileged mode, Kernel Mode, providing direct access to hardware, while most user appliations run in User Mode(restriced).

Privilege Bit

Types of Kernels

Kernel Architecture

The kernel’s architecture defines how the kernel is structured and how it interacts with the hardware and software components of the system.

Kernel Space vs User Space

Memory where kernel operates with unrestricted access to the system is called Kernel Space. Memory allocated for running user applications, isolated from kernel space to prevent interference is called User Space.

Kernel Data Structures

System Calls

Interface between user space and kernel space. User applications request services from the kernel through system calls. Examples: fork(), read(), write(), close().

Shell

A command-line interpreter in an OS, allowing users to interacts with the system through the Kernel. It accepts user commands, interprets them, and communicates with the kernel to execute them, and display the output.

A shell can be interactive or non-interactive. Interactive shells accept commands from the user, while non-interactive shells execute commands from a script file.

Types of Shells

Shell features

Shell Scripting

Used to automate tasks and write programs. Scripts are written in a shell language like bash, and can be executed using the shell interpreter.

Shell scripts start with a shebang line #!/bin/bash that specifies the path to the shell interpreter. Scripts can be made executable using the chmod +x script.sh command.

We can make variable, loops, conditions, functions, and more in shell scripts.

Key Components of OS