Operating Systems Important Topics - Notes
1. Real-Time Operating System
Definition:
- A Real-Time Operating System (RTOS) is an OS intended to serve real-time applications that process data
as it comes in, typically without buffer delays.
Types:
- Hard Real-Time: Guarantees critical task completion on time.
- Soft Real-Time: Prioritizes tasks, but delays are acceptable.
Applications:
- Flight Control, Medical Systems, Industrial Automation, Military Applications.
2. Operating System Services
Services provided by OS:
- User Interface: CLI, GUI, and batch interface for user interaction.
- Program Execution: Manages execution and termination of processes.
- I/O Operations: Manages input and output devices and operations.
- File System Manipulation: Organizes, reads, writes, and deletes files.
- Communication: Provides inter-process communication (IPC) capabilities.
- Error Detection: Detects and responds to errors from CPU and memory.
3. Process Management
Process States:
- New: Process is being created.
- Ready: Process is loaded and waiting for CPU allocation.
- Running: Process is being executed.
- Waiting: Process is waiting for resources.
- Terminated: Process has completed.
Process Control Block (PCB):
- PCB stores process-specific information such as process ID, state, program counter, registers, and
allocated resources.
CPU Scheduling Algorithms:
- FCFS (First-Come-First-Serve): Non-preemptive, executes in order of arrival.
- SJF (Shortest Job First): Executes shortest jobs first; may be preemptive or non-preemptive.
- Round Robin: Allocates time slices to each process, ensuring fair execution.
4. Memory Management
Virtual Memory:
- Allows execution of processes not completely in memory, increasing flexibility.
Paging vs Segmentation:
- Paging: Divides memory into fixed-size pages.
- Segmentation: Divides memory into variable-size segments.
Partitioning:
- Fixed Partitioning: Divides memory into fixed-size blocks.
- Variable Partitioning: Allocates memory dynamically as per process needs.
5. File Management
File Attributes:
- Name, type, location, size, protection, and timestamps.
File Operations:
- Creating, opening, reading, writing, deleting, and repositioning files.
Allocation Methods:
- Contiguous Allocation: Files occupy contiguous memory blocks.
- Linked Allocation: Files are linked through pointers.
- Indexed Allocation: Uses an index block to manage blocks of a file.
6. Inter-Process Communication (IPC)
Shared Memory Model:
- Processes share a memory segment and read/write to exchange data.
Message Passing Model:
- Uses message exchanges for communication, suitable for distributed systems.
7. Deadlock
Definition:
- Deadlock occurs when a set of processes are blocked as each process is holding a resource and waiting for
another resource held by another process.
Necessary Conditions:
1. Mutual Exclusion
2. Hold and Wait
3. No Preemption
4. Circular Wait
Prevention Strategies:
- Avoid one or more conditions to prevent deadlocks.
8. UNIX/Linux Commands
Common Commands:
- ps: Lists current processes with options for user/process filters.
- kill: Terminates processes using process ID.
- sleep: Pauses command execution for a specified time.
- mkdir: Creates a new directory.
- ls: Lists files and directories in a specified path.
9. System Calls
Purpose:
- Interface for user programs to request services from the OS.
Types of System Calls:
- Process Control: end, load, execute.
- File Management: create, delete, read, write.
- Device Management: request device, release device.
10. Multithreading Models
Multithreading Models:
- Many-to-One: Maps multiple user threads to one kernel thread.
- One-to-One: Each user thread has its own kernel thread.
- Many-to-Many: Maps many user threads to a few or equal kernel threads.