CS 550 Operating Systems Spring Operating Systems Overview

Similar documents
Operating Systems Course Overview

Operating Systems. Pablo Prieto Torralbo. 1. Introduction DEPARTMENT OF COMPUTER ENGINEERING

Four Components of a Computer System

EEE 435 Principles of Operating Systems

Operating Systems CS3502 Spring 2018

ELEC 377 Operating Systems. Week 1 Class 2

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

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edit9on

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

Operating System Architecture. CS3026 Operating Systems Lecture 03

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

Operating Systems. Spring Dongkun Shin, SKKU

Operating System Services. User Services. System Operation Services. User Operating System Interface - CLI. A View of Operating System Services

Chapter 2. Operating-System Structures

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

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

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

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

Kernel Types Simple OS Examples System Calls. Operating Systems. Autumn CS4023

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

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

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

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

CSC Operating Systems Spring Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. January 17 th, 2007.

Announcements. Operating System Structure. Roadmap. Operating System Structure. Multitasking Example. Tevfik Ko!ar

Chapter 1: Introduction Operating Systems MSc. Ivan A. Escobar

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

Chapter 2: Operating-System Structures

Background: Operating Systems

Operating System Review

Systems Programming. The Unix/Linux Operating System

Operating Systems : Overview

CSE 4/521 Introduction to Operating Systems

Operating Systems CS 571

Chapter 2: Operating-System Structures

CHAPTER 16 - VIRTUAL MACHINES

CHAPTER 2: SYSTEM STRUCTURES. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Chapter 2: Operating-System Structures. Operating System Concepts 8 th Edition

About Me. Office Hours: Tu 4-5, W 1-2, or by appointment Office: 346A IST Bldg

Fall 2017 :: CSE 306. Introduction to. Virtual Memory. Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau)

OS concepts and structure. q OS components & interconnects q Structuring OSs q Next time: Processes

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

Introduction to Operating Systems

Operating-System Structures

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

Introduction. Chapter Prof. Amr El-Kadi

31268_WEB SYSTEMS LECTURE 1. Operating Systems Part 1

CSC 453 Operating Systems

COS 318: Operating Systems

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

Processes and Threads

Chapter 2 Operating-System Structures

CS 390 Chapter 2 Homework Solutions

Chapter 1: Introduction

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edition

2. Introduction to Operating Systems

Operating- System Structures

Chapter 2: Operating-System Structures. Operating System Concepts Essentials 8 th Edition

! Software ( kernel ) that runs at all times. ! OS performs two unrelated functions: Maria Hybinette, UGA. user! 1! Maria Hybinette, UGA. user! n!

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

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

Real Time and Embedded Systems. by Dr. Lesley Shannon Course Website:

Computer System Overview

Chapter 2: Operating-System

Lecture 1 Introduction (Chapter 1 of Textbook)

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

Chapter 2: Operating-System Structures

What we saw. Desarrollo de Aplicaciones en Red. 1. OS Design. 2. Service description. 1.1 Operating System Service (1)

OS Design Approaches. Roadmap. OS Design Approaches. Tevfik Koşar. Operating System Design and Implementation

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

Unit 2 : Computer and Operating System Structure

Chapter 2: Operating-System Structures

Lecture 5: February 3

Operating System Labs. Yuanbin Wu

Chapter 2: System Structures. Operating System Concepts 9 th Edition

Chapter 1: Introduction

Operating Systems. Antônio Augusto Fröhlich LISHA/UFSC. December 20, 2008

Module 1 Introduction/OS Overview

Operating Systems (2INC0) 2018/19. Introduction (01) Dr. Tanir Ozcelebi. Courtesy of Prof. Dr. Johan Lukkien. System Architecture and Networking Group

File Systems. OS Overview I/O. Swap. Management. Operations CPU. Hard Drive. Management. Memory. Hard Drive. CSI3131 Topics. Structure.

Operating Systems. Fall Dongkun Shin, SKKU

Operating System Structure

