Networks and Operating Systems Chapter 11: Introduction to Operating Systems

Similar documents
Last time: introduction. Networks and Operating Systems ( ) Chapter 2: Processes. This time. General OS structure. The kernel is a program!

Introduction to Operating Systems. Chapter Chapter

Introduction to Operating Systems. Chapter Chapter

Introduction to Operating. Chapter Chapter

Introduction to Operating Systems

Spring It takes a really bad school to ruin a good student and a really fantastic school to rescue a bad student. Dennis J.

Hardware OS & OS- Application interface

Role 1: The Operating System is an Abstract Machine. Learning Outcomes. Introduction to Operating Systems. What is an Operating System?

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

Lecture 1 Introduction (Chapter 1 of Textbook)

Virtual Machines. To do. q VM over time q Implementation methods q Hardware features supporting VM q Next time: Midterm?

Operating System Architecture. CS3026 Operating Systems Lecture 03

Operating systems Architecture

COMPUTER ARCHITECTURE. Virtualization and Memory Hierarchy

OS Structure. Kevin Webb Swarthmore College January 25, Relevant xkcd:

Last class: Today: Course administration OS definition, some history. Background on Computer Architecture

TDDI04, K. Arvidsson, IDA, Linköpings universitet Operating System Structures. Operating System Structures Overview. Operating System Services

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

Virtual Machines Disco and Xen (Lecture 10, cs262a) Ion Stoica & Ali Ghodsi UC Berkeley February 26, 2018

CSCI 350 Ch. 1 Introduction to OS. Mark Redekopp Ramesh Govindan and Michael Shindler

Lecture 4: Mechanism of process execution. Mythili Vutukuru IIT Bombay

LIA. Large Installation Administration. Virtualization

Chapter 1: Introduction

Background. IBM sold expensive mainframes to large organizations. Monitor sits between one or more OSes and HW

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

Spring 2017 :: CSE 506. Introduction to. Virtual Machines. Nima Honarmand

Unit 2 : Computer and Operating System Structure

CS 5460/6460 Operating Systems

ELEC 377 Operating Systems. Week 1 Class 2

Lecture 5: February 3

Operating Systems Overview

Address spaces and memory management

CHAPTER 16 - VIRTUAL MACHINES

Chapter 5 B. Large and Fast: Exploiting Memory Hierarchy

Xen and the Art of Virtualization. CSE-291 (Cloud Computing) Fall 2016

Dan Noé University of New Hampshire / VeloBit

Chapter 1: Introduction

Four Components of a Computer System

Virtual Machines. Part 2: starting 19 years ago. Operating Systems In Depth IX 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.

Advanced Systems Security: Virtual Machine Systems

Nested Virtualization and Server Consolidation

Chapter 5 C. Virtual machines

Operating Systems : Overview

Virtualization. Pradipta De

Operating Systems Course Overview

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

OPERATING SYSTEMS UNIT - 1

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

CS370 Operating Systems

Kernels & Processes The Structure of the Operating System

CS3600 SYSTEMS AND NETWORKS

CS 550 Operating Systems Spring Operating Systems Overview

Virtualization. ...or how adding another layer of abstraction is changing the world. CIS 399: Unix Skills University of Pennsylvania.

CS 350 Winter 2011 Current Topics: Virtual Machines + Solid State Drives

Lecture 7. Xen and the Art of Virtualization. Paul Braham, Boris Dragovic, Keir Fraser et al. 16 November, Advanced Operating Systems

CSCI 8530 Advanced Operating Systems. Part 19 Virtualization

Chapter 1: Introduction

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

Computer System Overview

Operating Systems: Principles and Practice. Mark Zbikowski Gary Kimura (kudos to Tom Anderson)

Preview. The Thread Model Motivation of Threads Benefits of Threads Implementation of Thread

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

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

Operating Systems Overview. Chapter 2

Chapter 5 (Part II) Large and Fast: Exploiting Memory Hierarchy. Baback Izadi Division of Engineering Programs

Virtual Memory. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

CS420: Operating Systems

Operating Systems Overview. Chapter 2

