CMPS 111: Introduction to Operating Systems

Similar documents
Operating Systems. Hadi Salimi Computer Engineering Department Iran University of Science and Technology Tehran, Iran

Operating Systems CS 571

CS450/550 Operating Systems

Computer System Overview

Four Components of a Computer System

Operating Systems ( )

Operating Systems, Fall

Operating Systems ( )

Master level: Operating systems, distributed systems, networking,

Operating Systems ( )

Operating Systems ( )

Introduction OS

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

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

Useful information. Introduction. Outline of the course. Background. References

OS Assignment I. The result is a smaller kernel. Microkernels provide minimal process and memory management, in addition to a communication facility.

CS 333 Introduction to Operating Systems. Class 2 OS-Related Hardware & Software The Process Concept

Introduction SOFTWARE TECHNOLOGIES FOR BIOENGINEERING OS

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

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

Unit 2 : Computer and Operating System Structure

Andrew S. Tanenbaum, Operating Systems, Design and Implementation, (Second Edition), Prentice Hall.

CS 333 Introduction to Operating Systems Class 2 OS-Related Hardware & Software The Process Concept

1 System & Activities

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems, 3rd edition. Uses content with permission from Assoc. Prof. Florin Fortis, PhD

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

CSCI 6730 / 4730 Operating Systems. Key Questions in System Design. Review: What is An Operating System? Key Points

Introduction and Overview

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

CS399 New Beginnings. Jonathan Walpole

OPERATING SYSTEM. PREPARED BY : DHAVAL R. PATEL Page 1. Q.1 Explain Memory

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

W4118: OS Overview. Junfeng Yang

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

Chapter 1: Introduction

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

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

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

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

Chapter 1: Introduction

Operating System Review

Principles of Operating Systems

Lecture 1 Introduction (Chapter 1 of Textbook)

Chapter 1: Introduction. Chapter 1: Introduction

Operating Systems Overview. Chapter 2

Process Time. Steven M. Bellovin January 25,

Architectural Support for Operating Systems

Introduction to Operating Systems. Chapter Chapter

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS

Operating System Architecture. CS3026 Operating Systems Lecture 03

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

CS 333 Introduction to Operating Systems. Class 1 - Introduction to OS-related Hardware and Software

Introduction to Computer Systems and Operating Systems

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

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

Chapter 1: Introduction

CS370 Operating Systems

Operating System Labs. Yuanbin Wu

Mon Sep 17, 2007 Lecture 3: Process Management

CS370 Operating Systems

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

Exam Guide COMPSCI 386

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

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

John Wawrzynek & Nick Weaver

Processes and Threads

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I

csci3411: Operating Systems

Jan 20, 2005 Lecture 2: Multiprogramming OS

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

Computer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

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

Processes. Process Scheduling, Process Synchronization, and Deadlock will be discussed further in Chapters 5, 6, and 7, respectively.

CSE 153 Design of Operating Systems Fall 2018

Topic 18 (updated): Virtual Memory

Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - II OS Structures. University at Buffalo. OS Design and Implementation

OS Design Approaches. Roadmap. System Calls. Tevfik Koşar. Operating System Design and Implementation. CSE 421/521 - Operating Systems Fall 2013

Introduction to Operating System

Process Description and Control

CS420: Operating Systems

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

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

Unix API Books. Linux Kernel Books. Assignments and Exams. Grading for CSC 256. Operating Systems 8/31/2018. CSC 256/456 Fall

CSC 2405: Computer Systems II

Module 1 Introduction/OS Overview

Design Overview of the FreeBSD Kernel CIS 657

OPERATING SYSTEMS UNIT - 1

CSC 453 Operating Systems

Lecture 2 - Fundamental Concepts

EEE 435 Principles of Operating Systems

Linux Operating System

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

Objectives and Functions Convenience. William Stallings Computer Organization and Architecture 7 th Edition. Efficiency

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

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.

CS 111. Operating Systems Peter Reiher

Chapter 3: Operating-System Structures

Computer System Overview

Transcription:

CMPS 111: Introduction to Operating Systems Professor Scott A. Brandt sbrandt @cs.ucsc.edu http://ww w.cse.ucsc.edu/~sbrandt/111 Chapter 1

Class outline Introduction, concepts, review & historical perspective Processes Synchronization Scheduling Deadlock Memory management, address translation, and virtual memory Operating system management of I/O File systems Security & protection Distributed systems (as time permits) Chapter 1 2

Overview: Chapter 1 What is an operating system, anyway? Operating systems history The zoo of modern operating systems Review of computer hardware Operating system concepts Operating system structure User interface to the operating system Anatomy of a system call Chapter 1 3

