CS 153 Design of Operating Systems Spring 2015 Lecture 2: Intro and Architectural Support for Operating Systems.

Slides:



Advertisements
Similar presentations
CSC 360- Instructor: K. Wu Overview of Operating Systems.
Advertisements

Introduction CSCI 444/544 Operating Systems Fall 2008.
CS 345 Computer System Overview
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Lecture 1: History of Operating System
Operating Systems CS451 Brian Bershad
OS2-1 Chapter 2 Computer System Structures. OS2-2 Outlines Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
OS Spring’03 Introduction Operating Systems Spring 2003.
Chapter 1 and 2 Computer System and Operating System Overview
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
Chapter 3 Overview of Operating Systems Copyright © 2008.
A. Frank - P. Weisberg Operating Systems Evolution of Operating Systems.
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
What do operating systems do? manage processes manage memory and computer resources provide security features execute user programs make solving user.
Introduction and Overview Questions answered in this lecture: What is an operating system? How have operating systems evolved? Why study operating systems?
Chapter 1. Introduction What is an Operating System? Mainframe Systems
Composition and Evolution of Operating Systems Introduction to Operating Systems: Module 2.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Chapter 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.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
1 Chapter 2: Computer-System Structures  Computer System Operation  I/O Structure  Storage Structure  Storage Hierarchy  Hardware Protection  General.
Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection Network Structure.
Operating Systems David Goldschmidt, Ph.D. Computer Science The College of Saint Rose CIS 432.
Chapter 1: Introduction and History  Where does the operating system fit in a computing system?  What does the operating system achieve?  What are the.
CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
Lecture Topics: 10/29 Architectural support for operating systems –timers –kernel mode –system calls –protected instructions.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
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  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
CIS250 OPERATING SYSTEMS Chapter One Introduction.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
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.
OSes: 2. Structs 1 Operating Systems v Objective –to give a (selective) overview of computer system architectures Certificate Program in Software Development.
CSE 153 Design of Operating Systems Winter 2015 Lecture 1: Course Introduction Guest lecturer: Prof. Tom Payne Instructor: Nael Abu-Ghazaleh Slides modified.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 0: Historical Overview.
Chapter 2: Computer-System Structures(Hardware)
Chapter 2: Computer-System Structures
Overview Introduction to Operating Systems
Chapter 1: Introduction
CSE 120 Principles of Operating
Module 2: Computer-System Structures
Operating Systems CSE451 Winter 2000
Architectural Support for OS
CSE 451: Operating Systems Winter 2003 Lecture 1 Course Introduction
Operating Systems CSE451 Spring 2000
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
Operating Systems CS451 Spring 1998
CSE 451: Operating Systems Winter 2007 Module 2 Architectural Support for Operating Systems Brian Bershad 562 Allen Center 1.
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Operating Systems CS451 Fall 1998
Architectural Support for OS
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
CSE 451: Operating Systems Autumn 2003 Lecture 1 Course Introduction
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Module 2: Computer-System Structures
Operating Systems Structure
Lecture Topics: 11/1 Hand back midterms
Presentation transcript:

CS 153 Design of Operating Systems Spring 2015 Lecture 2: Intro and Architectural Support for Operating Systems

Administrivia l your TA about project group u Preferably pick a partner in the same lab (coordination) u You need to have sent us before class next Friday l Reminder: 4% for extra credit and class participation u 2% extra for not using the slack days (at all) 2

Brief History of OS design In the beginning… l OSes were runtime libraries u The OS was just code you linked with your program and loaded into the computer u First computer interface was switches and lights, then punched tape and cards l Batch systems were next u OS was permanently stored in primary memory u It loaded a single job (card reader, mag tape) into memory u Executed job, created output (line printer) u Loaded the next job, repeat… u Card readers, line printers were slow, and CPU was idle while they were being used u MS-DOS: single job at a time 3

Spooling l Disks provided a much faster I/O device than card readers, mag tape, and line printers l Motivated development of spooling (Simultaneous Peripheral Operation On-Line) u Use disk to overlap I/O of one job with computation of others u Use faster I/O to hide the latency of slower I/O u But, CPU still idle when job reads/writes to disk 4

Multiprogramming l Multiprogramming increased system utilization u Keeps multiple runnable jobs loaded in memory u Overlaps I/O processing of a job with computation of another u Benefits from I/O devices that can operate asynchronously u Requires the use of interrupts (from I/O) and DMA u Requires memory protection and sharing u Optimizes system throughput (number of jobs finished in a given amount of time) at the cost of response time (time until a particular job finishes) 5

Timesharing l Timesharing supports interactive use of computer by multiple users u Terminals give the illusion that each user has own machine u Optimizes response time (time to respond to an event like a keystroke) at the cost of throughput u Based on timeslicing – dividing CPU time among the users u Enabled new class of applications – interactive! u Users now interact with viewers, editors, debuggers l The MIT Multics system (mid-late 60s) was an early, aggressive timesharing system l Unix and Windows are also timesharing systems… 6