Last class: OS and Architecture. OS and Computer Architecture

Distributed File Systems Issues. NFS (Network File System) AFS: Namespace. The Andrew File System (AFS) Operating Systems 11/19/2012 CSC 256/456 1

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

Advanced Systems Security: Virtual Machine Systems

Virtualization and memory hierarchy

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

CS 153 Design of Operating Systems

CSE543 - Computer and Network Security Module: Virtualization

Virtual machines (e.g., VMware)

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

Process Scheduling Queues

Unit 5: Distributed, Real-Time, and Multimedia Systems

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

Chapter 2: Operating-System Structures

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

Today: Protection! Protection!

Lecture 2 Fundamental OS Concepts. Bo 2018, Spring

Chapter 1: Introduction. Chapter 1: Introduction

Networks and Opera/ng Systems Chapter 19: I/O Subsystems

Introduction to the Process David E. Culler CS162 Operating Systems and Systems Programming Lecture 2 Sept 3, 2014

Computer System Architecture. CMPT 300 Operating Systems I. Summer Segment 3: Computer System Architecture. Melissa O Neill

CS370 Operating Systems

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Virtualization. Application Application Application. MCSN - N. Tonellotto - Distributed Enabling Platforms OPERATING SYSTEM OPERATING SYSTEM

Sistemi in Tempo Reale

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

CSE543 - Computer and Network Security Module: Virtualization

Operating-System Structures

CSC 2405: Computer Systems II

CSE 120 Principles of Operating Systems

Chapter 5: Memory Management

CPSC/ECE 3220 Fall 2017 Exam Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts.

Transcription:

Systems Group Department of Computer Science ETH Zürich Networks and Operating Systems Chapter 11: Introduction to Operating Systems (252-0062-00) Donald Kossmann & Torsten Hoefler Frühjahrssemester 2012

Last time Virtual circuit switching Packet switching Multiprotocol switching Address Resolution Protocol Spanning tree algorithm Virtual LANs

Today: We start on Operating Systems! Introduction: Why? Roles of the OS Referee Illusionist Glue Structure of an OS 3

Goals Demystify operating systems themselves What is an OS? What does it do? What is its structure? How do the OS and applications relate to each other? What services does the OS provide? Quintessential systems problem Non-idealizable / non-reducible Scaling, emergent properties Concurrency and asynchrony

The Book On the web: http://ospp.cs.washington.edu/

Also worth a look Jerome H. Saltzer and M. Frans Kaashoek: Principles of Computer System Design Focus on principles, with illustrative examples

Also worth a look Andrew S. Tanebaum: Modern Operating Systems Must be at least 3 rd Edition! Very broad lots of references to recent (2006) research.

Introduction to Operating Systems

Why learn about Operating Systems? One of the most complex topics in Computer Science! Very few simplifying assumptions Dealing with the real world Intersection of many areas Mainstream OSes are large: Windows 7 ~ 50 million lines of code Linux rapidly catching up in complexity Most other software systems are a subset Games, browsers, databases, servers, cloud, etc.

Why learn about Operating Systems? One of the most complex topics in Computer Science! Very few simplifying assumptions Dealing with the real world Intersection of many areas Mainstream OSes are large: Windows 7 ~ 50 million lines of code Linux rapidly catching up in complexity (~15 million LOC) Most other software systems are a subset Games, browsers, databases, servers, cloud, etc.

Why learn about Operating Systems? One of the most complex topics in Computer Science! Very few simplifying assumptions Dealing with the real world Intersection of many areas Mainstream OSes are large: Windows 7 ~ 50 million lines of code Linux rapidly catching up in complexity (~15 million LOC) Most other software systems are a subset Games, browsers, databases, servers, cloud, etc.

There are lots of operating systems concepts Systems calls Concurrency and asynchrony Processes and threads Security, authorization, protection Memory, virtual memory, and paging Files and file systems, data management I/O: Devices, Interrupts, DMA Network interfaces and protocol stacks

There are lots of operating systems

Goals: what makes a good OS?

Goals: what makes a good OS? Reliability: does it keep working? And availability

