COS 318: Operating Systems

Similar documents
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. Jaswinder Pal Singh Computer Science Department Princeton University

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

COS 318: Operating Systems

Operating System Overview

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

Protection and System Calls. Otto J. Anshus

Hardware OS & OS- Application interface

Computer Systems Organization

Introduction and Overview

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

What Operating Systems Do An operating system is a program hardware that manages the computer provides a basis for application programs acts as an int

Processes and Threads

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

Operating System Review

Operating-System Structures

Chapter 3: Operating-System Structures

Assembly Language Programming Linkers

Slide 6-1. Processes. Operating Systems: A Modern Perspective, Chapter 6. Copyright 2004 Pearson Education, Inc.

Today s Big Adventure

Today s Big Adventure

Lec 22: Interrupts. Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University. Announcements

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

Lecture 8: linking CS 140. Dawson Engler Stanford CS department

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

Introduction to Computer Systems

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed

Deadlock Detection. Several Instances of a Resource Type. Single Instance of Each Resource Type

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

Introduction to Computer Systems

A process. the stack

Operating Systems. Sina Meraji U of T

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

www nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed

CS 550 Operating Systems Spring Interrupt

Processes. Johan Montelius KTH

ECE 471 Embedded Systems Lecture 4

Introduction. CS3026 Operating Systems Lecture 01

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

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

Chris Riesbeck, Fall Introduction to Computer Systems

C03c: Linkers and Loaders

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 Systems CMPSC 473. Process Management January 29, Lecture 4 Instructor: Trent Jaeger

Mon Sep 17, 2007 Lecture 3: Process Management

Chapter 3: Operating-System Structures

Fall 2015 COMP Operating Systems. Lab #3

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

Operating Systems. II. Processes

Chapter 3: Operating-System Structures

Chapter 2: Operating-System Structures

Introduction to Computer Systems

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

CS510 Operating System Foundations. Jonathan Walpole

The Kernel Abstraction. Chapter 2 OSPP Part I

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Introduction. Yolanda Becerra Fontal Juan José Costa Prats

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

Lecture 4: Memory Management & The Programming Interface

ECE 498 Linux Assembly Language Lecture 1

CS5460: Operating Systems

Four Components of a Computer System

Chapter 2: Operating-System

Process Environment. Pradipta De

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

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

High Performance Computing Lecture 11. Matthew Jacob Indian Institute of Science

Introduction to Operating Systems. Chapter Chapter

CIT 595 Spring System Software: Programming Tools. Assembly Process Example: First Pass. Assembly Process Example: Second Pass.

CS333 Intro to Operating Systems. Jonathan Walpole

Processes and Non-Preemptive Scheduling. Otto J. Anshus

CS370 Operating Systems

COS 318: Operating Systems. Introduction

Chapter 2: Operating-System Structures

Processes. Sanzheng Qiao. December, Department of Computing and Software

Sistemi in Tempo Reale

The Kernel. wants to be your friend

Chapter 2: System Structures

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

The Operating System Machine Level

Lecture 2: Architectural Support for OSes

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

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

Processes. CS439: Principles of Computer Systems January 30, 2019

CS 537 Lecture 2 - Processes

Lecture 2 - Fundamental Concepts

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

ECE 598 Advanced Operating Systems Lecture 10

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

CSE 153 Design of Operating Systems Fall 18

Distributed Systems Operation System Support

1 PROCESSES PROCESS CONCEPT The Process Process State Process Control Block 5

CS307: Operating Systems

Computer System Overview

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

Anne Bracy CS 3410 Computer Science Cornell University

Operating Systems: Overview and Introduction

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

Transcription:

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

Important Times Lectures 9/20 Lecture is here Other lectures in Bowen Hall 222 Precepts: Tue: 7:30-8:20pm, 104 CS building Thu (9/20): 7:30-8:20pm, 104 CS building Tutorial of Assembly programming and kernel debugging Project 1 Design review: 9/24: 10:30am 10:30pm (Signup online), 010 Friends center Project 1 due: 9/30 at 11:59pm To do: Lab partner? Enrollment? 2

Today Overview of OS functionalities Overview of OS components 3

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

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

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

In More Detail 7

Responsibilities Stack Layout by compiler Allocate/deallocate by process creation (fork) and termination Names are relative off of stack pointer and entirely local Heap Linker and loader say the starting address Allocate/deallocate by library calls such as malloc() and free() Application program use the library calls to manage Global data/code Compiler allocate statically Compiler emit names and symbolic references Linker translate references and relocate addresses Loader finally lay them out in memory 8

Hardware View of A Typical Computer Processor... Processor Cache Interrupt DRAM I/O bus ROM Network 9

Software + Hardware View Processor. Processor BIOS ROM Memory Application Operating System OS Apps Data Network 10

Software View of Interrupts Raised by external events Interrupt handler is in the kernel Switch to another process Overlap I/O with CPU Eventually resume the interrupted process 0: 1: i: i+1: N: Interrupt handler 11

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

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

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 14

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

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

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

OS Service Examples Examples System calls: fork, exec, exit, System calls: file open, close, read and write Control the CPU so that users won t stuck by running while ( 1 ) ; Protection: Keep user programs from crashing OS Keep user programs from crashing each other System calls are typically traps or exceptions System calls are implemented in the kernel When finishing the service, a system returns to the user code 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 Overview of OS functionalities Overview of OS components 21

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

Memory Management Goals Support programs to run Allocation and management Transfers from and to secondary storage Issues Efficiency & convenience Fairness 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 Goals Interactions between devices and applications Ability to plug in new devices Issues Efficiency Fairness Protection and sharing User 1 Driver I/O device... Library support... User n Driver I/O device 24

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

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

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

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

Summary Overview of OS functionalities Layers of abstractions Services to applications Manage resources Overview of OS components Processor management Memory management I/O device management File system Window system 29