COS 318: Operating Systems. Overview. Jaswinder Pal Singh Computer Science Department Princeton University

Similar documents
COS 318: Operating Systems

COS 318: Operating Systems

COS 318: Operating Systems. Overview. Andy Bavier Computer Science Department Princeton University

9/19/18. COS 318: Operating Systems. Overview. Important Times. Hardware of A Typical Computer. Today CPU. I/O bus. Network

COS 318: Operating Systems. Overview. Prof. Margaret Martonosi Computer Science Department Princeton University

COS 318: Operating Systems. Introduction

Operating System Overview

Misc. Third Generation Batch Multiprogramming. Fourth Generation Time Sharing. Last Time Evolution of OSs

Fundamental Concepts and History

Introduction and Overview

Topics. Operating System I. What is an Operating System? Let s Get Started! What is an Operating System? OS History.

Introduction. What is an Operating System? A Modern Computer System. Computer System Components. What is an Operating System?

Computer System Overview

Topics. Operating System. What is an Operating System? Let s Get Started! What is an Operating System? Where in the Book are we?

Hardware OS & OS- Application interface

CS450/550 Operating Systems

Introduction to OS. Introduction MOS Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1

Operating Systems Course 2 nd semester 2016/2017 Chapter 1: Introduction

Introduction to Computer Systems and Operating Systems

Introduction to Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

OPERATING SYSTEMS OVERVIEW

CS 153 Design of Operating Systems

OS - Introduction Ezio Bartocci Institute for Computer Engineering

Principles of Operating Systems CS 446/646

Operating System Concepts Rab Nawaz Khan Jadoon

Operating Systems CS3502 Spring 2018

CSC Operating Systems Fall Lecture - I Introduction. Tevfik Ko!ar. Louisiana State University. August 25 th, Contact Information

INTRODUCTION TO OPERATING SYSTEMS. Jo, Heeseung

Operating Systems: Overview and Introduction

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

Basic Concepts & OS History

Course Content. 07-Feb-17 Faculty of Computer Science & Engineering 1 BK TP.HCM

7/20/2008. What Operating Systems Do Computer-System Organization

Reserves time on a paper sign-up sheet. Programmer runs his own program. Relays or vacuum tube hardware. Plug board or punch card input.

Introduction to Operating Systems. Jo, Heeseung

Chapter 1: Introduction

Operating System Review

Module 1: Introduction

Chapter 1: Introduction

Chapter 1: Introduction. Chapter 1: Introduction

UNIT I OPERATING SYSTEMS OVERVIEW

Introduction to Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Four Components of a Computer System

CS370 Operating Systems

Chapter 1: Introduction

To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Chapter 1: Introduction

Generating Programs and Linking. Professor Rick Han Department of Computer Science University of Colorado at Boulder

Module 1: Introduction. What is an Operating System?

Part I Overview Chapter 1: Introduction

NETW3005 Operating Systems Lecture 1: Introduction and history of O/Ss

Last class: OS and Architecture. OS and Computer Architecture

Last class: OS and Architecture. Chapter 3: Operating-System Structures. OS and Computer Architecture. Common System Components

OPERATING SYSTEM. Functions of Operating System:

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

Operating Systems: Internals and Design Principles. Chapter 2 Operating System Overview Seventh Edition By William Stallings

Lecture 1 Introduction (Chapter 1 of Textbook)

Module 1 Introduction/OS Overview

Course Details. Operating Systems with C/C++ Course Details. What is an Operating System?

Operating Systems. Lecture Course in Autumn Term 2015 University of Birmingham. Eike Ritter. September 22, 2015

Architectural Support for Operating Systems

Introduction to Operating Systems

EECS 678: Introduction to Operating Systems. Heechul Yun

Protection and System Calls. Otto J. Anshus

Operating Systems. Introduction & Overview. Outline for today s lecture. Administrivia. ITS 225: Operating Systems. Lecture 1

European University of Lefke. Instructor: Dr. Arif SARI

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Operating Systems Fundamentals. What is an Operating System? Focus. Computer System Components. Chapter 1: Introduction

Introduction To Operating System

COSC243 Part 2: Operating Systems

Chapter 2: Operating-System Structures

OPERATING SYSTEMS UNIT - 1

The First Operating System Was Human

