OS_Ch01.pdf
Document Details
Uploaded by ResoluteChalcedony1366
Full Transcript
Operating Systems Chapter 1: Introduction Dr. Safa A.ELaskary Electrical Department, Faculty of Engineering Alexandria University FALL 2024-2025 1 Lectures Reference FALL 2024-2025 2 LAB OS Version 9.10 FALL 20...
Operating Systems Chapter 1: Introduction Dr. Safa A.ELaskary Electrical Department, Faculty of Engineering Alexandria University FALL 2024-2025 1 Lectures Reference FALL 2024-2025 2 LAB OS Version 9.10 FALL 2024-2025 3 LAB Reference FALL 2024-2025 4 Course Objectives To describe the basic organization of computer systems. To describe the services an operating system provides to users, processes, and other systems. To discuss the various ways of structuring an operating system. To introduce the notion of a process and a thread. To introduce CPU scheduling, which is the basis for multiprogrammed operating systems. To develop a description of deadlocks. To provide a detailed description of various ways of organizing memory hardware. FALL 2024-2025 5 Course Syllabus Introduction. Operating-System Structures. Processes. Threads. CPU Scheduling. Process Synchronization. Deadlocks. Main Memory Management. FALL 2024-2025 6 Chapter 1: Introduction 1. Computer System Structure. 2. What is an Operating System? 3. What Operating Systems Do? 4. Computer System Organization. 5. Storage Structure. 6. Multiprocessing Architecture. 7. Operating-System Operations. 8. Protection and Security. 9. Computing Environments. FALL 2024-2025 7 1.Computer System Structure Computer systems can be divided into four components: Hardware – provides basic computing resources CPU, memory, I/O devices Operating system Controls and coordinates use of hardware among various applications and users Application programs define the ways in which the system resources are used to solve the computing problems of the users. Ex. Word processors, compilers, web browsers, database systems, video games. Users People, machines, other computers FALL 2024-2025 8 FALL 2024-2025 9 2. What is an Operating System? An operating system is a program that manages a computer’s hardware. It also provides a basis for application programs and acts as an intermediary between the computer user and the computer hardware. FALL 2024-2025 10 2. What is an Operating System? Operating system goals: Execute user programs and make solving user problems easier. Make the computer system convenient to use. Use the computer hardware in an efficient manner. FALL 2024-2025 11 3. What Operating Systems Do? 1.User View Users want convenience, ease of use and good performance. Don’t care about resource utilization. But shared computer such as mainframe or minicomputer must keep all users happy. FALL 2024-2025 12 3. What Operating Systems Do? 2. System View From the computer’s point of view, the operating system is the program most intimately involved with the hardware. In this context, we can view an operating system as a resource allocator. A computer system has many resources that may be required to solve a problem: CPU time, memory space, file-storage space, I/O devices, and so on. The operating system acts as the manager of these resources. FALL 2024-2025 13 3. What Operating Systems Do? 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. FALL 2024-2025 14 3. What Operating Systems Do? A more common definition, and the one that we usually follow, is that the operating system is the one program running at all times on the computer—usually called the kernel. (Along with the kernel, there are two other types of programs: system programs, which are associated with the operating system but are not necessarily part of the kernel, and application programs, which include all programs not associated with the operation of the system.) FALL 2024-2025 15 4. 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 to shared memory. FALL 2024-2025 16 4. Computer System Organization Computer Startup (1/2) bootstrap program is loaded at power-up or reboot Typically stored in ROM or electrically erasable programmable read-only memory (EPROM), generally known as firmware. Initializes all aspects of system. Loads operating system kernel and starts execution. FALL 2024-2025 17 4. Computer System Organization Computer Startup (2/2) FALL 2024-2025 18 4. Computer System Organization Computer Startup (2/2) FALL 2024-2025 19 Interrupts (1/2) The occurrence of an event is usually signaled by an interrupt from either the hardware or the software. Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually by way of the system bus. Software may trigger an interrupt by executing a special operation called a system call (also called a monitor call). Interrupts are an important part of a computer architecture. Each computer design has its own interrupt mechanism, but several functions are common. FALL 2024-2025 20 Interrupts (2/2) Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines. Interrupt architecture must save the address of the interrupted instruction. A trap or exception is a software-generated interrupt caused either by an error or a user request. An operating system is interrupt driven. FALL 2024-2025 21 5. Storage Structure The basic unit of computer storage is the bit. A bit can contain one of two Review values, 0 and 1. All other storage in a computer is based on collections of bits. Given enough bits, it is amazing how many things a computer can represent: numbers, letters, images, movies, sounds, documents, and programs, to name a few. A byte is 8 bits, and on most computers it is the smallest convenient chunk of storage. For example, most computers don’t have an instruction to move a bit but do have one to move a byte. A less common term is word, which is a given computer architecture’s native unit of data. A word is made up of one or more bytes. For example, a computer that has 64-bit registers and 64- bit memory addressing typically has 64-bit (8-byte) words. A computer executes many operations in its native word size rather than a byte at a time. Computer storage, along with most computer throughput, is generally measured and manipulated in bytes and collections of bytes. A kilobyte, or KB, is 1,024 bytes a megabyte, or MB, is 1,0242 bytes a gigabyte, or GB, is 1,0243 bytes a terabyte, or TB, is 1,0244 bytes a petabyte, or PB, is 1,0245 bytes Computer manufacturers often round off these numbers and say that a megabyte is 1 million bytes and a gigabyte is 1 billion bytes. Networking measurements are an exception to this general rule; they are given in bits (because networks move data a bit at a time). FALL 2024-2025 22 5. Storage Structure 1. Main memory – only large storage media that the CPU can access directly. Random access Typically volatile 2. Secondary storage – extension of main memory that provides large nonvolatile storage capacity. FALL 2024-2025 23 5. Storage Structure 3. Hard disks – rigid metal or glass platters covered with magnetic recording material. Disk surface is logically divided into tracks, which are subdivided into sectors. The disk controller determines the logical interaction between the device and the computer. 4. Solid-state disks (SSD)– faster than hard disks, nonvolatile. Various technologies. Becoming more popular. FALL 2024-2025 24 5. Storage Structure Storage systems organized in hierarchy Speed Cost Volatility FALL 2024-2025 25 Levels of Storage FALL 2024-2025 26 How a Modern Computer Works? FALL 2024-2025 27 6. Multiprocessing Architecture Multiprocessors systems growing in use and importance Also known as parallel systems. Advantages include: 1. Increased throughput: by increasing the number of processors, we expect to get more work done in less time. 2. Economy of scale: Multiprocessor systems can cost less than equivalent multiple single-processor systems, because they can share peripherals, mass storage, and power supplies. 3. Increased reliability: graceful degradation or fault tolerance. FALL 2024-2025 28 6. Multiprocessing Architecture Multiprocessors systems growing in use and importance Two types: 1. Asymmetric Multiprocessing – each processor is assigned a specie task. 2. Symmetric Multiprocessing – each processor performs all tasks. FALL 2024-2025 29 6. Multiprocessing Architecture Symmetric multiprocessing FALL 2024-2025 30 7. Operating-System Operations (1/4) Interrupt driven (hardware and software) Hardware interrupt by one of the devices Software interrupt (exception or trap): Software error (e.g., division by zero ) Request for operating system service (memory usage) Other process problems include infinite loop, processes modifying each other or the operating system FALL 2024-2025 31 7.Operating-System Operations (2/4) Dual-mode operation allows OS to protect itself and other system components User mode (up - system and application software) kernel mode (down - also called supervisor mode, system mode, or privileged mode). FALL 2024-2025 32 7. Operating-System Operations (3/4) A bit, called the mode bit, is added to the hardware of the computer to indicate the current mode: kernel (0) user (1). Provides ability to distinguish when system is running user code or kernel code. Some instructions designated as privileged or distinguishable , only executable in kernel mode. System call changes mode to kernel, return from call resets it to user. FALL 2024-2025 33 7. Operating-System Operations (4/4) Transition from User to Kernel Mode FALL 2024-2025 34 8. Protection and Security Any OS must have tools for security and protection Protection – any mechanism for controlling access of processes or users to resources defined by the OS. Security – defense of the system against internal and external attacks. Huge range, including denial-of-service, worms, viruses, etc. FALL 2024-2025 35 9. Computing Environments The current trend is toward providing more ways to access these computing environments. Companies establish portals, which provide Web accessibility to their internal servers. Network computers (or thin clients) — which are essentially terminals that understand web-based computing — are used in place of traditional workstations where more security or easier maintenance is desired. Mobile computers interconnect via wireless networks. FALL 2024-2025 36 9.Computing Environments Distributed computing: Collection of separate, possibly heterogeneous, systems networked together Network is a communications path, Local Area Network (LAN) Wide Area Network (WAN) Metropolitan Area Network (MAN) Personal Area Network (PAN) Network Operating System provides features between systems across network. FALL 2024-2025 37 9.Computing Environments Client-Server Computing FALL 2024-2025 38 9.Computing Environments Peer-to-Peer FALL 2024-2025 39 Dr. Safa A.Elaskary FALL 2024-2025 40