Operating System Concepts - Introduction PDF
Document Details
2024
Tags
Summary
This document is a set of lecture slides providing an introductory overview of operating systems. It covers topics including operating system roles, computer systems' structure, components, and functionality. The content includes sections on interrupts, virtualization, and computing environments.
Full Transcript
Introduction Chapter 1 September 12, 2024 OS: Intro 1 Chapter Objectives ◼ Describe the general organization of a computer system and the role of interrupts. ◼ Describe the components in a modern mul...
Introduction Chapter 1 September 12, 2024 OS: Intro 1 Chapter Objectives ◼ Describe the general organization of a computer system and the role of interrupts. ◼ Describe the components in a modern multiprocessor computer system. ◼ Illustrate the transition from user mode to kernel mode. ◼ Discuss how operating systems are used in various computing environments. ◼ Provide examples of free and open-source operating systems. September 12, 2024 OS: Intro 2 Chapter Outline ◼ What OSs Do ◼ Kernel Data Structures ◼ Computer System Organization ◼ Computing Environment ◼ Computer System Architecture ◼ OS Operations ◼ Resource Management ◼ Security and Protection ◼ Virtualization September 12, 2024 OS: Intro 3 - What is an OS? ◼ Operating system: A program that manages a computer's hardware, provides a basis for application programs, and acts as an intermediary between the computer user and the computer hardware. ◼ OS is a resource allocator ◼ Manages all resources ◼ Decides between conflicting requests for efficient and fair resource use ◼ OS is a control program ◼ Controls execution of programs to prevent errors and improper use of the computer September 12, 2024 OS: Intro 4 -- What are the Components of OS? ◼ Operating systems are everywhere, from cars and home appliances that include "Internet of Things" devices, to smart phones, personal computers, enterprise computers, and cloud computing environments. ◼ There is no universally accepted definition of what is part of the operating system. A simple viewpoint is that it includes everything a vendor ships when you order "the operating system.“ ◼ Kernel ◼ System programs September 12, 2024 OS: Intro 5 - Computer System Structure ◼ We begin our discussion by looking at the role of OS in the overall computer system. ◼ Computer system can be divided into four components ◼ Hardware – Examples: CPU, memory, I/O devices ◼ Operating system – Examples: Windows, UNIX ◼ Application programs – Examples: Word processors, compilers, web browsers, database systems, video games ◼ Users - Examples: People, machines, other computers September 12, 2024 OS: Intro 6 -- Four Components of a Computer System September 12, 2024 OS: Intro 7 - Computer System Organization.. ◼ A modern general-purpose computer system consists of one or more CPUs and a number of device controllers connected through a common bus that provides access between components and shared memory. September 12, 2024 OS: Intro 8 -- Computer System Organization.. ◼ Device controller ◼ Each device controller is in charge of a specific type of device ◼ A device controller maintains some local buffer storage and a set of special- purpose registers. ◼ The device controller is responsible for moving the data between the peripheral devices that it controls and its local buffer storage. ◼ Typically, operating systems have a device driver for each device controller. ◼ Device driver understands the device controller and provides the rest of the operating system with a uniform interface to the device ◼ The CPU and the device controllers can execute in parallel, competing for memory cycles. September 12, 2024 OS: Intro 9 -- Interrupts ◼ To start an I/O operation, the device driver loads the appropriate registers in the device controller. ◼ The device controller, in turn, examines the contents of these registers to determine what action to take (such as "read a character from the keyboard"). ◼ The controller starts the transfer of data from the device to its local buffer. ◼ Once the transfer of data is complete, the device controller informs the device driver that it has finished its operation. This is accomplished via an interrupt. ◼ The device driver then gives control to other parts of the operating system. September 12, 2024 OS: Intro 10 --- Interrupts ◼ An operating system is interrupt driven ◼ Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually by way of the system bus. ◼ When the CPU is interrupted, it stops what it is doing and immediately transfers execution to a fixed location as specified by the interrupt vector. ◼ The fixed location usually contains the starting address where the service routine for the interrupt is located. ◼ The interrupt service routine executes; on completion, the CPU resumes the interrupted computation. September 12, 2024 OS: Intro 11 --- Interrupt Timeline --- Interrupts ◼ The basic interrupt mechanism works as follows: ◼ The CPU hardware has a wire called the interrupt-request line that the CPU senses after executing every instruction. ◼ When the CPU detects that a controller has asserted a signal on the interrupt- request line, it reads the interrupt number and jumps to the interrupt-handler routine by using that interrupt number as an index into the interrupt vector. ◼ It then starts execution at the address associated with that index. ◼ The interrupt handler saves any state it will be changing during its operation, determines the cause of the interrupt, performs the necessary processing, performs a state restore, and executes a return_from_interrupt instruction to return the CPU to the execution state prior to the interrupt. September 12, 2024 OS: Intro 13 - I/O Structure ◼ A large portion of operating system code is dedicated to managing I/O. ◼ A general-purpose computer system consists of multiple devices, all of which exchange data via a common bus. ◼ The form of interrupt-driven I/O explained before is fine for moving small amounts of data but can produce high overhead when used for bulk data movement such as disk I/O. ◼ To solve this problem, direct memory access (DMA) is used. September 12, 2024 OS: Intro 14 --- Direct Memory Access (DMA) Structure ◼ Used for high-speed I/O devices able to transmit information at close to memory speeds ◼ Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention ◼ Only one interrupt is generated per block, rather than the one interrupt per byte September 12, 2024 OS: Intro 15 - Storage Structure ◼ Volatile Storage – Main memory, registers, and cache. ◼ Main memory is the only large storage media that the CPU can access directly. ◼ Non-volatile storage (NVS) – extension of main memory that provides large nonvolatile storage capacity ◼ Mechanical - Magnetic disks (HDD) – rigid metal or glass platters covered with magnetic recording material ◼ Electrical – Flash memory, SSD, etc ◼ Electrical storage is typically costly, smaller, and faster than mechanical storage. September 12, 2024 OS: Intro 16 -- Storage-Device Hierarchy September 12, 2024 OS: Intro 17 -- Storage Hierarchy ◼ Storage systems organized in hierarchy ◼ Speed ◼ Cost ◼ Volatility ◼ Caching – copying information into faster storage system; main memory can be viewed as a last cache for secondary storage September 12, 2024 OS: Intro 18 - Computer-System Architecture ◼ Single processor Systems ◼ Multiprocessors Systems ◼ Multicore ◼ NUMA ◼ Clustered Systems September 12, 2024 OS: Intro 19 -- Single processor Systems ◼ Many years ago, most computer systems used a single processor containing one CPU with a single processing core. ◼ The core is the component that executes instructions and contains registers for storing data locally. ◼ The one main CPU with its core is capable of executing a general-purpose instruction set, including instructions from processes. ◼ These systems have other special-purpose processors as well. They may come in the form of device-specific processors, such as disk, keyboard, and graphics controllers. ◼ All of these special-purpose processors run a limited instruction set. September 12, 2024 OS: Intro 20 -- Multiprocessor Systems ◼ On modern computers, from mobile devices to servers, multiprocessor systems now dominate the landscape of computing. Also known as parallel systems, tightly- coupled systems ◼ Advantages include 1. Increased throughput 2. Economy of scale 3. Increased reliability – graceful degradation or fault tolerance ◼ Two types 1. Asymmetric Multiprocessing 1. One of them acts as a boss 2. Each process is assigned specific task. 2. Symmetric Multiprocessing 1. No boss, all peers September 12, 2024 OS: Intro 21 --- Multiprocessing Architecture September 12, 2024 OS: Intro 22 --- Multicore ◼ The definition of multiprocessor has evolved over time and now includes multicore systems, in which multiple computing cores reside on a single chip. ◼ Multicore systems can be more efficient than multiple chips with single cores because on-chip communication is faster than between-chip communication. ◼ One chip with multiple cores uses significantly less power than multiple single-core chips, an important issue for mobile devices as well as laptops. Dual-core September 12, 2024 OS: Intro 23 Single-Core vs Multi-Core September 12, 2024 OS: Intro 24 -- Clustered Systems … ◼ Like multiprocessor systems, but multiple systems working together ◼ Usually sharing storage via a storage-area network (SAN) ◼ Provides a high-availability service which survives failures ◼ Asymmetric clustering has one machine in hot-standby mode ◼ Symmetric clustering has multiple nodes running applications, monitoring each other September 12, 2024 OS: Intro 25 --- Clustered Systems September 12, 2024 OS: Intro 26 -- Operating System Structure ◼ Single User OS ◼ Multiprogramming ◼ Timesharing September 12, 2024 OS: Intro 27 --- Single User OS ◼ Only one user program is loaded to the memory ◼ When the user process is waiting for I/O, the CPU is idle ◼ When the user process is using the CPU, the I/O devices are idle. September 12, 2024 OS: Intro 28 --- Multiprogramming ◼ Multiprogramming is needed for efficiency ◼ Single user cannot keep CPU and I/O devices busy at all times ◼ Multiprogramming organizes jobs (code and data) so CPU always has one to execute ◼ A subset of total jobs in system is kept in memory ◼ One job selected and run via job scheduling ◼ When it has to wait (for I/O for example), OS switches to another job September 12, 2024 OS: Intro 29 ---- Memory Layout for Multiprogrammed System September 12, 2024 OS: Intro 30 --- Timesharing OS ◼ Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing ◼ Response time should be < 1 second ◼ Each user has at least one program executing in memory process ◼ If several jobs ready to run at the same time CPU scheduling ◼ If processes don’t fit in memory, swapping moves them in and out to run ◼ Virtual memory allows execution of processes not completely in memory September 12, 2024 OS: Intro 31 - Computer Startup ◼ bootstrap program is loaded at power-up or reboot ◼ Typically stored in ROM or EPROM, generally known as firmware ◼ Initializes all aspects of system ◼ Loads operating system kernel and starts execution ◼ Note: Kernel is the main part of an OS that is always kept in memory. September 12, 2024 OS: Intro 32 - Operating System Operations ◼ Interrupts ◼ Dual mode ◼ Timer September 12, 2024 OS: Intro 33 -- Interrupts ◼ Hardware Interrupts: ◼ Are regenerated by hardware ◼ Example: Completion of I/O ◼ Software interrupts ◼ Error or request creates exception or trap ◼ Example, Division by zero, request for operating system service ◼ Other process problems include infinite loop, processes modifying each other or the operating system September 12, 2024 OS: Intro 34 -- Dual-Mode … ◼ Dual-mode operation allows OS to protect itself and other system components ◼ User mode and kernel mode ◼ Mode bit provided by hardware ◼ Provides ability to distinguish when system is running user code or kernel code ◼ Some instructions designated as privileged, only executable in kernel mode ◼ System call changes mode to kernel, return from call resets it to user September 12, 2024 OS: Intro 35 … -- Dual-Mode September 12, 2024 OS: Intro 36 -- Timer ◼ The OS must maintain control over the CPU. A user program cannot be allowed to get stuck in an infinite loop or to fail to call system services and never return control to the OS. ◼ To accomplish this, timer can be used. A timer can be set to interrupt the computer after a specified period. ◼ Set interrupt after specific period ◼ The OS decrements counter ◼ When counter is zero an interrupt is generated ◼ Set up before scheduling process to regain control or terminate program that exceeds allotted time September 12, 2024 OS: Intro 37 - Operating System Main Functions ◼ Process Management ◼ Memory Management ◼ Storage Management ◼ I/O Subsystems ◼ Protection and Security September 12, 2024 OS: Intro 38 - Kernel Data Structures ◼ Linked lists (single, double, circular) ◼ Stacks ◼ Queues ◼ Trees ◼ Hash functions ◼ Bitmaps September 12, 2024 OS: Intro 39 - Computing Environments ◼ Traditional Computer ◼ Mobile Computing ◼ Distributed Systems ◼ Client-server Computing ◼ Peer-to-peer Computing ◼ Virtualization ◼ Cloud Computing ◼ Real-Time Embedded Systems September 12, 2024 OS: Intro 40 -- Virtualization ◼ Virtualization is a technology that allows us to abstract the hardware of a single computer (the CPU, memory, disk drives, network interface cards, and so forth) into several different execution environments, thereby creating the illusion that each separate environment is running on its own private computer. ◼ A virtual machine provides an interface identical to the underlying bare hardware ◼ Each guest provided with a (virtual) copy of underlying computer September 12, 2024 OS: System Structures 41 -- Virtual Machines Non-virtual Machine Virtual Machine (a) Nonvirtual machine (b) virtual machine September 12, 2024 OS: System Structures 42 -- Virtual Machines History and Benefits ◼ First appeared commercially in IBM mainframes in 1972 ◼ Fundamentally, multiple execution environments (different operating systems) can share the same hardware ◼ Some sharing of file can be permitted ◼ Useful for development, testing ◼ Consolidation of many low-resource use systems onto fewer busier systems ◼ Virtual machine manager (VMM) runs the guest operating systems, manages their resource use, and protects each guest from the others. September 12, 2024 OS: System Structures 43 - Summary ◼ Introduction ◼ What OS do? ◼ OS Roles ◼ Computer-System Structure: Application programs, OS, HW, Users ◼ Computer-System Organization ◼Basic Facts: CPU and I/O can work in parallel, each device has a controller, etc.. ◼ Interrupts ◼ I/O Structures ◼ Storage Structures ◼ Caching ◼ DMA ◼ Computer-System Architecture: ◼ Single Processor systems ◼ Multiprocessors systems ◼ Clustered systems September 12, 2024 OS: Intro 44 … - Summary ◼ Operating-System Operations ◼ Interrupts ◼ Dual mode ◼ Timer ◼ Operating-System Organization ◼ Single user OS ◼ Multiprogramming ◼ Time Sharing ◼ Operating System Main Functions: ◼ Process Management ◼ Memory Management ◼ Storage Management ◼ Protection and Security ◼ etc ◼ Computing Environments ◼ Traditional Computer ◼ Client-server Computing ◼ Peer-to-peer Computing ◼ Web-based Computing ◼ Cloud Computing ◼ etc September 12, 2024 OS: Intro 45 Reading List ◼ 1.1 to 1.7, 1.9, 1.10 September 12, 2024 OS: System Structures 46 Disclaimer ◼ Parts of the lecture slides contain original work of Abraham Silberschatz, Peter B. Galvin, Greg Gagne, Andrew S. Tanenbaum, and Gary Nutt. The slides are intended for the sole purpose of instruction of Operating Systems course at KFUPM. All copyrighted materials belong to their original owner(s). September 12, 2024 OS: System Structures 47 End of Chapter 1 Operating System Concepts – 10h Edition Silberschatz, Galvin and Gagne ©2018