What is an operating system? A program that runs on the raw hardware and supports Resource Abstraction Resource Sharing Abstracts and standardizes the interface to the user across different types of hardware Virtual machine hides the messy details which must be performed Manages the hardware resources Each program gets time with the resource Each program gets space on the resource May have potentially conflicting goals: Use hardware efficiently Give maximum performance to each user Chapter 1 4

Operating system timeline First generation: 1945 1955 Vacuum tubes Plug boards Second generation: 1955 1965 Transistors Batch systems Third generation: 1965 1980 Integrated circuits Multiprogramming Fourth generation: 1980 present Large scale integration Personal computers Next generation:??? Systems connected by high-speed networks? Wide area resource management? Chapter 1 5

First generation: direct input Run one job at a time Enter it into the computer (might require rewiring!) Run it Record the results Problem: lots of wasted computer time! Computer was idle during first and last steps Computers were very expensive! Goal: make better use of an expensive commodity: computer time Chapter 1 6

Second generation: batch systems Bring cards to 1401 Read cards onto input tape Put input tape on 7094 Perform the computation, writing results to output tape Put output tape on 1401, which prints output Chapter 1 7

Structure of a typical 2nd generation job Data for program $END FORTRAN program $RUN $LOAD $FORTRAN $JOB, 10,6610802, ETHAN MILLER Chapter 1 8

Spooling Original batch systems used tape drives Later batch systems used disks for buffering Operator read cards onto disk attached to the computer Computer read jobs from disk Computer wrote job results to disk Operator directed that job results be printed from disk Disks enabled simultaneous peripheral operation online (spooling) Computer overlapped I/O of one job with execution of another Better utilization of the expensive CPU Still only one job active at any given time Chapter 1 9

Third generation: multiprogramming Memory partitions Job 3 Job 2 Job 1 Operating system Multiple jobs in memory Protected from one another Operating system protected from each job as well Resources (time, hardware) split between jobs Still not interactive User submits job Computer runs it User gets results minutes (hours, days) later Chapter 1 10

Timesharing Multiprogramming allowed several jobs to be active at one time Initially used for batch systems Cheaper hardware terminals -> interactive use Computer use got much cheaper and easier No more priesthood Quick turnaround meant quick fixes for problems Chapter 1 11

Types of modern operating systems Mainframe operating systems: MVS Server operating systems: FreeBSD, Solaris Multiprocessor operating systems: Cellular IRIX Personal computer operating systems: Windows, Unix Real-time operating systems: VxWorks Embedded operating systems Smart card operating systems Some operating systems can fit into more than one category Chapter 1 12

Components of a simple PC Outside world Video controller Hard drive controller USB controller Network controller CPU Memory Computer internals (inside the box ) Chapter 1 13

CPU internals Fetch unit Decode unit Execute unit Fetch unit Decode unit Execute unit Buffer Execute unit Fetch unit Decode unit Execute unit Pipelined CPU Superscalar CPU Chapter 1 14

Storage pyramid Capacity Access latency < 1 KB Registers 1 ns Better 1 MB Cache (SRAM) 2 5 ns 256 MB Main memory (DRAM) 50 ns 40 GB Magnetic disk 5 ms Better > 1 TB Magnetic tape 50 sec Goal: really large memory with very low latency Latencies are smaller at the top of the hierarchy Capacities are larger at the bottom of the hierarchy Solution: move data between levels to create illusion of large memory with low latency Chapter 1 15

Disk drive structure Data stored on surfaces Up to two surfaces per platter One or more platters per disk Data in concentric tracks Tracks broken into sectors 256B-1KB per sector Cylinder: corresponding tracks on all surfaces Data read and written by heads Actuator moves heads Heads move in unison sector platter track cylinder surfaces spindle head actuator Chapter 1 16

Memory Address Address 0x2ffff 0x2b000 0x27fff 0x23000 User program and data User program and data Limit Base 0x2ffff 0x2d000 0x2bfff 0x29000 0x24fff 0x23000 User data User data User program Limit 2 Base 2 Limit 1 Base 1 0x1dfff 0x1dfff 0 Operating system 0 Operating system Single base/limit pair: set for each process Two base/limit registers: one for program, one for data Chapter 1 17

Anatomy of a device request 3 2 5 Interrupt Disk CPU controller controller 1 6 4 1: Interrupt Left: sequence as seen by hardware Request sent to controller, then to disk Instruction n Instruction n+1 Operating system Interrupt handler 2: Process interrupt 3: Return Disk responds, signals disk controller which tells interrupt controller Interrupt controller notifies CPU Right: interrupt handling (software point of view) Chapter 1 18

