A fundamental software component that serves as an intermediary between computer hardware and user applications
Operating System
A program that controls the execution of application programs and tells the CPU when to execute other programs
Operating System
An interface between the user and hardware that maximizes the efficiency of a system
Functions of the Operating System
Provide User Interface
Control the Processor Hardware
Operating System
A program that acts as an interface between the user and the computer hardware and controls the execution of all kinds of programs
Some popular Operating Systems
Linux Operating System
Windows Operating System
iOS
Android
Types of Operating Systems
Single User OS
Batch OS
Multiprogramming OS
Multiprocessing OS
Multitasking OS
Real-time OS
Networking OS
Time-Sharing OS
Single User OS
Allows only one user or process to access the system at a time
Single User OS
MS DOS
Batch OS
Jobs with similar requirements are grouped and executed as a group to speed up processing. The system put all the jobs in a queue based on first come first serve and then executes the jobs one by one.
Multiprogramming OS
The CPU is always kept busy. Each process needs two types of system time: CPU time and IO time. When a process does its I/O, the CPU can start the execution of other processes. Improves the efficiency of the system.
Multiprocessing OS
More than one processor is present and can execute more than one process at the same time. Parallel computing is achieved.
Multitasking OS
Enables multiple programs to be executed simultaneously. Allows a user to perform more than one computer task at the same time.
Real-time OS
Whenever response must closely match clock time. System must respond to an event within a well-defined time. Used in modern multimedia systems.
Networking OS
Includes software and associated protocols to communicate with other computers via a network conveniently and cost-effectively.
Time-Sharing OS
The CPU is switched among multiple programs given by different users on a scheduled basis. Allows many users to be served simultaneously, so sophisticated CPU scheduling schemes and Input/output management are required.
Important functions of the Operating System
Coordination between other software and users
Process management
Processor Management
Device Management
Memory Management
File Management
Security
BIOS (Basic Input Output System)
It runs checks on all the hardware components and prepares them for use by the application software. It is firmware permanently stored in a computer chip (ROM) and not part of the Operating System.
Bootloader
After the BIOS checks the system, it calls the bootloader program which looks on the hard-drive (or any attached drive) for bootable kernels. It is part of the Operating System.
Kernel
The part of the Operating system responsible for the interface between the application software and the hardware resources that it uses. It manages the use of the CPU, writing and reading data from RAM and hard drive, and the GPU.
Bootstrapping
The process of loading a set of instructions when a computer is first turned on or booted. Diagnostic tests are performed, configurations are set, and the bootloader or bootstrap program is then loaded to initialize the OS.
Typical programs that load the OS
GNU Grand Unified Bootloader (GRUB)
NT Loader (NTLDR)
Linux Loader (LILO)
Network Interface Controller (NIC)
Process
A program in execution. It includes the program counter, stack, registers, and any other resources it's using.
Process Control Block (PCB)
A data structure created by the operating system to store information about a process, stored in kernel space.
Attributes of a Process Control Block
Process-ID
Program Counter
Process State
Priority
General Purpose registers
List of open files
List of open devices
Process Table
PCBs are stored in the form of a LinkedList in the memory. The process image consists of program, data, stack, and attributes.
Process States
New
Ready
Running
Blocked/Wait
Suspended ready
Completion/Termination
Five-State Process Model
Simplified model of the process states: New, Ready, Running, Exit, Blocked
Process Creation
1. Assign a unique process identifier
2. Allocate space for the process
3. Initialize process control block
4. Set up appropriate linkage to the scheduling queue
Process Scheduling
The Operating system manages various types of queues for each of the process states. The PCB related to the process is also stored in the queue of the same state.
Job Queue
All the processes get stored in the job queue, maintained in the secondary memory. They then transition to the Ready queue.
Ready Queue
Ready queue is maintained in primary memory. The short-term scheduler picks the job from the ready queue and dispatches it to the CPU for execution.
Wait Queue
When the process needs some IO operation to complete its execution, the OS changes the state of the process from running to waiting.
Process Scheduling Algorithms
1. First Come First Serve
2. Round Robin
3. Shortest Job First
4. Shortest remaining time first
5. Priority based scheduling
Interrupts
Signals emitted by software or hardware when a process or event requires immediate attention. Tell the CPU to stop its current activities and execute the appropriate part of the operating system.
Types of Interrupts
Hardware Interrupts
Software Interrupts
Traps
Deadlock
A situation where each of the computer processes waits for a resource which is being assigned to some another process, so none of the processes get executed.
Strategies for handling Deadlock
Deadlock Ignorance
Deadlock prevention
Deadlock avoidance
In this situation, none of the process gets executed since the resource it needs, is held by some other process which is also waiting for some other resource to be released
Deadlock
Process 2 needs Resource 1 but Resource 1 is being used by Process 1
Process 1 needs Resource 2 but Resource 2 is being used by Process 2
No process releases the required resource for the other process, so a deadlock occurs