“Operating System” Chapters to Read
Operating system
An operating system is software that manages the computer’s hardware and software resources and provides services for application programs.
Kernel vs kernel space
Kernel
- The kernel is the core part of an operating system.
- It is the software component that manages hardware resources (cpu, memory, devices)
- It provides services to user programs.
- Tasks : process scheduling, memory management, device control, and system calls.
Kernel space
- Kernel space is the protected memory area where the kernel code executes.
- User applications cannot directly access kernel space for safety and security.
OS structure
- The term “os structure” refers to the organization and design of an operating system (os).
- It describes how the various components of an os are arranged and interact to manage hardware and provide services to users and applications.
Monolithic structure
- Entire os runs as one large program in kernel space.
- All services (file system, device drivers, memory management) are part of a single block of Code.
- Pros:fast and efficient
- Cons: hard to maintain and less secure
Layered approach
- Os divided into layers; each layer provides services to the layer above.
- Example: hardware→ device drivers→ file system → user interface
- Pros: easier to debug and maintain
- Cons: performance overhead due to layers
Microkernel structure
- Kernel provides only essential services (e.g., communication, basic i/o).
- Other services run in user space as separate processes.
- Pros: more secure and stable; easy to extend
- Cons: may be slower due to more context switches
Modular structure
- Os is divided into modules that can be loaded or unloaded dynamically.
- Like a hybrid of monolithic and microkernel approaches.
- Pros:flexibility and easier updates
Operations & services
- Operations of an operating system manages the computer hardware and provides a platform for applications to run
- Services of operating systems provide a variety of services to users and applications
Operations
- Process management : manages program execution and cpu scheduling.
- Memory management : controls allocation and deallocation of ram.
- File system management : organizes data on storage devices (hdd, ssd).
- Device management : uses device drivers to communicate with hardware devices and applications.
- Security & access control: protects data and resources from unauthorized access.
- Networking : manages network connections and communication protocols.
Services
- user interface (ui) : command-line interface (cli) or graphical user interface (gui) for interacting with the system.
- program execution : loads and executes programs.
- i/o operations : provides abstractions for input/output devices.
System calls
Definition
- It is a interface between user programs and the os.
- It allows programs to request services from the os.
- Examples
- fork( ) – create a new process
- exec( ) – run a new program
- read( ) – read data from a file
- write( ) – write data to a file
Operating system
Design goals
- Operating systems are designed with multiple objectives in mind
- Efficiency : the os should use system resources (cpu, memory, i/o) optimally and provide fast response times.
- Reliability : the os must run stably and recover gracefully from errors
- Portability : the os should run on different hardware platforms without major redesign.
Implementation
- Choice of programming language : c/c++ are commonly used because they allow low-level memory and hardware access & portable across multiple architectures
- Kernel structure : the kernel is the core of the os and implements the most critical operations
- Modular design : os is broken into modules for easier maintenance and scalability
- Hardware abstraction : the os uses a hardware abstraction layer to interact with different hardware without changing the kernel code.
System boot
- When you turn on a computer, the bootstrap loader (a small program in rom) loads the os kernelinto memory.
- After this, the os takes control of the system and starts managing resources.