OS 101
Page 1: What is an Operating System?
Definition: A program that acts as an intermediary between the user and the computer hardware.
Goals of Operating Systems:
Execute user programs and make solving user problems easier.
Make the computer system convenient to use.
Use the computer hardware efficiently.
Purposes and Tasks of Operating System
Purposes:
Controls allocation and use of the computing system's resources among various users and tasks.
Provides an interface between computer hardware and programmer for coding and debugging of application programs.
Tasks:
Provides facilities to create and modify programs and data files using an editor.
Access to the compiler for translating the user program from high-level language to machine language.
Provides a loader program to move the compiled program code to the computer's memory for execution.
Provides routines that handle the details of I/O programming.
Page 2: Computer System Structure
Components of Computer System:
Hardware: Basic computing resources including CPU, memory, and I/O devices.
Operating System: Controls and coordinates the use of hardware among various applications and users.
Application Programs: Define the ways in which system resources are used to solve computing problems (e.g., word processors, compilers, databases).
Users: Include people, machines, and other computers.
Abstract View of Components:
User → Application Programs → Operating System → Computer Hardware
Page 3: Storage Structure
Main Memory:
The only large storage media that the CPU can access directly.
Typically volatile and random access memory (e.g., DRAM).
Secondary Storage:
Extension of main memory providing large, non-volatile storage capacity.
Hard Disk Drives (HDD):
Made of rigid platters covered with magnetic material, divided into tracks and sectors. Disk controllers manage interactions between computer and device.
Non-volatile Memory (NVM): Faster than hard disks and non-volatile. Becoming popular due to improvements in capacity and performance.
Page 4: Storage Hierarchy
Storage systems are organized in a hierarchy based on speed, cost, and volatility.
Caching:
Copies information into a faster storage system; main memory serves as a cache for secondary storage.
Device Driver:
For each device controller to manage I/O, providing a uniform interface between the controller and kernel.
Operating System Services
OS provides an environment for program execution and services for programs and users:
User-Focused Services:
User interface, program execution, I/O operations, file-system manipulation, communications, error detection.
Page 5: Operating System Services Continued
Efficient Operation Services:
Resource allocation, logging, protection, and security.
Page 6: Key Components of a GUI
Elements:
Icons, buttons, menus, windows, pointers.
System Calls:
Programmatic way for computer programs to request services from the OS kernel. They provide the operating system's services to user programs via the Application Programming Interface (API).
Page 7: Types of System Calls
File System Operations: Create, delete, and manipulate files.
Process Control: Manage processes including creation, termination, allocation, and deallocation.
Memory Management: Handle memory allocation, deallocation, and dynamic resizing.
Interprocess Communication (IPC): Handle communication between processes.
Device Management: Interact with peripheral devices.
Page 8: System Services Continued
System Programs: Provide a convenient environment for program development and execution.
File Manipulation: Creating, deleting, and managing files and directories.
Status Information: Information retrieval from the system like date, time, and resource availability.
Page 9: System Services Continued
File Modification: Using text editors and commands to modify files.
Programming Language Support: Provide compilers and interpreters.
Communications: Mechanisms for virtual connections among processes and users.
Background services are launched at boot time and responsible for system management.
Application programs generally do not pertain to system functions.
Page 10: A View of Operating System Services
User Interface: Includes GUI and command line.
Services include program execution, I/O operations, communication systems, resource allocation, error detection, and hardware management.
Page 11: What is Process?
Process: A program in execution, managed by the OS for efficiency.
Comprises different sections: text (code), stack (temporary data), data (global variables), heap (dynamically allocated memory).
Process vs. Program: Programs are passive entities stored on disk; processes are active in memory. Multiple processes can exist for one program.
Page 12: Process State
States of a Process:
New, Running, Waiting, Ready, Terminated.
Process Control Block (PCB): Holds information on process state, program counter, memory limits, and I/O status.
Page 13: Operation on Processes
Process Creation: Parent processes create child processes forming a tree structure and are managed by process identifiers (pid).
Process Termination: Managed using exit() system call; can terminate child processes during execution.
Page 14: Interprocess Communication**
Processes can be independent or cooperating, with reasons for cooperation including information sharing and computation speedup.
Two IPC models: Shared memory and message passing.
Page 15: What is a Thread?
Thread: Basic unit of CPU utilization consisting of an ID, program counter, register set, and stack, sharing resources with other threads in the same process.
Traditional processes have a single thread, while multithreaded processes can perform multiple tasks simultaneously.
Page 16: Multithreaded Server Architecture
Threads enhance responsiveness, resource sharing, economy, and scalability.
Page 17: Concurrency vs. Parallelism
Concurrency: Multiple processes making progress over time; Parallelism: Multiple tasks performed simultaneously.
Types of parallelism: Data parallelism and task parallelism.
Page 18: Multithreading Models
Many-to-One: Many user threads mapped to a single kernel thread.
One-to-One: Each user thread corresponds to one kernel thread.
Many-to-Many: Multiple user threads mapped to multiple kernel threads.
Page 19: Basic Concepts
Maximum CPU utilization is achieved through multiprogramming. CPU bursts and I/O wait times influence performance.
Page 20: What is CPU Scheduler?
Allocates CPU cores to processes in the ready queue under various circumstances. Preemptive and non-preemptive scheduling types exist.
Page 21: Scheduling Criteria
Goals include maximizing CPU utilization and throughput while minimizing turnaround, waiting, and response time. Convoy effect can occur in scheduling.
Page 22: Scheduling Algorithms
Shortest-Job First (SJF): Minimizes average waiting time, can be preemptive.
Round Robin (RR): Allocates small time slices for process execution, ensuring fairness.
Priority Scheduling: Assigns priorities to processes, with potential starvation and aging addressed.