Goals: what makes a good OS? Reliability: does it keep working? And availability Security: can it be compromised? And isolation: is it fair?

Goals: what makes a good OS? Reliability: does it keep working? And availability Security: can it be compromised? And isolation: is it fair? Portability: how easily can it be retargeted?

Goals: what makes a good OS? Reliability: does it keep working? And availability Security: can it be compromised? And isolation: is it fair? Portability: how easily can it be retargeted? Performance: how fast/cheap/hungry is it?

Goals: what makes a good OS? Reliability: does it keep working? And availability Security: can it be compromised? And isolation: is it fair? Portability: how easily can it be retargeted? Performance: how fast/cheap/hungry is it? Adoption: will people use it?

Operating Systems Applications Operating System Hardware

Operating Systems Applications Operating System Operating Systems (rest of this course!) Hardware

Operating Systems Applications Parallel Programming Operating System Operating Systems (rest of this course!) Hardware

Operating Systems Applications Parallel Programming Operating System Operating Systems (rest of this course!) Hardware Computer Architecture and Systems Programming

Operating System Roles

OS roles Referee Illusionist Glue

The Referee: Resource Manager Application Application Application Operating System System calls Hardware

The OS as Referee Sharing: Multiplex hardware among applications CPU, memory, devices Applications shouldn t need to be aware of each other Protection: Ensure one application can t r/w another s data In memory, on disk, over network Ensure one application can t use another s resources CPU, storage space, bandwidth, Communication: Protected applications must still communicate

The OS as Referee Sharing: Multiplex hardware among applications CPU, memory, devices Applications shouldn t need to be aware of each other Protection: Ensure one application can t r/w another s data In memory, on disk, over network Ensure one application can t use another s resources CPU, storage space, bandwidth, Communication: Protected applications must still communicate

The OS as Referee Sharing: Multiplex hardware among applications CPU, memory, devices Applications shouldn t need to be aware of each other Protection: Ensure one application can t r/w another s data In memory, on disk, over network Ensure one application can t use another s resources CPU, storage space, bandwidth, Communication: Protected applications must still communicate

Resource management goals Fairness: No starvation, every application makes progress Efficiency: Best use of complete machine resources Minimize e.g. power consumption Predictability: Guarantee real-time performance

Resource management goals Fairness: No starvation, every application makes progress Efficiency: Best use of complete machine resources Minimize e.g. power consumption Predictability: All in mutual contradiction Guarantee real-time performance

Example: Threads Threads are virtual CPUs Physical resource: CPUs Virtual resource: Threads Mechanism: pre-emption, timeslicing, context switching, scheduling More on this later in the course

The Illusionist Virtualization: OS creates illusion of a real resource Processor, storage, network, links, Virtual resource looks a bit like a physical resource However, is frequently quite different Simpler, larger, better,

How? 1. Multiplexing Divide resources up among clients 2. Emulation Create the illusion of a resource using software 3. Aggregation Join multiple resources together to create a new one

Why? 1. Sharing Enable multiple clients of a single resource 2. Sandboxing Prevent a client from accessing other resources 3. Decoupling Avoid tying a client to a particular instance of a resource 4. Abstraction Make a resource easier to use

Example: Virtual Memory Easier memory to manage Physical resource: RAM Virtual resource: Virtual Memory Method: Multiplexing Mechanism: virtual address translation

Example: Paged virtual memory More memory than you really have Physical resource: RAM and disk Virtual resource: paged virtual memory Method: multiplexing and emulation Mechanism: virtual memory + paging to/from disk Much more on this later in the course

Example: virtual machines Quite popular topic commercially right now: Xen, VMware, HyperV, kvm, etc. Many uses: Run one OS on another Consolidate servers Migrate running machines around datacenter Run hundreds of honeypot machines Deterministic replay of whole machines Etc.

Example: Files (or database!) Virtual resource: persistant memory Physical resource: disk Method: multiplexing, emulation Mechanism: block allocation, metadata Again, more later