CSC 2405: Computer Systems II

COS 318: Operating Systems. Virtual Machine Monitors

OS DESIGN PATTERNS II. CS124 Operating Systems Fall , Lecture 4

CS3600 SYSTEMS AND NETWORKS

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

Software Engineering at VMware Dan Scales May 2008

Operating System Concepts Ch. 2: Operating System Structures

Introduction to Operating System

TYPES OF OPERATING SYSTEMS. Dimple Juneja

COS 318: Operating Systems. File Systems. Topics. Evolved Data Center Storage Hierarchy. Traditional Data Center Storage Hierarchy

The modularity requirement

CSC Operating Systems Fall Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. August 27 th, 2009.

David DeFlyer Class notes CS162 January 26 th, 2009

Announcements. Computer System Organization. Roadmap. Major OS Components. Processes. Tevfik Ko!ar. CSC Operating Systems Fall 2009

Chapter 2: System Structures

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

Networks and Operating Systems Chapter 11: Introduction to Operating Systems

Transcription:

1 CS 550 Operating Systems Spring 2018 Operating Systems Overview

2 What is an OS? Applications OS Hardware A software layer between the hardware and the application programs/users which provides a virtualization interface. A resource manager that allows concurrent programs/users to share the hardware resources And it ensures information stored persistently in the computer. Three themes of operating systems: virtualization, concurrency and persistence.

3 Theme 1: Virtualization Making a physical resource look like something else (virtual). Why virtualize? To make the computer easier to use and program.

4 Examples Make one physical CPU look like multiple virtual CPUs One or more virtual CPUs per process Make physical memory (RAM) and look like multiple virtual memory spaces One or more virtual memory spaces per process Make physical disk look like a file system Physical disk = raw bytes. File system = user s view of data on disk.

5 Virtualization example Virtualizing the CPU cpu.c (simple code that loops and prints)

6 Virtualization example Virtualizing the CPU Run one instance of cpu program on a single core CPU The CPU runs the program and outputs to the terminal the messages that the program wants to print.

7 Virtualization example Virtualizing the CPU Run many instances of cpu program on a single core CPU Even though we have only one processor, somehow all four of these programs seem to be running at the same time! How? The operating system, with some help from the hardware, turns (or virtualizes) a single CPU (or small set of them) into a seemingly infinite number of CPUs and thus allowing many programs to seemingly run at once virtualizing the CPU.

8 Virtualization example Virtualizing Memory stored in What is the variable p stored? mem.c (Figure 2.3 of OSTEP CH02)

Virtualization example Virtualizing Memory Run a single instance of the mem program. Run two instances of the mem program. stored in stored in For the two instances case, each running program has allocated memory at the same address (00200000), and yet each seems to be updating the value at 00200000 independently! It is as if each running program has its own private memory, instead of sharing the same physical memory with other running programs. 9

Virtualizing memory: - Each process accesses its own private virtual memory address space (sometimes just called its address space), which the OS somehow maps onto the physical memory of the machine. - A memory reference within one running program does not affect the address space of other processes (or the OS itself); as far as the running program is concerned, it has physical memory all to itself. 10 Virtualization example Virtualizing Memory Run a single instance of the mem program. Run two instances of the mem program. stored in stored in

A different level of virtualization, which virtualizes hardware for different operating systems, will be introduced later in the semester. 11

12 Theme 2: concurrency Virtualization allows multiple concurrent programs to share the virtualized hardware resources, which brings out another class of topics: concurrency. Examples One physical CPU runs many processes One process runs many threads One OS juggles process execution, system calls, interrupts, exceptions, CPU scheduling, memory management, etc. There s a LOT of concurrency in modern computer systems. And its the source of most of the system complexity.

Concurrency Example 13

14 Concurrency Example Expected output? Reality? What happed? A key part of the program above, where the shared counter is incremented, takes three instructions: one to load the value of the counter from memory into a register, one to increment it, and one to store it back into memory. Because these three instructions do not execute atomically (all at once), strange things can happen.