Operating systems concepts Many of these should be familiar to Unix users Processes (and trees of processes) Deadlock File systems & directory trees Pipes We ll cover all of these in more depth later on, but it s useful to have some basic definitions now Chapter 1 19

Processes B E A C F D G Process: program in execution Address space (memory) the program can use State (registers, including program counter & stack pointer) OS keeps track of all processes in a process table Processes can create other processes Process tree tracks these relationships A is the root of the tree A created three child processes: B, C, and D C created two child processes: E and F D created one child process: G Chapter 1 20

Inside a (Unix) process 0x7fffffff 0 Stack Data Data Text Processes have three segments Text: program code Data: program data Statically declared variables Areas allocated by malloc() or new Stack Automatic variables Procedure call information Address space growth Text: doesn t grow Data: grows up Stack: grows down Chapter 1 21

Deadlock Potential deadlock Actual deadlock Chapter 1 22

Hierarchical file systems Root directory bin cse faculty grads ls ps cp csh elm sbrandt kag amer4 stuff classes research stuff Chapter 1 23

Interprocess communication Processes want to exchange information with each other Many ways to do this, including Network Pipe (special file): A writes into pipe, and B reads from it A B Chapter 1 24

System calls Programs want the OS to perform a service Access a file Create a process Others Accomplished by system call Program passes relevant information to OS OS performs the service if The OS is able to do so The service is permitted for this program at this time OS checks information passed to make sure it s OK Don t want programs reading data into other programs memory! Chapter 1 25

Making a system call 0xffffffff User space Kernel space (OS) 0 4 3 1 2 Return to caller Trap to kernel Trap code in register Increment SP Call read Push arguments Dispatch 5 6 9 8 Sys call handler 7 Library (read call) User code System call: read(fd,buffer,length) Program pushes arguments, calls library Library sets up trap, calls OS OS handles system call Control returns to library Library returns to user program Chapter 1 26

System calls for files & directories Call fd = open(name,how) s = close(fd) n = read(fd,buffer,size) n = write(fd,buffer,size) s = lseek(fd,offset,whence) s = stat(name,&buffer) s = mkdir(name,mode) s = rmdir(name) s = link(name1,name2) s = unlink(name) Close an open file Read data from a file into a buffer Write data from a buffer into a file Move the current pointer for a file Get a file s status information (in buffer) Create a new directory Description Open a file for reading and/or writing Remove a directory (must be empty) Create a new entry (name2) that points to the same object as name1 Remove name as a link to an object (deletes the object if name was the only link to it) Chapter 1 27

More system calls Call pid = fork() pid=waitpid(pid,&statloc,options) s = execve(name,argv,environp) exit(status) s = chdir(dirname) s = chmod(name,mode) s = kill(pid,signal) seconds = time(&seconds) Description Create a child process identical to the parent Wait for a child to terminate Replace a process core image Terminate process execution and return status Change the working directory Change a file s protection bits Send a signal to a process Get the elapsed time since 1 Jan 1970 Chapter 1 28

A simple shell while (TRUE) { /* repeat forever */ type_prompt( ); /* display prompt */ read_command (command, parameters) /* input from terminal */ if (fork()!= 0) { /* fork off child process */ /* Parent code */ waitpid( -1, &status, 0); /* wait for child to exit */ } else { /* Child code */ execve (command, parameters, 0); /* execute command */ } } Chapter 1 29

Monolithic OS structure Main procedure Service routines Utility routines Chapter 1 30

Virtual machines System calls I/O instructions Calls to simulate I/O Real I/O instructions App 1 App 2 App 3 Linux VMware Windows NT VMware Linux Bare hardware FreeBSD VMware First widely used in VM/370 with CMS Available today in VMware Allows users to run any x86-based OS on top of Linux or NT Guest OS can crash without harming underlying OS Only virtual machine fails rest of underlying OS is fine Guest OS can even use raw hardware Virtual machine keeps things separated Chapter 1 31

Microkernels (client-server) Client process Client process Process server Terminal server File server Memory server User mode Microkernel Kernel mode Processes (clients and OS servers) don t share memory Communication via message-passing Separation reduces risk of byzantine failures Examples include Mach Chapter 1 32

Metric units Prefix Exp. Number Prefix Exp. Number 10-3 0.001 milli 10 3 1,000 Kilo 10-6 0.000001 micro 10 6 1,000,000 Mega 10-9 0.000000001 nano 10 9 1,000,000,000 Giga 10-12 0.000000000001 pico 10 12 1,000,000,000,000 Tera 10-15 0.000000000000001 femto 10 15 1,000,000,000,000,000 Peta 10-18 0.000000000000000001 atto 10 18 1,000,000,000,000,000,000 Exa Chapter 1 33