Lec 13: Linking and Memory. Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University. Announcements

Chapter 1: Introduction

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Operating Systems CS 571

Architecture and OS. To do. q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure

Operating System Services

Introduction to Computer Systems

OS and Computer Architecture. Chapter 3: Operating-System Structures. Common System Components. Process Management

Today. Operating System Evolution. CSCI 4061 Introduction to Operating Systems. Gen 1: Mono-programming ( ) OS Evolution Unix Overview

Operating System. Operating System Overview. Layers of Computer System. Operating System Objectives. Services Provided by the Operating System

Operating System Overview. Operating System

Lecture 2: Architectural Support for OSes

Introduction to Operating System. Dr. Aarti Singh Professor MMICT&BM MMU

Introduction to Operating Systems (Part II)

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

CSC 453 Operating Systems

A software view. Computer Systems. The Compilation system. How it works. 1. Preprocesser. 1. Preprocessor (cpp)

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

CSC 2405: Computer Systems II

Contents. Today's Topic: Introduction to Operating Systems

1. Operating System Concepts

Topics: Early systems and OS overview Skim Chapters 1-2 of SGG Read Chapter 1 of USP CS 3733 Operating Systems

What are some common categories of system calls? What are common ways of structuring an OS? What are the principles behind OS design and

UNIT 2. OPERATING SYSTEM STRUCTURES

3 Lecture: The Process Model

Chris Riesbeck, Fall Introduction to Computer Systems

Introduction to Computer Systems

Transcription:

