Operating System Concepts Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.

Slides:



Advertisements
Similar presentations
Computer-System Structures Er.Harsimran Singh
Advertisements

Computer System Organization Computer-system operation – One or more CPUs, device controllers connect through common bus providing access to shared memory.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures
1/23/2004CSCI 315 Operating Systems Design1 Computer System Structures Notice: The slides for this lecture have been largely based on those accompanying.
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
ICS Principles of Operating Systems
Abhinav Kamra Computer Science, Columbia University 2.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 2: Computer-System Structures.
Midterm Tuesday October 23 Covers Chapters 3 through 6 - Buses, Clocks, Timing, Edge Triggering, Level Triggering - Cache Memory Systems - Internal Memory.
Modified from Silberschatz, Galvin and Gagne ©2009 CS 446/646 Principles of Operating Systems Lecture 1 Chapter 1: Introduction.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
Computer-System Structures
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures 1/31/03 Computer System Operation I/O Structure.
A. Frank - P. Weisberg Operating Systems Functional View of Operating System.
1/21/2010CSCI 315 Operating Systems Design1 Computer System Structures Notice: The slides for this lecture have been largely based on those accompanying.
Chapter 2: Computer-System Structures
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 1: Introduction.
Objectives To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization.
Operating Systems Lecture 3 Computer Systems Review
Chapter 1. Introduction What is an Operating System? Mainframe Systems
2.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 2: Computer-System Structures Computer System Operation I/O Structure.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures
Thanks to Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2 Computer-System Structures n Computer System Operation n I/O Structure.
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
2: Computer-System Structures
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Chapter 1: Introduction. 1.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 1: Introduction What Operating Systems Do (previous.
Chapter 2: Computer-System Structures 2.1 Computer System Operation 2.5 Hardware Protection 2.6 Network Structure.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
Chapter 1: Introduction. 1.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 1: Introduction What Operating Systems Do Computer-System.
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
2.1 Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General.
Operating Systems Lecture November 2015© Copyright Virtual University of Pakistan 2 Agenda for Today Review of previous lecture Hardware (I/O, memory,
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 4 Computer Systems Review.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
BIT213,CISY Operating Systems 1
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Review of Computer System Organization. Computer Startup For a computer to start running when it is first powered up, it needs to execute an initial program.
OSes: 2. Structs 1 Operating Systems v Objective –to give a (selective) overview of computer system architectures Certificate Program in Software Development.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures(Hardware) or Architecture or Organization Computer System Operation I/O Structure Storage Structure Storage Hierarchy.
Chapter 2. Computer-System Structure Device controllers: synchronize and manage access to devices.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edit9on Lecture 3 Chapter 1: Introduction Provided & Updated by Sameer Akram.
27/06/ :59:33 CSC Alliance — 1 Kimera Richard Phone: INSTITUTE OF COMPUTER SCIENCE DEPARTMENT.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Computer-System Architecture
Module 2: Computer-System Structures
Lecturer Bilal Alqudah, PhD
Operating Systems Lecture 3.
Module 2: Computer-System Structures
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Module 2: Computer-System Structures
Presentation transcript:

Operating System Concepts Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University

2Ku-Yaw ChangChapter 2 Computer-System Structures Chapter 2 Computer System Structures General knowledge of the structure of a computer system System startup System startup I/O I/O Storage Storage Hardware protection Hardware protection Network structure Network structure

3Ku-Yaw ChangChapter 2 Computer-System Structures Chapter 2 Computer System Structures 1.Computer-System Operation 2.I/O Structure 3.Storage Structure 4.Storage Hierarchy 5.Hardware Protection 6.Network Structure 7.Summary 8.Exercises

4Ku-Yaw ChangChapter 2 Computer-System Structures 2.1 Computer-System Operation General-purpose computer system Consist of Consist of A CPU A number of device controllers Access to shared memory Access to shared memory A common bus Execute simultaneously Execute simultaneously Competing for memory cycles

5Ku-Yaw ChangChapter 2 Computer-System Structures A modern computer system

6Ku-Yaw ChangChapter 2 Computer-System Structures Bootstrap program An initial program to run Tend to be simple Tend to be simple Stored in ROM (Firmware or EEPROM) Stored in ROM (Firmware or EEPROM) Startup procedure Locate and load the OS kernel into memory Locate and load the OS kernel into memory Start executing the OS kernel Start executing the OS kernel Executing first process, such as “init” Waiting for some event to occur

7Ku-Yaw ChangChapter 2 Computer-System Structures Interrupt Driven An event is signaled by an interrupt from Hardware Hardware Send a signal to CPU Software – a special operation Software – a special operation a system call ( a monitor call) A trap (or an exception) is a software- generated interrupt caused by An error ( ex. division by zero) An error ( ex. division by zero) A specific request from a user program A specific request from a user program

8Ku-Yaw ChangChapter 2 Computer-System Structures Interrupt Driven For each type of interrupt, an interrupt service routine is provided to deal with the interrupt. When the CPU is interrupted, it stops what it is doing and immediately transfers execution to a fixed location. When the CPU is interrupted, it stops what it is doing and immediately transfers execution to a fixed location. The fixed location contains the starting address where the service routine for the interrupt is located. The fixed location contains the starting address where the service routine for the interrupt is located. The interrupt service routine executes. The interrupt service routine executes. On completion, the CPU resumes the interrupted computation. On completion, the CPU resumes the interrupted computation.

9Ku-Yaw ChangChapter 2 Computer-System Structures Interrupt time line for a single process doing output

10Ku-Yaw ChangChapter 2 Computer-System Structures Interrupt Vector Interrupts must be handled quickly A predefined number of interrupts is possible A predefined number of interrupts is possible A table of pointers to interrupt routines A table of pointers to interrupt routines Interrupt vector Stored in low memory Indexed by a unique device number Save the address of the interrupted instruction Fixed location Fixed location A location indexed by the device number A location indexed by the device number System stack System stack

11Ku-Yaw ChangChapter 2 Computer-System Structures Chapter 2 Computer System Structures 1.Computer-System Operation 2.I/O Structure 3.Storage Structure 4.Storage Hierarchy 5.Hardware Protection 6.Network Structure 7.Summary 8.Exercises

12Ku-Yaw ChangChapter 2 Computer-System Structures I/O Interrupts Start an I/O operation The CPU loads the registers within the device controller. The CPU loads the registers within the device controller. The device controller examines the registers to determine what actions to take. The device controller examines the registers to determine what actions to take. I/O in progress I/O in progress The device controller informs the CPU The device controller informs the CPU Triggering an interrupt

13Ku-Yaw ChangChapter 2 Computer-System Structures Synchronous I/O After I/O starts, control returns to user program only upon I/O completion. Wait instruction idles the CPU until the next interrupt Wait instruction idles the CPU until the next interrupt Wait loop (contention for memory access). Wait loop (contention for memory access). At most one I/O request is outstanding at a time, no simultaneous I/O processing. At most one I/O request is outstanding at a time, no simultaneous I/O processing.

14Ku-Yaw ChangChapter 2 Computer-System Structures Asynchronous I/O After I/O starts, control returns to user program without waiting for I/O completion. System call – request to the operating system to allow user to wait for I/O completion. System call – request to the operating system to allow user to wait for I/O completion. Device-status table contains entry for each I/O device indicating its type, address, and state. Device-status table contains entry for each I/O device indicating its type, address, and state. Operating system indexes into I/O device table to determine device status and to modify table entry to include interrupt. Operating system indexes into I/O device table to determine device status and to modify table entry to include interrupt.

15Ku-Yaw ChangChapter 2 Computer-System Structures Two I/O methods (a) Synchronous(b) Asynchronous

16Ku-Yaw ChangChapter 2 Computer-System Structures Device-status table

17Ku-Yaw ChangChapter 2 Computer-System Structures 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. Cycle stealing DMA controller “steals” memory cycles from the CPU. DMA controller “steals” memory cycles from the CPU.

18Ku-Yaw ChangChapter 2 Computer-System Structures Chapter 2 Computer System Structures 1.Computer-System Operation 2.I/O Structure 3.Storage Structure 4.Storage Hierarchy 5.Hardware Protection 6.Network Structure 7.Summary 8.Exercises

19Ku-Yaw ChangChapter 2 Computer-System Structures 2.3 Storage Structure Main memory Also called random-access memory or RAM Also called random-access memory or RAM Computer programs must reside in The only large area the CPU can access directly An array of memory words An array of memory words load and store Specific memory addresses Specific memory addresses Von Neumann architecture Instruction register Instruction register Other internal registers Other internal registers

20Ku-Yaw ChangChapter 2 Computer-System Structures 2.3 Storage Structure Ideally, programs and data reside in main memory permanently. Not possible, because Not possible, because Main memory is too small Main memory is a volatile storage Second storage An extension of main memory An extension of main memory The most common device is a magnetic disk The most common device is a magnetic disk

21Ku-Yaw ChangChapter 2 Computer-System Structures Main Memory CPU can access directly Main memory Main memory Registers built in the processor Registers built in the processorCache Fast memory between the CPU and main memory Fast memory between the CPU and main memory Memory-mapped I/O Ranges of memory addresses are mapped to the device registers. Ranges of memory addresses are mapped to the device registers. Devices have fast response times, such as video controllers.

22Ku-Yaw ChangChapter 2 Computer-System Structures Magnetic Disks The bulk of secondary storage for modern computer system. Disk platter Disk platter A flat circular shape like a CD Covered with a magnetic material Consists of Tracks Tracks Sectors Sectors Cylinders Cylinders Disk arm Disk arm

23Ku-Yaw ChangChapter 2 Computer-System Structures Moving-head disk mechanism

24Ku-Yaw ChangChapter 2 Computer-System Structures Magnetic Tapes Early secondary-storage medium Features Relatively permanent Relatively permanent Hold large quantities of data Hold large quantities of data Access time is slow Access time is slowPurposes Backup Backup Storage of infrequently used information Storage of infrequently used information Transferring system information Transferring system information

25Ku-Yaw ChangChapter 2 Computer-System Structures Chapter 2 Computer System Structures 1.Computer-System Operation 2.I/O Structure 3.Storage Structure 4.Storage Hierarchy 5.Hardware Protection 6.Network Structure 7.Summary 8.Exercises

26Ku-Yaw ChangChapter 2 Computer-System Structures 2.4 Storage Hierarchy Wide variety of storage systems can be organized in a hierarchy according to Speed Speed Cost Cost Volatility Volatility Volatile storage Lose contents when the power is removed Lose contents when the power is removed Ex. register, cache, main memory Ex. register, cache, main memory Non-volatile storage Keep contents all the time Keep contents all the time Ex. magnetic disk, optical disk, magnetic tapes Ex. magnetic disk, optical disk, magnetic tapes

27Ku-Yaw ChangChapter 2 Computer-System Structures Storage-device hierarchy

28Ku-Yaw ChangChapter 2 Computer-System Structures Caching Use of high-speed memory to hold recently-accessed data. Requires a cache management policy. Caching introduces another level in storage hierarchy. This requires data that is simultaneously stored in more than one level to be consistent. This requires data that is simultaneously stored in more than one level to be consistent.

29Ku-Yaw ChangChapter 2 Computer-System Structures Migration of integer A from disk to register The same data may appear in different levels of the storage system Coherency and Consistency

30Ku-Yaw ChangChapter 2 Computer-System Structures Only one process at a time The highest level of the hierarchy The highest level of the hierarchyMultitasking Extreme care must be taken Extreme care must be takenMultiprocessor Cache coherency (hardware problem) Cache coherency (hardware problem) A copy of A may exist in several caches Distributed environment Consistency Consistency Several copies (replicas) on different computers Coherency and Consistency

31Ku-Yaw ChangChapter 2 Computer-System Structures Chapter 2 Computer System Structures 1.Computer-System Operation 2.I/O Structure 3.Storage Structure 4.Storage Hierarchy 5.Hardware Protection 6.Network Structure 7.Summary 8.Exercises

32Ku-Yaw ChangChapter 2 Computer-System Structures 2.5 Hardware Protection Early computer systems Single-user programmer-operated systems Single-user programmer-operated systems Operating systems were called resident monitors Operating systems were called resident monitors Sharing system resources Improve utilization Improve utilization Increase problems Increase problems Many processes could be affected by a bug in one program. All output must be suspect Many programming errors Detected by the hardware Detected by the hardware Handled by the operating system Handled by the operating system

33Ku-Yaw ChangChapter 2 Computer-System Structures 2.5 Hardware Protection Dual-Mode Operation I/O Protection Memory Protection CPU Protection

34Ku-Yaw ChangChapter 2 Computer-System Structures Dual-Mode Operation Sharing system resources OS ensures that an incorrect program cannot cause other programs to execute incorrectly. OS ensures that an incorrect program cannot cause other programs to execute incorrectly. Provide hardware support to differentiate between at least two modes of operations. 1.User mode – execution done on behalf of the user. 2.Monitor mode (also kernel mode, system mode, or privileged mode) – execution done on behalf of the operating system.

35Ku-Yaw ChangChapter 2 Computer-System Structures Dual-Mode Operation Mode bit - A bit added to the hardware to indicate the current mode: Monitor (0) Monitor (0) User (1) User (1) Whenever a trap or interrupt occurs, the hardware switches from user mode to monitor mode. At boot time, the hardware starts in monitor mode. At boot time, the hardware starts in monitor mode. OS runs in monitor mode. OS runs in monitor mode. User programs run in user mode. User programs run in user mode.

36Ku-Yaw ChangChapter 2 Computer-System Structures Dual-Mode Operation Privileged instructions May cause harm May cause harm Executed only in the monitor mode Executed only in the monitor mode By the OS Known as a system call ( also a monitor call or an OS function call) Known as a system call ( also a monitor call or an OS function call) monitoruser Trap/Interrupt set user mode

37Ku-Yaw ChangChapter 2 Computer-System Structures I/O Protection All I/O instructions are defined to be privileged instructions. The user program executes a system call to request an I/O. The user program executes a system call to request an I/O. OS can check if the I/O request is valid or not OS can check if the I/O request is valid or not If valid, OS does the I/O request, and returns to the user. If valid, OS does the I/O request, and returns to the user. Must ensure that a user program could never gain control of the computer in monitor mode (i.e., a user program that, as part of its execution, stores a new address in the interrupt vector).

38Ku-Yaw ChangChapter 2 Computer-System Structures Use of a system call to perform I/O

39Ku-Yaw ChangChapter 2 Computer-System Structures Memory Protection Must provide memory protection at least for Interrupt vector Interrupt vector Interrupt-service routines Interrupt-service routines Such protection must be provided by the hardware. One possible implementation One possible implementation Base register The smallest legal physical memory address The smallest legal physical memory address Limit register The size of the range The size of the range

40Ku-Yaw ChangChapter 2 Computer-System Structures Use of a base and limit register

41Ku-Yaw ChangChapter 2 Computer-System Structures Hardware address protection with base and limit registers

42Ku-Yaw ChangChapter 2 Computer-System Structures CPU Protection A timer interrupts computer after specified period to ensure operating system maintains control. interrupts computer after specified period to ensure operating system maintains control. The OS sets the counter. The OS sets the counter. Be decremented every clock tick. When the counter reaches the value 0, an interrupt occurs. When the counter reaches the value 0, an interrupt occurs. Timer instructions are privileged.

43Ku-Yaw ChangChapter 2 Computer-System Structures CPU Protection Functionality Prevent a user program from running too long Prevent a user program from running too long Implement time sharing. Implement time sharing. The time slice Compute the current time. Compute the current time.

44Ku-Yaw ChangChapter 2 Computer-System Structures Chapter 2 Computer System Structures 1.Computer-System Operation 2.I/O Structure 3.Storage Structure 4.Storage Hierarchy 5.Hardware Protection 6.Network Structure 7.Summary 8.Exercises

45Ku-Yaw ChangChapter 2 Computer-System Structures 2.6 Network Structure Two basic types of networks LAN: local-area network LAN: local-area network Small geographical areas Higher speed and lower error rate 10BaseT Ethernet: 10 megabits per second 10BaseT Ethernet: 10 megabits per second 100BaseT Ethernet: 100 megabits per second 100BaseT Ethernet: 100 megabits per second Gigabit Ethernet: 1 gigabits per second Gigabit Ethernet: 1 gigabits per second WAN: wide-area network WAN: wide-area network Large geographical areas Slow and unreliable T1: megabits per second T1: megabits per second T3 (28 T1 connections) : 45 megabits per second T3 (28 T1 connections) : 45 megabits per second

46Ku-Yaw ChangChapter 2 Computer-System Structures Local-area network

47Ku-Yaw ChangChapter 2 Computer-System Structures Communication processors in a wide-area network

48Ku-Yaw ChangChapter 2 Computer-System Structures Chapter 2 Computer System Structures 1.Computer-System Operation 2.I/O Structure 3.Storage Structure 4.Storage Hierarchy 5.Hardware Protection 6.Network Structure 7.Summary 8.Exercises

49Ku-Yaw ChangChapter 2 Computer-System Structures Summary P.51 – P.52

50Ku-Yaw ChangChapter 2 Computer-System Structures Chapter 2 Computer System Structures 1.Computer-System Operation 2.I/O Structure 3.Storage Structure 4.Storage Hierarchy 5.Hardware Protection 6.Network Structure 7.Summary 8.Exercises

51Ku-Yaw ChangChapter 2 Computer-System Structures Exercises

The End