CH 1.PDF Introduction To Operating Systems
Document Details
Uploaded by EruditeVorticism1110
University of Sharjah
Tags
Summary
This document provides an introduction to operating systems, covering topics such as the purpose and goals of an operating system. It also discusses computer system components (hardware, operating system, applications, and users), device types, interrupt functions, requirements, and traps/exceptions. The document further explains how operating systems handle interrupts, roles (resource allocator and control program), kernel and bootstrap functionalities, computer system operation, storage structures, caching, DMA (Direct Memory Access), timesharing, and multiprocessor systems.
Full Transcript
# Introduction To OS ## What is the primary purpose of an operating system? An operating system acts as an intermediary between the user and the computer hardware. ## What are the goals of an operating system? - To execute user programs and solve user problems more easily. - To make the computer...
# Introduction To OS ## What is the primary purpose of an operating system? An operating system acts as an intermediary between the user and the computer hardware. ## What are the goals of an operating system? - To execute user programs and solve user problems more easily. - To make the computer system convenient to use. - To use computer hardware efficiently. ## What are the four components of a computer system? 1. **Hardware** Provides basic computing resources. - CPU, Memory, I/O devices 2. **Operating System** Controls and coordinates use of hardware among applications and users. 3. **Application Programs** Define how system resources are used to solve computing problems of a user. - Word processors, compilers, video games, web browsers 4. **Users** Includes people, machines, and other computers. ## How do operating systems cater to different types of users and devices? Users want convenience, ease of use, and good performance, often without concern for resource utilization. ## What are the different types of devices? **User Point of View** - **Shared device:** It has multiple users and it must keep all users happy ex. mainframe, minicomputer - **Handheld device:** Ex. workstations have dedicated resources but rely on shared resources from servers - **Dedicated device:** Are resource poor but optimized for usability and battery life. - **Embedded device:** Have little or no interface ex. found in devices, automobiles. **System Point of View** - **Compiler** - **Assembler** - **Database** - **Texteditor** - **System and application programs** - **Operating System** - **Computer** - **Hand ware** ## What are the common functions of Interrupts? Interrupt transfers control to interrupt service routine through interrupt vector which contains addresses of all service routines. ## What are the requirements of interrupt architecture? - It must save the address of interrupted instruction. ## What is trap or exception? A software-generated interrupt caused either by an error or a user request. ## What does it mean that an operating system is interrupt-driven? It means that the OS uses interrupts to respond to events and manage the system. ## How does an operating system handle interrupts? The OS preserves the state of the CPU by storing registers and the program counter. ## What are the two ways the OS can determine the type of interrupt? 1. **Polling:** Directly informs the CPU and provides an identifier. 2. **Vectored interrupt system:** Checking for potential interrupts. ## What happens after the interrupt type is identified? Separate segments of code determine what action should be taken for each type of interrupt. ## What are the main roles of an operating system? - **Resource allocator:** Manages and decides about conflicting requests for fair and efficient resource use. - **Control program:** To execute programs, prevent errors, and misuse of the computer. ## What is the Kernel in an operating system, and how is it different from other programs? The Kernel is the core program running at all times on a computer. Another definition is "everything a vendor ships when you order an operating system and the rest can be called system program or application program." ## What happens during computer startup? 1. **Bootstrap Program:** Runs. 2. **Operating System:** Is loaded. 3. **Operating System:** Runs. ## What is bootstrap? A program that is loaded at powerup and is stored in ROM. Known as firmware and starts execution. ## What is computer system operation? 1 or more CPU's, device controllers connect through common bus providing access to shared memory where concurrent execution of CPU's and devices compete for memory cycles. ## How do computer systems handle concurrent operations? - CPU and I/O devices execute concurrently. - Each device controller manages a specific device with a local buffer. - Data transfer from/to main memory and from/to devices local buffer in CPU. - Data transfer from/to local buffer to controller. - Device controller informs CPU that operation is done by sending interrupts. ## Storage Definitions and notation review - **Basic unit of computer storage:** A bit - **8 bits:** Is a byte - **A word:** Is multiple bytes - **KB:** 1024 bytes - **MB:** 1024^2 bytes - **GB:** 1024³ bytes - **TB:** 1024⁴ bytes - **PB:** 1024⁵ bytes ## Storage Structure ### **Main Memory** - **Characteristics:** Random access, Volatile - **Note:** Volatile - Loses memory & non-volatile stores data and does not lose data if turned off. ### **Secondary Storage** - **Characteristics:** Provides Large non-volatile storage capacity - **Hard disks:** Rigid metal covered with magnetic recording material. It has a disk controller which determines the logical interaction between the device and the computer. - **Characteristics:** Surface divided into tracks which are subdivided into sectors. - **Solid-State disks:** Faster than hard disk, non-volatile, various tech use it. - **Characteristics:** It's more popular. ## Storage Device Hierarchy - **Registers:** Organized based on speed, cost, volatility. - **Cache:** - **Main memory:** - **Solid-State memory:** - **Hard disk:** - **Optical disk:** - **Magnetic tapes:** ## What is caching? An important principle that happens at many levels in a computer (OS, hardware, software). It copies information from slower to faster storage temporarily. ## What storage acts as cache? Cache ## What is checked first to determine if information is present? Faster storage (cache) ## What happens if information is in the cache and if it's not? - If information is there, it's directly used from the cache. - If it's not, the information is not found, it is cached in faster storage then used. ## Main memory acts as cache for secondary storage. ## How does the size of the cache compare to the storage being cached? The cache is smaller than the storage being cached. ## What is identified as an important design problem? Cache management size and replacement policy. ## Direct Memory Access structure ## What is DMA used for? DMA is used for high-speed I/O devices able to transmit information at close to memory speeds. ## What transfers data to DMA? (It needs a bus) Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention. ## How many interrupts are generated per block in DMA? Only one is generated per block rather than one per byte. ## Time Sharing (Multitasking) kernel communication ## What is timesharing(Multitasking)? It is a logical extension of CPU switches frequently so users can interact with each job while it's running, creating interactive computing. ## What is the desired response time in a timesharing system? Less than 1 second. ## Summary of Multiprogramming (Batch) and Timesharing (Multitasking) | Feature | Multiprogramming (Batch) | Timesharing (Multitasking) | |---|---|---| | Goal | Designed for specific tasks. | Interactive computing (user interaction) | | User Interaction | Limited or none (jobs submitted in batches) | Frequent, allows users to interact with running programs | | CPU | Occurs when a job waits (e.g., for I/O) | Frequent, rapid switching between jobs | | Response Time | Not a primary concern (can be long) | Critical: should be less than 1 second | | Memory Usage | Subset of total jobs kept in memory | Each user has at least one process in memory; swapping used if processes don't fit | | Scheduling | Job scheduling selects which job to run | CPU scheduling manages which process gets CPU time | | Virtual Memory | Not explicitly mentioned, but swapping implies a need for memory management | Relies on virtual memory to allow processes to run without being fully in memory | ## Computer System Architecture ## What does each user have in memory in a timesharing system? It has at least one program executing (a process). ## What happens if processes don't fit in memory? Swapping moves them in and out to run. ## What is the most common processor setup in systems? Mostly used is a single general-purpose processor and a special-purpose processor. ## What does virtual memory allow in timesharing (multitasking)? Allows execution of processes not completely in memory. ## What are other names for Multiprocessor systems? - Parallel systems or Highly-coupled systems which divide jobs evenly to accomplish tasks. ## What are the advantages of multiprocessor systems? 1. **Increased throughput:** Amount of work completed in a given time. 2. **Economy of scale:** Cheaper than many single-purpose systems. 3. **Increased Reliability:** (Fault tolerance) ## How does timesharing (Multitasking) process jobs? If several jobs are ready to run at the same time, CPU scheduling happens. ## What are the two types of multiprocessor systems? 1. **Asymmetric Multiprocessing:** Each processor is assigned a specific task. 2. **Symmetric Multiprocessing:** Each processor performs all tasks. ## Clustered Systems ## How are clustered systems similar to multiprocessor systems? They have multiple processing units working together to accomplish tasks. ## What is a common way for systems in a cluster to share storage? Storage-area network (SAN) ## What primary benefit do clustered systems provide? High availability service which survives failures. ## What is the configuration in asymmetric and symmetric clustering? - **Asymmetric clustering:** One machine is in hot standby mode. - **Symmetric clustering:** Multiple nodes running applications, monitoring each other ## What is a common use for clusters? High-Performance computing (HPC); they must be written to use parallelization. ## What do some clusters have to avoid conflicting operations? To avoid conflict, they use a distributed lock manager (DLM). ## Operating System Structure ## Why is Multiprogramming batch system needed? Used for efficiency ## What is the limitation of a single user in terms of CPU and I/O, and how does multiprogramming address that limitation? A single user cannot keep the CPU and I/O devices busy at all times, so multiprogramming organizes the jobs (code & data) so the CPU always has one to execute ## How does Multiprogramming process jobs? - A subset of total jobs is kept in memory, and a job is selected and runned via job scheduling. ## What happens when a job has to wait for (e.g.) I/O? The OS switches to another job. ## What are the two modes of operation? 1. **User mode (software)** 2. **Kernel mode (hardware)** ## How is the Mode bit provided? By hardware. ## What ability does the mode bit provide? It distinguishes when the system is running user or kernel code. ## How are instructions executed in mode bit? Instructions designated as privileged are only executable in kernel mode. ## How does a system call affect the mode bit? Changes mode to kernel and resets the mode to user. **Note:** CPU supports multi-mode operations, e.g., virtual machine manager (VMM) mode for guest VM's. ## Transition from User to Kernel mode ## what is the purpose of the timer? Prevent infinite loops or processes from hogging resources. ## What are the steps for transitioning from user to kernel mode? 1. Timer set to interrupt the computer after some time. 2. Keep a counter that is decremented by the physical clock. 3. OS set/decrement the counter (privileged instructions). 4. When counter=zero, it generates an interrupt. ## What happens if a timer interrupt occurs? - User Code (Mode bit = 1) - Kernel mode (Mode bit = 0) Set up before scheduling a process to regain control or terminate a program that exceeds a given time. ## Process Management ## What is a process? A program in execution; a unit of work within the system. ## What is the key difference between a program and a process? - **Program:** Passive entity - **Process:** Active entity ## What resources does a process need to accomplish its tasks? - CPU - Memory - I/O - Files - Initialization data ## What happens when a process terminates? Any reusable resources are reclaimed. ## Single & Multi Threaded Processes / Process Management activities ## What does a single-threaded and multi-threaded process have? - **Single-threaded:** Has one program counter specifying the location of the next instruction to execute, and this happens sequentially, one at a time until completion. - **Multi-threaded:** One program counter per thread. ## What is typical of a system regarding processes? A system has many processes, user processes, OS processes running concurrently on one or more CPUs. ## How is concurrency achieved? Multiplexing CPUs among processes / threads (simultaneously running processes) ## What is the OS responsible for in connection with process management? 1. Creating & deleting the user and system processes 2. Suspending & resuming processes 3. Provide mechanisms for process synchronization and communication 4. Provide mechanisms for deadlock handling. ## Memory Management ## What is required to execute a program? All or part of the instructions and data needed by a program must be in memory. ## What does memory management do? - Keeps track of devices in memory and currently used by whom. - Decides which processes and data move in or out of memory. - Allocating and deallocating memory space as needed. ## What are memory management activities? 1. Keeps track of devices in memory and is currently used by whom. 2. Decides which processes and data move in or out of memory. 3. Allocating and deallocating memory space as needed. ## Storage Management ## what is the role of os in storage management? The OS provides a uniform, logical view of information storage. It abstracts physical properties to a logical view of information storage. ## what devices does the os control storage for? Various devices, like disk drives and tape drives. ## What are the properties of storage devices ? 1. Access speed 2. Capacity 3. Data transfer rate 4. Access method ## File System management ## How are files organized? In directories. ## what is the purpose of access control in file system? To determine who can access what file. ## what are os activities related to file management? 1. Creating and deleting files & directories. 2. Primitives to manipulate files and directories. 3. Mapping files onto secondary storage. 4. Backup files onto stable storage media (non-volatile). ## Mass-Storage Management ## Why are disks typically used in mass storage ? Used to store data that cannot fit in main memory or data needed to be kept for a long time. ## what does the speed of computer operation depend on in relation to storage? The speed of computer operation depends on the disk subsystem and its algorithms. ## What are OS activities for mass storage? 1. Free space management 2. Storage allocation 3. Disk scheduling ## What does tertiary storage include? Optical storage and magnetic tapes that are managed by OS and applications; they can be WORM or RW. ## What should Multiprocessor provide regarding cache? Cache coherency: Which means all CPUs must be updated with the most recent value in the cache. ## I/O Subsystem ## What is one purpose of the OS regarding hardware devices? To hide the peculiarities of hardware devices from the user. ## What is the I/O subsystem responsible for in terms of memory management? Memory management of I/O: Includes buffering, caching, and spooling. ## What is buffering? Storing data temporarily while it's being transferred. ## What is caching in terms of I/O? Storing parts of data in faster storage for performance. ## What is spooling? The overlapping of output of one job with input of other jobs. ## What interface does the I/O subsystem provide? General device driver interface and drivers for specific hardware devices. ## Protection and Security ## What is protection? Any mechanism for controlling access of processes or users to resources defined by OS. ## What is security? The defense of the system against internal and external attacks. ## What are examples of security threats? Denial of Service, worms, viruses, identity theft, theft of service. ## What is the first step in determining who can do what in a system? Distinguishing among users. ## What are user identities? (e.g. user ID, security ID) Includes name and number, one per person. ## How is user ID used for access control? It is associated with all the files and processes of a user who can access. ## What is the purpose of group identifier (group ID)? Allows a set of users to be defined and controls managed, then associated with processes and files. ## What is privilege escalation? It allows a user to change to an effective ID with more rights. ## Computing Environment - **Traditional Computing:** Stand-alone general-purpose machine. - **Mobile Computing:** Handheld smartphones, tablets. - Apple iOS, Google Android - **Distributed Computing:** Collection of separate, heterogeneous, systems networked together. - Client-server computing - Compute-server system - File-server system - **Other examples of computing environments:** Peer to peer, virtualization, cloud computing, real-time, embedded systems. ## Open Source Operating Systems ## How are open source operating systems made available? In source-code format rather than just binary (closed source). ## What are copy protection and DRM? They are counter to the copy protection and digital rights management movement in open source OS. ## Who started the open-source movement? The Free Software Foundation (FSF) - And they use the copyleft GNU Public License (GPL). ## Examples of Open Source OS? - GNU/Linux - BSD UNIX - Core of Mac OS X. ## What tools can be used to run guest OS for exploration? VMM's like VMware Player (free open source), Virtual box also.