CS370 Operating Systems

Similar documents
Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Operating Systems 4 th Class

Computer-System Architecture

1. Computer System Structure and Components

CSC 2405: Computer Systems II

Chapter 1: Introduction. Chapter 1: Introduction. Operating System Concepts, 7th Edition. Objectives

Operating Systems Overview

Lecture 1 Operating System Overview

Have both hardware and software. Want to hide the details from the programmer (user).

Operating Systems. Lecture 03. February 11, 2013

Chapter 2: Computer-System Structures. Computer System Operation Storage Structure Storage Hierarchy Hardware Protection General System Architecture

Operating Systems Prof. Ashok K Agrawala

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

COS 318: Operating Systems. I/O Device and Drivers. Input and Output. Definitions and General Method. Revisit Hardware

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-17: Memory organisation, and types of memory

Introduction. What is an Operating System?

Chapter 1 Computer System Overview

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

How To Understand And Understand An Operating System In C Programming

Storage. The text highlighted in green in these slides contain external hyperlinks. 1 / 14

Chapter 11 I/O Management and Disk Scheduling

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

CS161: Operating Systems

Chapter 1: Introduction. Operating System Concepts 9 th Edit9on

Chapter 11: Input/Output Organisation. Lesson 06: Programmed IO

lesson 1 An Overview of the Computer System

Chapter 2: OS Overview

I/O Device and Drivers

Linux Driver Devices. Why, When, Which, How?

Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu

Virtual vs Physical Addresses

Operating System Structures

Computer Organization & Architecture Lecture #19

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Chapter 6, The Operating System Machine Level

Operating System Organization. Purpose of an OS

How to design and implement firmware for embedded systems

Exception and Interrupt Handling in ARM

Input / Output and I/O Strategies

Operating System Tutorial

Main Memory & Backing Store. Main memory backing storage devices

SYSTEM ecos Embedded Configurable Operating System

Chapter 3 Operating-System Structures

Computer Organization. and Instruction Execution. August 22

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

Types Of Operating Systems

MICROPROCESSOR AND MICROCOMPUTER BASICS

Central Processing Unit

Chapter 1: Introduction. What is an Operating System?

POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2)

Overview of Operating Systems Instructor: Dr. Tongping Liu

COS 318: Operating Systems. Virtual Machine Monitors

- Nishad Nerurkar. - Aniket Mhatre

Architecture of Hitachi SR-8000

CHAPTER 15: Operating Systems: An Overview

I/O. Input/Output. Types of devices. Interface. Computer hardware

Traditional IBM Mainframe Operating Principles

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Operating Systems: Basic Concepts and History

Microprocessor & Assembly Language

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

Intel DPDK Boosts Server Appliance Performance White Paper

Operating System Overview. Otto J. Anshus

SAN Conceptual and Design Basics

Hello, and welcome to this presentation of the STM32 SDMMC controller module. It covers the main features of the controller which is used to connect

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

Chapter 11: File System Implementation. Operating System Concepts with Java 8 th Edition

Chapter 3: Operating-System Structures. Common System Components

Operating Systems Introduction

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

Computer Systems Structure Input/Output

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

Operating System Impact on SMT Architecture

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

Operating System Fundamentals Robert Power & Robert Ford

Operating system Dr. Shroouq J.

Secondary Storage. Any modern computer system will incorporate (at least) two levels of storage: magnetic disk/optical devices/tape systems

CHAPTER 4 MARIE: An Introduction to a Simple Computer

CHAPTER 2: HARDWARE BASICS: INSIDE THE BOX

The Lagopus SDN Software Switch. 3.1 SDN and OpenFlow. 3. Cloud Computing Technology

Lecture 6: Interrupts. CSC 469H1F Fall 2006 Angela Demke Brown

Agenda. Enterprise Application Performance Factors. Current form of Enterprise Applications. Factors to Application Performance.

Devices and Device Controllers

Chapter 3. Operating Systems

A Deduplication File System & Course Review

Outline: Operating Systems

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

Fastboot Techniques for x86 Architectures. Marcus Bortel Field Application Engineer QNX Software Systems

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 5 INPUT/OUTPUT UNIT JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

x64 Servers: Do you want 64 or 32 bit apps with that server?

I/O Management. General Computer Architecture. Goals for I/O. Levels of I/O. Naming. I/O Management. COMP755 Advanced Operating Systems 1

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

An Implementation Of Multiprocessor Linux

The Microsoft Windows Hypervisor High Level Architecture

CHAPTER 7: The CPU and Memory

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Components of a Computer System

Serial Communications

sndio OpenBSD audio & MIDI framework for music and desktop applications

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Transcription:

CS370 Operating Systems Slides based on Text by Silberschatz, Galvin, Gagne Berkeley Operating Systems group S. Pallikara Other sources Yashwant K Malaiya Fall 2015 8/26/15 1 1

What is an Operating System? Referee Manage sharing of resources, Protection, Isolation Resource allocation, isolation, communication Illusionist Provide clean, easy to use abstractions of physical resources Infinite memory, dedicated machine Higher level objects: files, users, messages Masking limitations, virtualization Glue Common services Storage, Window system, Networking Sharing, Authorization Look and feel 2 UCB

A Modern processor: SandyBridge 3 Package: LGA 1155 1155 pins 95W design envelope Cache: L1: 32K Inst, 32K Data (3 clock access) L2: 256K (8 clock access) Shared L3: 3MB 20MB (not out yet) Transistor count: 504 Million (2 cores, 3MB L3) 2.27 Billion (8 cores, 20MB L3) Note that ring bus is on high metal layers above the Shared L3 Cache

