W4118: OS Overview. Junfeng Yang

Similar documents
W4118 Operating Systems. Junfeng Yang

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals

Lecture Topics. Announcements. Today: Operating System Overview (Stallings, chapter , ) Next: Processes (Stallings, chapter

OS COMPONENTS OVERVIEW OF UNIX FILE I/O. CS124 Operating Systems Fall , Lecture 2

628 Lecture Notes Week 4

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve?

Outline. OS Interface to Devices. System Input/Output. CSCI 4061 Introduction to Operating Systems. System I/O and Files. Instructor: Abhishek Chandra

Process Management! Goals of this Lecture!

Introduction. CS3026 Operating Systems Lecture 01

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

Processes often need to communicate. CSCB09: Software Tools and Systems Programming. Solution: Pipes. Recall: I/O mechanisms in C

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

System Call. Preview. System Call. System Call. System Call 9/7/2018

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

CMPS 105 Systems Programming. Prof. Darrell Long E2.371

Process Creation in UNIX

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.

Operating Systems CS 217. Provides each process with a virtual machine. Promises each program the illusion of having whole machine to itself

Processes COMPSCI 386

CS450/550 Operating Systems

CSE 153 Design of Operating Systems Fall 2018

Unix Processes. What is a Process?

Chapter 1: Introduction

Unit 2 : Computer and Operating System Structure

Operating Systems. Review ENCE 360

University of Ottawa School of Information Technology and Engineering

Process Management 1

UNIX Kernel. UNIX History

What Is Operating System? Operating Systems, System Calls, and Buffered I/O. Academic Computers in 1983 and Operating System

Introduction to Computer Systems and Operating Systems

Process Management! Goals of this Lecture!

CS 326: Operating Systems. Process Execution. Lecture 5

Objectives. Chapter 2: Operating-System Structures. 2.1 Operating System Services

Goals of this Lecture

Operating Systems ( )

I/O Management! Goals of this Lecture!

I/O Management! Goals of this Lecture!

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

Operating Systems ( )

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

Computer System Overview

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu

Operating Systems ( )

ESE 333 Real-Time Operating Systems 2 What is an operating system? Two views: 1. Top-down view: Extended machine ffl Covers the details of the hardwar

Lecture 1 - Operating System Overview

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

Operating Systems ( )

CS510 Operating System Foundations. Jonathan Walpole

CS 33. Architecture and the OS. CS33 Intro to Computer Systems XIX 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

CSE 333 SECTION 3. POSIX I/O Functions

Lecture 3: O/S Organization. plan: O/S organization processes isolation

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

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

Operating-System Structures

CS 25200: Systems Programming. Lecture 14: Files, Fork, and Pipes

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Four Components of a Computer System

Pipes and FIFOs. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Recitation 8: Tshlab + VM

Chapter 1: Introduction

Design Overview of the FreeBSD Kernel CIS 657

CSE 410: Systems Programming

Chapter 1: Introduction

Processes. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

Operating Systems CS 571

The Shell, System Calls, Processes, and Basic Inter-Process Communication

Contents. PA1 review and introduction to PA2. IPC (Inter-Process Communication) Exercise. I/O redirection Pipes FIFOs

CS 3733 Operating Systems

Announcement. Exercise #2 will be out today. Due date is next Monday

UNIX input and output

Lecture 1 Introduction (Chapter 1 of Textbook)

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

Chapter 2: System Structures

Operating System. Operating System Overview. Structure of a Computer System. Structure of a Computer System. Structure of a Computer System

Chapter 1: Introduction. Chapter 1: Introduction

CSC209H Lecture 6. Dan Zingaro. February 11, 2015

CS 33. Architecture and the OS. CS33 Intro to Computer Systems XIX 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.

everything is a file main.c a.out /dev/sda1 /dev/tty2 /proc/cpuinfo file descriptor int

A2 Design Considerations. CS161, Spring

Layers in a UNIX System. Create a new process. Processes in UNIX. fildescriptors streams pipe(2) labinstructions

Operating System Review

Chapter 3: Operating-System Structures

Fall 2015 COMP Operating Systems. Lab #3

The course that gives CMU its Zip! I/O Nov 15, 2001

Inter-Process Communication

OS structure. Process management. Major OS components. CSE 451: Operating Systems Spring Module 3 Operating System Components and Structure

CS 5460/6460 Operating Systems

Operating System Services

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

Fundamental Concepts and History

TYPES OF OPERATING SYSTEMS. Dimple Juneja

Overview: Concurrent Architectures - Unix: Forks and Pipes

File Descriptors and Piping

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

SOFTWARE ARCHITECTURE 3. SHELL

Chapter 3: Operating-System Structures

Transcription:

W4118: OS Overview Junfeng Yang References: Modern Operating Systems (3 rd edition), Operating Systems Concepts (8 th edition), previous W4118, and OS at MIT, Stanford, and UWisc

Outline OS definitions OS abstractions/concepts OS structure OS evolution 2

What is OS? A program that acts as an intermediary between a user of a computer and the computer hardware. User App stuff between OS HW 3

Two popular definitions Top-down perspective: hardware abstraction layer, turn hardware into something that applications can use Bottom-up perspective: resource manager/coordinator, manage your computer s resources 4

OS = hardware abstraction layer standard library OS as virtual machine E.g. printf( hello world ), shows up on screen App issue system calls to use OS abstractions Why good? Ease of use: higher level, easier to program Reusability: provide common functionality for reuse E.g. each app doesn t have to write a graphics driver Portability / Uniformity: stable, consistent interface, different OS/ver/hw look same E.g. scsi/ide/flash disks Why hard? What are the right abstractions? 5

Two popular definitions Top-down perspective: hardware abstraction layer, turn hardware into something that applications can use Bottom-up perspective: resource manager/coordinator, manage your computer s resources 6

OS = resource manager/coordinator Computer has resources, OS must manage. Resource = CPU, Memory, disk, device, bandwidth, Shell ppt gcc browser System Call Interface OS CPU scheduling Memory management File system management Network stack Device drivers Disk system management Hardware 7

OS = resource manager/coordinator Why good? (cont.) Sharing/Multiplexing: more than 1 app/user to use resource Protection: protect apps from each other, OS from app Who gets what when Performance: efficient/fair access to resources Why hard? Mechanisms vs policies Mechanism: how to do things Policy: what will be done Ideal: general mechanisms, flexible policies Difficult to design right 8

Outline OS definitions OS abstractions/concepts OS structure OS evolution 9

OS abstraction: process Running program, stream of running instructions + process state A key OS abstraction: the applications you use are built of processes Shell, powerpoint, gcc, browser, Easy to use Processes are protected from each other process = address space Hide details of CPU, when&where to run 10

Unix process-related system calls int fork (void) Create a copy of the invoking process Return process ID of new process in parent Return 0 in child int execv (const char* prog, const char* argv[]) Replace current process with a new one prog: program to run argv: arguments to pass to main() int wait (int *status) wait for a child to exit 11

Simple shell // parse user-typed command line into command and args // execute the command switch(pid = fork ()) { case -1: perror ( fork ); break; case 0: // child execv (command, args, 0); break; default: // parent wait (0); break; // wait for child to terminate } 12

OS abstraction: file Array of bytes, persistent across reboot Nice, clean way to read and write data Hide the details of disk devices (hard disk, CDROM, flash ) Related abstraction: directory, collection of file entries 13

Unix file system calls int open(const char *path, int flags, int mode) Opens a file and returns an integer called a file descriptor to use in other file system calls Default file descriptors 0 = stdin, 1 = stdout, 2 = stderr int write(int fd, const char* buf, size_t sz) Writes sz bytes of data in buf to fd at current file offset Advance file offset by sz int close(int fd) int dup2 (int oldfd, int newfd) makes newfd an exact copy of oldfd closes newfd if it was open two file descriptors will share same offset 14

Process communication: pipe int pipe(int fds[2]) Creates a one way communication channel fds[2] is used to return two file descriptors Bytes written to fds[1] will be read from fds[0] Often used together with fork() to create a channel between parent and child 15

xv6 shell sh.c 16

Outline OS definitions and functionalities OS abstractions/concepts OS structure OS evolution 17

OS structure OS structure: what goes into the kernel? Kernel: most interesting part of OS Privileged; can do everything must be careful Manages other parts of OS Different structures lead to different Performance, functionality, ease of use, security, reliability, portability, extensibility, cost, Tradeoffs depend on technology and workload 18

Monolithic Most traditional functionality in kernel Unix System Architecture 19

Microkernel Move functionality out of kernel Minix 3 System Architecture 20

Virtual machine Export a fake hardware interface so that multiple OS can run on top Non-virtual Machine Virtual Machine 21

Outline OS definitions and functionalities OS abstractions/concepts OS structure OS evolution 22

OS evolution Many outside factors affect OS User needs + technology changes OS must evolve New/better abstractions to users New/better algorithms to implement abstractions New/better low-level implementations (hw change) Current OS: evolution of these things 23

Major trend in History Hardware: cheaper and cheaper Computers/user: increases Timeline 70s: mainframe, 1 / organization 80s: minicomputer, 1 / group 90s: PC, 1 / user 24

70s: mainframe Hardware: OS Huge, $$$, slow IO: punch card, line printer simple library of device drivers (no resource coordination) Human = OS: single programmer/operator programs, runs, debugs One job at a time Problem: poor performance (utilization / throughput) Machine $$$, but idle most of the time because programmer slow 25

Batch Processing Batch: submit group of jobs together to machine Operator collects, orders, runs (resource coordinator) Why good? can better optimize given more jobs Cover setup overhead Operator quite skilled at using machine Machine busy more (programmers debugging offline) Why bad? Must wait for results for long time Result: utilization increases, interactivity drops 26

Spooling Problem: slow I/O ties up fast CPU Input Compute Output Slow punch card reader and line printer Idea: overlap one job s IO with other jobs compute OS functionality buffering, DMA, interrupts Good: better utilization/throughput Bad: still not interactive 27

Multiprogramming Spooling multiple jobs Multiprogramming keep multiple jobs in memory, OS chooses which to run When job waits for I/O, switch OS functionality job scheduling, mechanism/policies Memory management/protection Good: better throughput Bad: still not interactive 28

80s: minicomputer Hardware gets cheaper. 1 / group Need better interactivity, short response time Concept: timesharing Fast switch between jobs to give impression of dedicated machine OS functionality: More complex scheduling, memory management Concurrency control, synchronization Good: immediate feedback to users 29

90s: PC Even cheaper. 1 / user Goal: easy of use, more responsive Do not need a lot of stuff Example: DOS No time-sharing, multiprogramming, protection, VM One job at a time OS is subroutine again 30

00s: smartphones, tablets Even cheaper. N / user Offload to cloud Goal: easy of use, more responsive, new user interfaces, always connected, cool Example: ios, Android, Windows Time-sharing, multiprogramming, protection, VM Users + Hardware OS functionality 31

Current trends? Large Users want more features More devices Parallel hardware, fast network Result: large system, millions of lines of code Reliability, Security Few errors in code, can recover from failures At odds with previous trend Small: e.g. wearable devices New user interface Energy: battery life One job at a time. OS is subroutine again 32

Next lecture PC hardware and x86 programming 33

OS abstraction: thread miniprocesses, stream of instructions + thread state Convenient abstraction to express concurrency in program execution and exploit parallel hardware for(;;) { int fd = accept_client(); create_thread(process_request, fd); } More efficient communication than processes 34