COS 318: Operating Systems Overview Jaswinder Pal Singh Computer Science Department Princeton University (http://www.cs.princeton.edu/courses/cos318/)

Important Times u Precepts: l Mon: 7:30-8:20pm, 105 CS building l This week (9/21: TODAY): Tutorial of Assembly programming and kernel debugging u Project 1 l Design review: 9/28: 1:30pm 6:30pm (Signup online), 010 Friends center l Project 1 due: 10/04 at 11:55pm u To do: l Lab partner? Enrollment? 2

Today u Overview of OS functionality u Overview of OS components 3

Hardware of A Typical Computer CPU... CPU Memory Chipset I/O bus ROM Network 4

A Typical Computer System CPU. CPU BIOS ROM Memory Application Operating System OS Apps Data Network 5

Typical Unix OS Structure Application Libraries Portable OS Layer User level Kernel level Machine-dependent layer 6

Typical Unix OS Structure Application User function calls written by programmers and compiled by programmers. Libraries Portable OS Layer Machine-dependent layer 7

Typical Unix OS Structure Application Libraries Written by elves Objects pre-compiled Defined in headers Input to linker Invoked like functions May be resolved when program is loaded Portable OS Layer Machine-dependent layer 8

Pipeline of Creating An Executable File foo.c gcc foo.s as foo.o bar.c gcc bar.s as bar.o ld a.out libc.a u gcc can compile, assemble, and link together u Compiler (part of gcc) compiles a program into assembly u Assembler compiles assembly code into relocatable object file u Linker links object files into an executable u For more information: l Read man page of a.out, elf, ld, and nm l Read the document of ELF 9

Execution (Run An Application) u On Unix, loader does the job l Read an executable file l Layout the code, data, heap and stack l Dynamically link to shared libraries l Prepare for the OS kernel to run the application *.o, *.a ld a.out loader Application Shared library 10

What s An Application? u Four segments l Code/Text instructions l Data global variables l Stack l Heap u Why: l Separate code and data? l Have stack and heap go towards each other? Stack Heap Initialized data Code 2 n -1 0 11

In More Detail 12

Responsibilities u Stack l Layout by? l Allocated/deallocated by? l Names are absolute/relative? Local/global? u Heap l Who sets the starting address? l Allocated/deallocated by? l How do application programs manage it? u Global data/code l Who allocates? l Who defines names and references? l Who translates references? l Who relocates addresses? l Who lays them out in memory? 13

Typical Unix OS Structure Application Libraries Portable OS Layer Guts of system calls Machine-dependent layer 14

Run Multiple Applications u Use multiple windows l Browser, shell, powerpoint, word, u Use command line to run multiple applications % ls al grep ^d % foo & % bar & 15

Support Multiple Processes Application Libraries Application Libraries Application Libraries Portable OS Layer Machine-dependent layer 16

OS Service Examples u Examples that are not provided at user level l System calls: file open, close, read and write l Control the CPU so that users won t cause problems by running: while ( 1 ) ; l Protection: Keep user programs from crashing OS Keep user programs from crashing each other u System calls are typically traps or exceptions l System calls are implemented in the kernel l Application traps to kernel to invoke a system call l When finishing the service, a system returns to the user code 17

Interrupts u Raised by external events u Interrupt handler is in the kernel l Switch to another process l Overlap I/O with CPU l u Eventually resume the interrupted process u A way for CPU to wait for long-latency events (like I/O) to happen 0: 1: i: i+1: N: Interrupt handler 18

Typical Unix OS Structure Application Libraries Portable OS Layer Bootstrap System initialization Interrupt and exception I/O device driver Memory management Mode switching Processor management Machine-dependent layer 19

Software Onion Layers Applications Libraries User and Kernel boundary OS Services Device Kernel HW Driver 20

Today u Overview of OS functionalities u Overview of OS components 21

Processor Management u Goals l Overlap between I/O and computation l Time sharing l Multiple CPU allocation u Issues l Do not waste CPU resources l Synchronization and mutual exclusion l Fairness and deadlock CPU I/O CPU CPU I/O CPU CPU CPU I/O CPU CPU 22

Memory Management u Goals l Support for programs to be written easily l Allocation and management l Transfers from and to secondary storage u Issues l Efficiency & convenience l Fairness l Protection Register: 1x L1 cache: 2-4x L2 cache: ~10x L3 cache: ~50x DRAM: ~200-500x Disks: ~30M x Archive storage: >1000M x 23

I/O Device Management u Goals l Interactions between devices and applications l Ability to plug in new devices u Issues l Efficiency l Fairness l Protection and sharing User 1 Driver I/O device... Library support... User n Driver I/O device 24

File System u Goals: l Manage disk blocks l Map between files and disk blocks u A typical file system l Open a file with authentication l Read/write data in files l Close a file u Issues l Reliability l Safety l Efficiency l Manageability User 1... User n File system services File... File 25

Window Systems u Goals l Interacting with a user l Interfaces to examine and manage apps and the system u Issues l Inputs from keyboard, mouse, touch screen, l Display output from applications and systems l Division of labor All in the kernel (Windows) All at user level Split between user and kernel (Unix) 26

Bootstrap u u u u u u Power up a computer Processor reset l Set to known state l Jump to ROM code (BIOS is in ROM) Load in the boot loader from stable storage Jump to the boot loader Load the rest of the operating system Initialize and run Boot loader Boot loader OS sector 1 OS sector 2. OS sector n 27

Develop An Operating System u A hardware simulator u A virtual machine u A kernel debugger l When OS crashes, always goes to the debugger u Smart people 1972 1998 28

Summary u Overview of OS functionalities l Layers of abstraction l Services to applications l Resource management u Overview of OS components l Processor management l Memory management l I/O device management l File system l Window system l 29

Appendix: Booting a System 30

Bootstrap u u u u u u Power up a computer Processor reset l Set to known state l Jump to ROM code (BIOS is in ROM) Load in the boot loader from stable storage Jump to the boot loader Load the rest of the operating system Initialize and run Boot loader Boot loader OS sector 1 OS sector 2. OS sector n 31

System Boot u Power on (processor waits until Power Good Signal) u Processor jumps to a fixed address, which is the start of the ROM BIOS program COS318 Lec 2 32

ROM Bios Startup Program (1) u POST (Power-On Self-Test) Stop booting if fatal errors, and report u Look for video card and execute built-in ROM BIOS code (normally at C000h) u Look for other devices ROM BIOS code u Display startup screen BIOS information u Execute more tests memory system inventory COS318 Lec 2 33

ROM BIOS startup program (2) u Look for logical devices l Label them Serial ports COM 1, 2, 3, 4 Parallel ports LPT 1, 2, 3 l Assign each an I/O address and interrupt numbers u Detect and configure Plug-and-Play (PnP) devices u Display configuration information on screen COS318 Lec 2 34

ROM BIOS startup program (3) u Search for a drive to BOOT from l Floppy or Hard disk Boot at cylinder 0, head 0, sector 1 u Load code in boot sector u Execute boot loader u Boot loader loads program to be booted If no OS: "Non-system disk or disk error - Replace and press any key when ready" u Transfer control to loaded program COS318 Lec 2 35

Appendix: History of Computers and OSes 36

History of Computers and OSes Generations: (1945 55) Vacuum Tubes (1955 65) Transistors and Batch Systems (1965 1980) ICs and Multiprogramming (1980 Present) Personal Computers Now: mobile devices

Phase 1: The Early Days u Hardware very expensive, humans cheap u When was the first functioning digital computer built? u What was it built from? u How was the machine programmed? u What was the operating system? u The big innovation: punch cards u The really big one: the transistor l Made computers reliable enough to be sold to and operated by customers 38

Phase 2: Transistors and Batch Systems u Hardware still expensive, humans relatively cheap u An early batch system u Programmers bring cards to reader system u Reader system puts jobs on tape

Phase 2: Transistors and Batch Systems u An early batch system u Operator carries input tape to main computer u Main computer computes and puts output on tape u Operator carries output tape to printer system, which prints output

Punch cards and Computer Jobs

Phase 3: ICs and Multiprogramming u Integrated circuits allowed families of computers to be built that were compatible u Single OS to run on all (IBM OS/360): big and bloated u Key innovation: multiprogramming u What happens when a job is waiting on I/O u What if jobs spend a lot of the time waiting on I/O?

Phase 3: ICs and Multiprogramming u Multiple jobs resident in computer s memory u Hardware switches between them (interrupts) u Hardware protects from one another (mem protection) u Computer reads jobs from cards as jobs finish (spooling) u Still batch systems: can t debug online u Solution: time-sharing

Phase 3: ICs and Multiprogramming u Time-sharing: u Users at terminals simultaneously u Computer switches among active jobs /sessions u Shorter, interactive commands serviced faster App1 App2... App2 Time-sharing OS Hardware hardware

Phase 3: ICs and Multiprogramming u The extreme: computer as a utility: MULTICS (late 60s) u Problem: thrashing as no. of users increases u Didn t work then, but is back u Let others administer and manage; I ll just use u ICs led to mini-computers: cheap, small, powerful u Stripped down version of MULTICS, led to UNIX u Two branches (Sys V, BSD), standardized as POSIX u Free follow-ups: Minix (education), Linux (production)

Phase 4: HW Cheaper, Human More Costly u Personal computer l Altos OS, Ethernet, Bitmap display, laser printer l Pop-menu window interface, email, publishing SW, spreadsheet, FTP, Telnet l Eventually >100M units per year u PC operating system l Memory protection l Multiprogramming l Networking 46

Now: > 1 Machines per User u Pervasive computers l l l l u Wearable computers Communication devices Entertainment equipment Computerized vehicle OS are specialized l l Embedded OS Specially configured generalpurpose OS 47

Now: Multiple Processors per Machine u Multiprocessors l SMP: Symmetric MultiProcessor l ccnuma: Cache-Coherent Non-Uniform Memory Access l General-purpose, single-image OS with multiproccesor support u Multicomputers l Supercomputer with many CPUs and highspeed communication l Specialized OS with special messagepassing support u Clusters l A network of PCs l Commodity OS 48

Now: Multiple Cores per Processor u Multicore or Manycore transition l Intel and AMD have released 4-core and soon 6-core CPUs l SUN s Niagara processor has 8-cores l Azul Vega8 now packs 24 cores onto the same chip l Intel has a TFlop-chip with 80 cores l Ambric Am2045: 336-core Array (embedded, and accelerators) u Accelerated need for software support l OS support for many cores; parallel programming of applications Scalable On DieFabric Fixed Function Units IA Core IA Core IA Core IA Core IA IA IA IA Core Core Core Core Last Level Cache IA IA IA IA Core Core Core Core IA Core IA Core IA Core IA Core High BW Memory I/F 49

Summary: Evolution of Computers 60 s-70 s - Mainframes u Rise of IBM 70 s - 80 s Minicomputers u Rise of Digital Equipment Corporation 80 s - 90 s PCs u Rise of Intel, Microsoft Now Post-PC u Distributed applications 50