Distributed Operating Systems l Distributed systems facilitate use of geographically distributed resources u Machine connected by wires l Supports communication between parts of a job or different jobs on different machines u Interprocess communication l Sharing of distributed resources, hardware, and software u Exploit remote resources l Enables parallelism, but speedup is not the goal u Goal is communication 7

Parallel Operating Systems l Support parallel applications trying to get speedup of computationally complex tasks across multiple CPUs l Requires basic primitives for dividing single task into multiple parallel activities l Supports efficient communication among activities l Supports synchronization of activities to coordinate data sharing l Early parallel systems used dedicated networks and custom CPUs, now common to use networks of high- performance PC/workstations 8

Embedded Operating Systems l Decreased cost of processing makes computers ubiquitous u Your car has dozens of computers in it u Think of everything that has electric motor in it, and now imagine that it also has a computer l Each embedded application needs its own OS u Smart phones u Smart home, smart grid l Very soon u Your house will have 100s of embedded computers in it u Your electrical lines and airwaves will serve as the network u All devices will interact as a distributed system 9

What is an operating system? l OS is “all the code that you didn’t have to write” to implement your application l OS is “code for all features not offered by hardware” Operating System Hardware Applications 10

Architectural support of OS l As OS evolves, complex tasks are pushed down to the hardware (e.g., CPU, MMU) – hence the architectural support Operating System Hardware Operating System Hardware 11

Why Start With Architecture? l Recall: Key goals of an OS are 1) to enable virtualization/abstraction; 2) to enforce protection and resource sharing; and 3) manage concurrency u If done well, applications can be oblivious to HW details »e.g., fread() assumes nothing about underlying storage l Architectural support can greatly simplify – or complicate – OS tasks u Easier for OS to implement a feature if supported by hardware u OS needs to implement everything hardware doesn’t 12

Architectural Features for OS l Features that directly support the OS include u Protection »Protection (kernel/user mode) »Protected instructions »Memory protection u Event-driven interface »System calls »Interrupts and exceptions »Timer (clock) u Handling concurrency »I/O control and operation »Synchronization 13

Review: Computer Organization 14

Types of Arch Support for OS l Manipulating privileged machine state u Protected instructions u Manipulate device registers, TLB entries, etc. l Generating and handling “events” u Interrupts, exceptions, system calls, etc. u Respond to external events u CPU requires software intervention to handle fault or trap l Mechanisms to handle concurrency u Interrupts, atomic instructions 15

Types of Arch Support l Manipulating privileged machine state u Protected instructions u Manipulate device registers, TLB entries, etc. l Generating and handling “events” u Interrupts, exceptions, system calls, etc. u Respond to external events u CPU requires software intervention to handle fault or trap l Mechanisms to handle concurrency u Interrupts, atomic instructions 16

Protected Instructions l A subset of instructions of every CPU is restricted to use only by the OS u Known as protected (privileged) instructions l Only the operating system can u Directly access I/O devices (disks, printers, etc.) »Security, fairness (why?) u Manipulate memory management state »Page table pointers, page protection, TLB management, etc. u Manipulate protected control registers »Kernel mode, interrupt level u Halt instruction (why?) 17

OS Protection l How does HW know if protected instr. can be executed? u Architecture must support (at least) two modes of operation: kernel mode and user mode (See next slide) »VAX, x86 support four modes; earlier archs (Multics) even more »Why? u Mode is indicated by a status bit in a protected control register u User programs execute in user mode u OS executes in kernel mode (OS == “kernel”) l Protected instructions only execute in kernel mode u CPU checks mode bit when protected instruction executes u Attempts to execute in user mode are detected and prevented u Need for new protected instruction? »Setting mode bit 18

CPU Modes/Privileges l Ring 0  Kernel Mode l Ring 3  User Mode 19

Memory Protection l OS must be able to protect programs from each other l OS must protect itself from user programs l May or may not protect user programs from OS l Memory management hardware provides memory protection mechanisms u Base and limit registers u Page table pointers, page protection, TLB u Virtual memory u Segmentation l Manipulating memory management hardware uses protected (privileged) operations 20

Base and Bound Example 21

Types of Arch Support l Manipulating privileged machine state u Protected instructions u Manipulate device registers, TLB entries, etc. l Generating and handling “events” u Interrupts, exceptions, system calls, etc. u Respond to external events u CPU requires software intervention to handle fault or trap l Mechanisms to handle concurrency u Interrupts, atomic instructions 22

Events l An event is an “unnatural” change in control flow u Events immediately stop current execution u Changes mode, context (machine state), or both l The kernel defines a handler for each event type u Event handlers always execute in kernel mode u The specific types of events are defined by the machine l Once the system is booted, all entry to the kernel occurs as the result of an event u In effect, the operating system is one big event handler 23

Categorizing Events l Two kinds of events: synchronous and asynchronous l Sync events are caused by executing instructions u Example? l Async events are caused by an external event u Example? CPU ticks Synchronous events Asynchronous events 24

Interrupt Handler Illustration 25

Summary l Protection u User/kernel modes u Protected instructions l Events 26

Next Time… l Processes u Read Chapter 3 27