Example: Windows (not the Microsoft OS) Physical resource: Frame buffer and/or GPU Method: Multiplexing and emulation Mechanism: Windows as separate bitmaps/textures

Example: virtual circuits Physical resource: network link Virtualization method: multiplexing Mechanism: VC identifiers, VC switching Virtual circuits VCI=346 VCI=1044 1 4 2 3 Real circuits VCI=1044 VCI=56

Example: VLANs Methods: multiplexing Mechanisms: port assignment, tags A B C D I J K S1 S2 S1 S2 M N N E G H F 42

Glue: the OS as Abstract Machine Applications Virtual machine interface Operating System Hardware Physical machine interface

The OS as Glue Provides high-level abstractions Easier to program to Shared functionality for all applications Ties together disparate functions and services Extends hardware with added functionality Direct programming of hardware unnecessary Hides details of hardware Applications decoupled from particular devices

Services provided by an OS Program execution Load program, execute on 1 or more processors Access to I/O devices Disk, network, keyboard, screen, Protection and access control For files, connections, etc. Error detection and reporting Trap handling, etc. Accounting and auditing Statistics, billing, forensics, etc.

Operating System Structure

General OS structure Application System Library Application System Library System calls Kernel Server process (daemon) System Library User mode Privileged mode CPU CPU Device Device

Privileged Mode and User Mode As we saw in Computer Architecture, most CPUs have a privileged mode : ia32 protection rings VAX kernel mode Etc. Most Operating Systems use this for protection In particular, protecting the OS from applications!

General OS structure Application System Library Application System Library System calls Kernel Server process (daemon) System Library User mode Privileged mode CPU CPU Device Device

Kernel That part of the OS which runs in privileged mode Large part of Unix and Windows (except libraries) Small part of L4, Barrelfish, etc. (microkernels) Does not exist in some embedded systems Also known as: Nucleus, nub, supervisor,

The kernel is a program! Kernel is just a (special) computer program. Typically an event-driven server. Responds to multiple entry points: System calls Hardware interrupts Program traps May also include internal threads.

General OS structure Application System Library Application System Library System calls Kernel Server process (daemon) System Library User mode Privileged mode CPU CPU Device Device

System Libraries Convenience functions strcmp(), etc. Common functionality System call wrappers Create and execute system calls from high-level languages See man syscalls on Linux

General OS structure Application System Library Application System Library System calls Kernel Server process (daemon) System Library User mode Privileged mode CPU CPU Device Device

Daemons Processes which are part of the OS Microkernels: most of the OS Linux: increasingly large quantity Advantages: Modularity, fault tolerance Easier to schedule

Entering and exiting the kernel

When is the kernel entered? Startup Exception: caused by user program Interrupt: caused by something else System calls

Recall: System Calls RPC to the kernel Kernel is a series of syscall event handlers Mechanism is hardware-dependent User mode Privileged mode System calls

Recall: System Calls RPC to the kernel Kernel is a series of syscall event handlers Mechanism is hardware-dependent User process runs User mode Privileged mode System calls

Recall: System Calls RPC to the kernel Kernel is a series of syscall event handlers Mechanism is hardware-dependent User process runs Execute syscall User mode Privileged mode System calls

Recall: System Calls RPC to the kernel Kernel is a series of syscall event handlers Mechanism is hardware-dependent User process runs Execute syscall User mode Privileged mode System calls

Recall: System Calls RPC to the kernel Kernel is a series of syscall event handlers Mechanism is hardware-dependent User process runs Execute syscall User mode Privileged mode Execute kernel code System calls

Recall: System Calls RPC to the kernel Kernel is a series of syscall event handlers Mechanism is hardware-dependent User process runs Execute syscall Process resumes User mode Privileged mode Execute kernel code System calls

System call arguments Syscalls are the way a program requests services from the OS kernel. Implementation varies: Passed in processor registers Stored in memory (address in register) Pushed on the stack System library (libc) wraps as a C function Kernel code wraps handler as C call

When is the kernel exited? Creating a new process Including startup Resuming a process after a trap Exception, interrupt or system call User-level upcall Much like an interrupt, but to user-level Switching to another process