Operating System Support and Memory and Architecture and Management Notes
Operating System (OS) Objectives and Functions
- Convenience: Makes the computer easier to use.
- Efficiency: Allows for better use of computer resources.
- Resource Manager: The OS manages the movement, storage, and processing of data; it is a program executed by the processor that frequently surrenders control to user programs.
- Key Services:
- Program creation (utility programs).
- Program execution (loading instructions and data into main memory).
- Access to I/O devices (simplifying details into reads and writes).
- Controlled access to files (handling formats and protection).
- System access (managing shared/public resources).
- Error detection and response.
- Accounting (collecting usage statistics).
System Interfaces
- Instruction Set Architecture (ISA): Defines machine language instructions and serves as the boundary between hardware and software.
- Application Binary Interface (ABI): Defines standards for binary portability and the system call interface to the OS and hardware.
- Application Programming Interface (API): Provides high-level language (HLL) library calls to access hardware resources and services, ensuring software portability.
Evolution of Operating Systems
- Early Systems (1940s to mid-1950s): No OS; programmers used sign-up sheets to reserve time and manual console controls, leading to wasted setup time and idle processor time.
- Batch Systems: Programs from multiple users are grouped and submitted by an operator. A Resident Monitor (early OS) handles setup and scheduling.
- Job Control Language (JCL): A special language (e.g., instructions starting with "\ ") used to provide instructions to the monitor.
- Multiprogramming: Designed to maximize processor use by keeping multiple jobs in memory so the processor can switch tasks when one waits for I/O.
- Time-Sharing Systems: Designed to minimize response time for multiple interactive users by interleaving execution in short bursts or "quantums."
Essential Hardware Features
- Memory Protection: Prevents user programs from altering the monitor's memory.
- Timer: Prevents a single job from monopolizing the system.
- Privileged Instructions: Can only be executed by the monitor (e.g., I/O instructions).
- Interrupts: Provide the OS flexibility to regain control from user programs.
Process Scheduling
- Long-term Scheduling: The decision to add a process to the pool for execution.
- Medium-term Scheduling: Part of the swapping function; decides which processes are partially or fully in main memory.
- Short-term Scheduling (Dispatcher): Determines which available process the processor will execute next.
- I/O Scheduling: Determines which pending I/O request will be handled by an available device.
- Five-State Process Model: Includes states for New, Ready, Running, Exit, and Blocked.
- Process Control Block (PCB): Contains identifiers, state, priority, program counter, and context data for a process.
Memory Management Techniques
- Fixed Partitioning: Dividing memory into fixed-sized regions, which can be equal or unequal (e.g., partitioning a 64Mbyte memory).
- Dynamic Partitioning: Allocates exactly the amount of memory required by a process.
- Swapping: Moving processes between main memory and disk storage to manage the degree of multiprogramming.
- Address Types:
- Logical Address: Relative to the beginning of the program.
- Physical Address: Actual location in main memory.
- Base Address: The current starting location of the process.
Paging and Virtual Memory
- Paging: Memory is divided into fixed-size frames; processes are divided into pages. A Page Table maps pages to frames.
- Virtual Memory (Demand Paging): Pages are brought into memory only when needed.
- Principle of Locality: Program execution often stays confined to a small section of code.
- Page Fault: Triggered when a program references a page not currently in main memory.
- Thrashing: A state where the processor spends more time swapping pages than executing instructions.
- Translation Lookaside Buffer (TLB): A cache used to speed up the translation of virtual addresses to physical addresses.
Segmentation and Protection
- Segmentation: Programmer-visible address spaces that simplify handling growing data structures and allow independent recompilation.
- Protection Levels: ARM and other architectures use privilege levels ranging from Level 0 (most protected/clearance) to Level 3 (least protected/classification).
- ARM Specifics:
- Supports 16 domains to maintain protection between processes.
- Access Control bits (AP) designate regions as No access, Read only, or Read-write.
- Roles include Clients (observe permissions) and Managers (bypass permissions).