OSYin Short
OSYin Short
Operations of OS:
Manages input/output (I/O) devices.
Organizes files and directories.
Views of OS:
User View: Focuses on ease of use.
System View: Focuses on resource management.
2.3 OS Components
Process Management: Handles running programs and allocates CPU time.
Main Memory Management: Allocates and manages RAM for programs.
File Management: Organizes, stores, and retrieves files.
I/O Management: Controls input/output devices like printers and keyboards.
Secondary Storage Management: Manages long-term data storage, such as hard drives.
3.1 Process
Process: A program in execution.
Process States: The lifecycle stages of a process:
New: Process is created.
Ready: Waiting to be assigned to the CPU.
Running: Executing instructions.
Waiting: Paused, waiting for resources.
Terminated: Process is complete.
Process Control Block (PCB): A data structure that stores all information about a process
(e.g., ID, state, priority).
Context Switch: Switching from one process to another by saving and loading states.
3.3 Inter-Process Communication (IPC)
Introduction: Processes need to communicate for sharing data or resources.
Shared Memory: Processes share a common memory space for communication.
Message Passing System: Processes send and receive messages to communicate.
3.4 Threads
Threads: Smaller units of a process that run independently.
Benefits: Faster execution, better resource use.
User Threads vs Kernel Threads:
User Threads: Managed by user programs.
Kernel Threads: Managed by the OS.
Multithreading Models:
Many-to-One: Many threads mapped to one OS thread.
One-to-One: Each thread is mapped to one OS thread.
Many-to-Many: Many threads mapped to multiple OS threads.
Criteria:
CPU Burst: Time spent using the CPU.
I/O Burst: Time spent waiting for input/output.
4.3 Deadlock
Deadlock: When processes block each other and can’t proceed.
Necessary Conditions:
Mutual exclusion, hold and wait, no preemption, circular wait.
Deadlock Handling:
Prevention: Avoid conditions causing deadlock.
Avoidance: Use algorithms to prevent deadlock (e.g., Banker's Algorithm).