Operating Systems-2024-2025 Fall Semester PDF
Document Details
EELU - The Egyptian E-Learning University
2024
Dr. Wafaa Samy,Dr. Hanaa Eissa
Tags
Related
Summary
This is a set of lecture notes on operating systems for students at The Egyptian E-Learning University, for the Fall 2024-2025 semester. The content covers topics including chapter introductions, grading information, and general computing concepts. The specific content relates to operating systems.
Full Transcript
Year: 2024-2025 Fall Semester Operating Systems Dr. Wafaa Samy Dr. Hanaa Eissa Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.1 Modified by Dr. Wafaa Samy Chapter 1:...
Year: 2024-2025 Fall Semester Operating Systems Dr. Wafaa Samy Dr. Hanaa Eissa Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.1 Modified by Dr. Wafaa Samy Chapter 1: Introduction (Part 1) Operating System Concepts – 10h Edition Silberschatz, Galvin and Gagne ©2018 Modified by Dr. Wafaa Samy Textbook Operating Systems Concepts (10th edition) by A. Silberschatz, P. B. Galvin and G. Gagne, John Wiley& Sons, 2018. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.3 Modified by Dr. Wafaa Samy Grading Course Work 30 1. Quizzes 20 Quiz (1) 10 Quiz (2) 10 2. Activities 10 Sections attendance 3 Project 4 Practical Exam 3 Midterm Exam 20 Final Exam 50 Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.4 Modified by Dr. Wafaa Samy Chapter 1: Introduction What Operating Systems Do Computer-System Organization Storage Structure Computer-System Architecture Operating-System Operations Resource Management Security and Protection Virtualization Distributed Systems Computing Environments Free/Libre and Open-Source Operating Systems Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.5 Modified by Dr. Wafaa Samy What Operating Systems Do? Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.6 Modified by Dr. Wafaa Samy What is an Operating System? An operating system (OS) is software that manages a computer’s hardware, and A program that acts as an intermediary between a user of a computer and the computer hardware. Operating systems are everywhere like cars, smart phones, personal computers, enterprise computers, etc. Operating Systems Examples: DOS, Unix/Linux, Mac OS, Windows 3.x/9x/NT/2000/XP/Vista/7/8/10, Android, iOS, etc. An operating system simply provides an environment within which other programs can do useful work. Operating system goals: 1. Execute user programs and make solving user problems easier. 2. Make the computer system convenient to use. 3. Use the computer hardware in an efficient manner. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.7 Modified by Dr. Wafaa Samy Computer System Structure Computer system can be divided into four components: 1. Hardware – provides the basic computing resources for the system: Central Processing Unit (CPU), memory, Input/Output (I/O) devices, etc. 2. Operating system Controls the hardware and coordinates its use among the various application programs for the various users. 3. Application programs – define the ways in which the system resources are used to solve the computing problems of the users: Examples of applications: Word processors, compilers, web browsers, database systems, video games, etc. 4. Users People, machines, other computers. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.8 Modified by Dr. Wafaa Samy Four Components of the Computer System Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.9 Modified by Dr. Wafaa Samy Dynamic View of System Components Example: the user wants to print a paper. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.10 Modified by Dr. Wafaa Samy What Operating Systems Do Depends on the point of view: 1. Top Down View (User view). 2. Bottom Up View (System view). Depends on the type of system: workstation, server, mobile device, embedded system, etc. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.11 Modified by Dr. Wafaa Samy What Operating Systems Do (Cont.) 1. User view: The user’s view of the computer varies according to the interface being used. Users of dedicate systems such as workstations (a laptop or a PC) have dedicated resources, the OS is designed mostly for ease of use, performance and security. Users want convenience, ease of use and good performance. They don’t care about resource utilization (how h/w & s/w are shared). Users of workstations frequently use shared resources from servers. Shared computer such as mainframe must keep all users happy. Mobile devices (e.g. smartphones and tablets) are resource poor, optimized for usability and battery life. Mobile user interfaces such as touch screens, and voice recognition. Some computers have little or no user interface, such as embedded computers in home devices and automobiles. Run primarily without user intervention. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.12 Modified by Dr. Wafaa Samy What Operating Systems Do (Cont.) 2. System view: From the computer’s point of view, the operating system is the program most intimately involved with the hardware. OS is a resource allocator making efficient use of hardware (HW): A computer system has many resources: CPU time, memory space, storage space, I/O devices, and so on. There are numerous and possibly conflicting requests for resources. The operating system acts as the manager of the computer resources. It must decide how to allocate resources to specific programs and users so that it can operate the computer system efficiently and fairly. OS is a control program for managing execution of user programs and controlling the various I/O devices to prevent errors and improper use of the computer. e.g. Memory protection if a process tries to access a memory address that does not belong to this process. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.13 Modified by Dr. Wafaa Samy Operating System Definition 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 an operating system”. But the features included varies wildly from one system to another. Some systems take up less than a megabyte of space, whereas others require gigabytes of space and are based entirely on graphical windowing systems. A more common definition, is that the OS is “The one program running at all times on the computer” called the kernel, part of the operating system. Along with the kernel, there are Everything else is either: two other types of programs. 1. A system program (ships with the operating system, but not part of the kernel) , or 2. An application program, all programs not associated with the operating system. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.14 Modified by Dr. Wafaa Samy Computer System Organization Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.15 Modified by Dr. Wafaa Samy Computer System Organization Computer-system operation: One or more CPUs, device controllers connect through common bus providing access to shared memory. Concurrent execution of CPUs and devices competing for memory cycles. a memory controller synchronizes access to the memory. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.16 Modified by Dr. Wafaa Samy Devices and Device Controllers A computer system contains many I/O devices and their respective controllers like: Graphics adapter DVD-ROM controller Disk controller USB controller Network card Sound card etc. Components of a simple personal computer Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.17 Modified by Dr. Wafaa Samy Computer-System Operation I/O devices and the CPU can execute concurrently. Each device controller is in charge of a particular device type (for example, a disk drive, audio device, or graphics display). Each device controller has a local buffer and a set of special- purpose registers. I/O is from the device to local buffer of controller. The controller moves the data between its controlled device(s) and its buffer. CPU moves data from/to main memory to/from local buffers. Each device controller type has an operating system device driver to manage it. Interaction with a device controller is managed through a device driver. Device drivers are part of the operating system, but not necessarily part of the OS kernel. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.18 Modified by Dr. Wafaa Samy A Kernel I/O Structure The device driver manages I/O and provides uniform interface between the device controller and kernel. Device-driver layer hides differences among I/O controllers from kernel. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.19 Modified by Dr. Wafaa Samy Interacting with Device Controllers When interacting with a device controller, the CPU can wait for a response by polling the status register(s) (i.e. by periodically checking whether the status of the device has changed). Problem with polling: The CPU is busy waiting for some event to happen. CPU utilization will be low. Solution: Interrupts. Interrupts are used by devices for asynchronous event notification (these are hardware interrupts). Device controller informs CPU that it has finished its operation by causing an interrupt (i.e. alert the CPU to events that require attention). When an interrupt occurs, the CPU can start reading data from the device controller's data registers. When an Interrupt Occurs: Finish the current instruction. Save minimal state information (i.e. program counter and registers). Transfer to the interrupt handler, also known as the interrupt service routine (ISR). Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.20 Modified by Dr. Wafaa Samy Interrupt Timeline When the CPU is interrupted, it stops what it is doing and immediately transfers execution to a fixed location. 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. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.21 Modified by Dr. Wafaa Samy Interrupt Vector Table Interrupts must be handled quickly, as they occur very frequently. A table of pointers to interrupt routines can be used instead to provide the necessary speed. Generally, the table of pointers is stored in low memory (i.e. the first hundred or so locations). These locations hold the addresses of the interrupt service routines for the various devices. This array, or interrupt vector, of addresses is then indexed by a unique number, given with the interrupt request, to provide the address of the interrupt service routine for the interrupting device. … … Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.22 Modified by Dr. Wafaa Samy Interrupt Handling Common Functions of Interrupts: Interrupt architecture must save the address of the interrupted instruction. The operating system preserves the state of the CPU by storing the registers and the program counter. Determines which type of interrupt has occurred. Separate segments of code (i.e. interrupts handlers) determine what action should be taken for each type of interrupt. When an interrupt is fired, the CPU jumps to a predefined position in the kernel's address space and executes an interrupt handler. Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.23 Modified by Dr. Wafaa Samy Interrupt-drive I/O Cycle 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 device 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 table. It then starts execution at the address associated with that index. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.24 Modified by Dr. Wafaa Samy Software Interrupts An operating system is interrupt driven. If there are no processes to execute, no I/O devices to service, and no users to whom to respond, an operating system will sit quietly, waiting for something to happen. Events are almost always signaled by the occurrence of an interrupt. A trap (or exception) is a software-generated interrupt caused either by: An error (for example, division by zero or invalid memory access), or A specific request from a user program that an operating- system service be performed by executing a special operation called a system call. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.25 Modified by Dr. Wafaa Samy Direct Memory Access (DMA) CPU utilization can be improved even further by allowing a device controller to transfer data from/to main memory without any involvement of the CPU. This is called direct memory access and is used by all modern hard drives (but also sound controllers, network cards, etc.). The CPU initiates the data transfer, but can do other things while the transfer is taking place. CPU utilization is increased. Direct Memory Access 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. Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.26 Modified by Dr. Wafaa Samy How a Modern Computer Works A von Neumann architecture Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.27 Modified by Dr. Wafaa Samy Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 1.28 Modified by Dr. Wafaa Samy