Functionality comes with SandyBridge I/O Configuration great complexity! Proc Caches Busses Memory adapters 4 I/O Devices: Controllers Disks Displays Keyboards UCB Networks

What you studied in CS270 Instructions and data fetched from Main Memory using a program counter (PC) Traps and Subroutines Obtaining address to branch to, and coming back Using Stack Frames for holding Prior PC, FP Arguments and local variables Dynamic memory allocation and heap Global data 5

What you studied in CS270 Device interface: Status and data registers User and Supervisor (kernel) modes for processor I/O Device drivers can use polling or interrupt Interrupts need context switch I/O done in supervisor mode System calls invoke device drivers 6

No cache What CS270 text did not include No mention of Direct memory access (DMA) between Main Memory and Disk (or network etc) Transfer by blocks at a time Neglecting the fact that memory access slower than register access Letting program run concurrently (Multiprogramming) or with many threads Multiple processors in the system (like in Multicore) 7

8 System I/O (Chap 13)

I/O Hardware (Cont.) I/O Devices usually have registers where device driver places commands, addresses, and data to write, or read data from registers after command execution Data-in register, data-out register, status register, control register Typically 1-4 bytes, or FIFO buffer Devices have addresses, used by Direct I/O instructions Memory-mapped I/O Device data and command registers mapped to processor address space 9

Polling (remember CS270?) For each byte of I/O 1. Read busy bit from status register until 0 2. Host sets read or write bit and if write copies data into data-out register 3. Host sets command-ready bit 4. Controller sets busy bit, executes transfer 5. Controller clears busy bit, error bit, command-ready bit when transfer done Step 1 is busy-wait cycle to wait for I/O from device Reasonable if device is fast But inefficient if device slow CPU switches to other tasks? But if miss a cycle data overwritten / lost 10

Interrupts Polling can happen in 3 instruction cycles Read status, logical-and to extract status bit, branch if not zero How to be more efficient if non-zero infrequently? CPU Interrupt-request line triggered by I/O device Checked by processor after each instruction Interrupt handler receives interrupts Maskable to ignore or delay some interrupts Interrupt vector to dispatch interrupt to correct handler Context switch at start and end Based on priority Some nonmaskable Interrupt chaining if more than one device at same interrupt number 11

12 Interrupt-Driven I/O Cycle

Interrupts (Cont.) Interrupt mechanism also used for exceptions Terminate process, crash system due to hardware error Page fault executes when memory access error System call executes via trap to trigger kernel to execute request Multi-CPU systems can process interrupts concurrently If operating system designed to handle it Used for time-sensitive processing, frequent, must be fast 13

Direct Memory Access Used to avoid programmed I/O (one byte at a time) for large data movement Requires DMA controller Bypasses CPU to transfer data directly between I/O device and memory OS writes DMA command block into memory Source and destination addresses Read or write mode Count of bytes Writes location of command block to DMA controller Bus mastering of DMA controller grabs bus from CPU Cycle stealing from CPU but still much more efficient When done, interrupts to signal completion 14

15 Six Step Process to Perform DMA Transfer

Application I/O Interface I/O system calls encapsulate device behaviors in generic classes Device-driver layer hides differences among I/O controllers from kernel New devices talking already-implemented protocols need no extra work Each OS has its own I/O subsystem structures and device driver frameworks Devices vary in many dimensions Character-stream or block Sequential or random-access Synchronous or asynchronous (or both) Sharable or dedicated Speed of operation read-write, read only, or write only 16

17 A Kernel I/O Structure

What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware 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 18

19 Four Components of a Computer System

What Operating Systems Do Depends on the point of view Users want convenience, ease of use and good performance Don t care about resource utilization But shared computer must keep all users happy Users of dedicate systems such as workstations have dedicated resources but frequently use shared resources from servers Handheld computers are resource poor, optimized for usability and battery life Some computers have little or no user interface, such as embedded computers in devices and automobiles Not any more 20

Operating System Definition 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 21

Operating System Definition (Cont.) No universally accepted definition Everything a vendor ships when you order an operating system is a good approximation But varies wildly The one program running at all times on the computer is the kernel. Everything else is either a system program (ships with the operating system), or an application program. 22

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 23

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 24

Computer-System Operation I/O devices and the CPU can execute concurrently Each device controller is in charge of a particular device type Each device controller has a local buffer CPU moves data from/to main memory to/from local buffers I/O is from the device to local buffer of controller Device controller informs CPU that it has finished its operation by causing an interrupt 25

Common Functions of Interrupts 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 softwaregenerated interrupt caused either by an error or a user request An operating system is interrupt driven 26

Interrupt Handling The operating system preserves the state of the CPU by storing registers and the program counter Determines which type of interrupt has occurred Separate segments of code determine what action should be taken for each type of interrupt 27

28 Interrupt Timeline

I/O Structure After I/O starts, control returns to user program only upon I/O completion Wait instruction idles the CPU until the next interrupt Wait loop (contention for memory access) At most one I/O request is outstanding at a time, no simultaneous I/O processing After I/O starts, control returns to user program without waiting for I/O completion System call request to the OS 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 OS indexes into I/O device table to determine device status and to modify table entry to include interrupt 29

Storage Definitions and Notation Review A byte is 8 bits, and on most computers. It is the smallest convenient chunk of addressable storage. 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 64-bit processor may not use full 64 bit addresses. A 32-bit address can use up to 2 32 = 4 GB locations. Why? Computer storage, is generally measured and manipulated in bytes A kilobyte, or KB, is 1,024 bytes a megabyte, or MB, is 1,024 2 bytes a gigabyte, or GB, is 1,024 3 bytes a terabyte, or TB, is 1,024 4 bytes a petabyte, or PB, is 1,024 5 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). 30