`
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.
Multi-Tasking OS: Multiprogramming OS with round robin.
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).
Monolithic Kernel: All services are provided in the kernel space. All core servies are integrated. Example: Linux.
Micro Kernel: Only essential services are provided in the kernel space. Other services are provided in the user space. Helps to minimize the Kernel size. Example: QNX and MINIX.
Hybrid Kernel: Combination of Monolithic and Micro Kernel. Example: Windows NT.
Exo Kernel: Exposes the hardware to the application, for perfomance-internsive applications. Example: Exokernel.
The kernel’s architecture defines how the kernel is structured and how it interacts with the hardware and software components of the system.
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.
Interface between user space and kernel space. User applications request services from the kernel through system calls. Examples: fork(), read(), write(), close().
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.
Bourne Shell(sh): The first shell, developed by Stephen Bourne. It is a simple shell with limited features. Known for scripting capabilities and efficiency.
Bourne Again Shell(bash): Developed as an improved version of the Bourne Shell. It is the default shell in most Linux distributions and is backward compatible with the Bourne Shell.
C Shell(csh): It has a C-like syntax and provides features like command history and aliases.
Z Shell(zsh): An extended version of the Bourne Shell with additional features like spelling correction, shared command history, and more.
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.