15 Theme 3: Persistence Storing data forever On hard disks, SSDs, CDs, floppy disks, tapes, phono discs, paper! But its not enough to just store raw bytes Users want to Organize data (via file systems) Share data (via network or cloud) Access data easily and recover data when lost. Protect data from being stolen.

History of OS 1950s and 1960s: Early operating systems were simple batch processing systems Users provided their own OS as libraries. 1960s and1970s: Multi-programming on mainframes Concurrency, memory protection, Kernel mode, system calls, hardware privilege levels, trap handling Earliest Multics hardware and OS on IBM mainframes Which led to the first UNIX OS which pioneered file systems, shell, pipes, and the C language. 1980s: Personal computing era MacOS, IBM PC and its DOS, Windows, and so forth. Unfortunately, many lessons from earlier multi-programming era were forgotten and had to be re-learned (painfully). 1980s also saw the fragmentation of UNIX Each big company had its own version (IBM, Apple, HP, SUN, SGI, NCR, AT&T.) LOT of legal wrangling over IP and copyrights 1990s: Then came BSD and Linux Open source. Led the way to modern OSes and cloud platforms 1990s also saw wider adoption of threads and parallelism 2000 and beyond: Mobile device OS and hypervisors Android, ios VMWare ESX, Xen, Linux/KVM etc.

17 Evolution of Operating Systems A major OS will evolve over time for a number of reasons: hardware upgrades new types of hardware new services Fixes

Architecting Kernels Three basic approaches 1. Monolithic kernels All functionalities are compiled together All code runs in privileged kernel-space 2. Microkernels Only essential functionalities are compiled into the kernel All other functionalities run in unprivileged user space 3. Hybrid kernels Most functionalities are compiled into the kernel Some functions are loaded dynamically Typically, all functionality runs in kernel-space 18

19 Monolithic Kernel Kernel Space User Space Monolithic Kernel Code Memory Manager Security Policies CPU Scheduling Error Handling Program Loader System APIs User Program Device Drivers File Systems

20 Microkernel Kernel Space User Space Kernel Code Memory Manager File System Networking Service Disk Driver Network Card Driver CPU Scheduling Interprocess Communication User Program 1 User Program 2

21 Hybrid Kernel Kernel Space User Space Memory Manager Security Policies Kernel Code CPU Scheduling Error Handling Third-Party Code Device Driver Device Driver File Systems System APIs File System Program Loader User Program

22 Research Kernels: Mach L4 GNU Hurd Kernels for Embedded System: QNX Microkernels: Small code base, Few features Hybrid Kernels: Pretty large code base, Some features delegated Monolithic Kernels: Huge code base, Many features

23 Pros/Cons of Monolithic Kernels Advantages Single code base eases kernel development Robust APIs for application developers No need to find separate device drivers Fast performance due to tight coupling Disadvantages Large code base, hard to check for correctness Bugs crash the entire kernel (and thus, the machine)

24 Advantages Pros/Cons of Microkernels Small code base, easy to check for correctness Excellent for high-security systems Extremely modular and configurable Choose only the pieces you need for embedded systems Easy to add new functionality (e.g. a new file system) Services may crash, but the system will remain stable Disadvantages Performance is slower: many context switches No stable APIs, more difficult to write applications

25 Discussion What is the difference between kernel and user mode? And what is the purpose of having these two modes? Most modern CPUs provide two modes of execution (i.e., supported directly by the hardware): kernel mode and user mode. The CPU can execute every instruction in its instruction set and use every feature of the hardware when executing in kernel mode. However, it can execute only a subset of instructions and use only subset of features when executing in the user mode. Purpose: protection to protect critical resources (e.g., privileged instructions, memory, I/O devices) from being misused by user programs.

26 References Operating Systems: Three Easy Pieces, by Prof. Remzi Arpaci-Dusseau and Prof. Andrea Arpaci-Dusseau. Slides from Prof. Yifan Zhang and Prof. Kartik Gopalan