Operating System in brief
Wednesday, January 17, 2024
OS and its component simplified
Description
Operating Systems (OS) are the backbone of modern computing, orchestrating the hardware and software resources of a computer. They provide a user-friendly interface and ensure efficient operation. In this blog, we will explore the key components of an OS and delve into their major sub-parts and functionalities. The entire OS can be summarized through the following five crucial aspects:
1. Process Management
2. Process Synchronisation & Deadlock
3. Memory Management
4. Virtual Memory
5. File System
1] Process Management
Process management is a fundamental function of an OS, managing the execution of processes within a computer system. A process is an instance of a program in execution, encompassing the program code, its current activity, and the resources allocated to it.
- PCB
- Process States : New, Ready, Running, Terminated, Waiting, Suspended
- Process Scheduling Algorithms
- Schedulers and their functions ( Long term Scheduler, Mid term Scheduler, Short term scheduler)
- Threading and Multi-threading
2] Process Synchronization & Deadlock
Processes running concurrently may need to share resources or communicate, necessitating synchronization to ensure correct sequencing of actions. Without proper synchronization, concurrent processes can lead to race conditions, where the outcome depends on the sequence or timing of uncontrollable events.
- Critical Section and its problems
- via hardware TestandSet() and Swap()
- Semaphore (s), wait() & signal()
- Mutual Exclusion, Bounded waiting, Progress
- Classical Problems: Dining philosopher, Reader-Writer, Producer-Consumer
now DEADLOCK
- Conditions for deadlock to happen : Mutual Exclusion, Hold & waiting, No-pre-emption, Circular wait
- Prevention (Resource Request Algo), Avoidance (Banker's Algo) and Detection (wait-for-graph and algo)
- Recovery from deadlock (revert)
- Resource Allocation Graphs
3] Memory Management
Memory management involves managing the computer's primary memory or RAM. It keeps track of each byte in a computer's memory and manages the allocation and deallocation of memory spaces as needed by various programs.
- Allocation, Deallocation, Protection
- Contiguous Allocation - Fixed and Variable Partition
- Non-Contiguous Allocation - Paging and Segmention & Multilevel paging
- Partition Allocation Policy - First, Best, Worst, NextFit
- TLB (translation lookaside buffer)
- Mappings: Fully Associative, Set Associative and Direct mapping
4] Virtual Memory
Virtual memory is a memory management capability that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "creates the illusion to users of a very large (main) memory."
- Page Replacement Policies ( FIFO, Optimal, LRU, LFU, MFU )
- Frame allocation and belady's anomaly
- Demand Paging - Pure demand paging & demand paging
- Thrashing -> Locality models, work set, page fault frequency
- Inverted, Hashed Page table
5] File System
The file system is the method and data structure that an OS uses to manage files on a disk or partition. It organizes, stores, retrieves, and manages data and metadata.
- Files, Attributes & types of systems
- File directory structure
- Block and free space management (Bitmap, Freelist, counting & grouping)
- File allocation methods : Contiguous, Linked and Indexed
- Disk Structure and Accessing Time and formulas
- Partitioning disk - Physical (manufacturer) and Logical (Primary OS & Extended Userfile)
Understanding these five key components and their sub-parts provides a comprehensive overview of an OS's functionalities. From managing processes and memory to ensuring secure and efficient file storage, the OS is a complex, multifaceted system essential for modern computing. By mastering these fundamental aspects, one gains a deeper appreciation of how OSes underpin the seamless operation of our digital lives.