Chapter 1 1 CS 111, UC Santa Cruz Overview: Chapter 1  What is an operating system, anyway?  Operating systems history  The phylogeny of modern operating.

Slides:



Advertisements
Similar presentations
Introduction to Operating Systems
Advertisements

OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc
Chap 2 System Structures.
Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Winter 2005 CMPE 151: Network Administration Lecture 2.
1 Introduction Chapter What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5.
Chapter 1 Introduction 1.1 What is an operating system
Operating System Structure. Announcements Make sure you are registered for CS 415 First CS 415 project is up –Initial design documents due next Friday,
1 Introduction Chapter What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5.
Ceng Operating Systems 1-1 Chapter 1: Introduction What is the aim of the subject? Why are OSes important? What is an OS? A bit of history Some basic.
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
Chapter 1 Introduction 1.1 What is an operating system
1 What is an operating system? CSC330Patricia Van Hise.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
1 Chapter 1: Introduction What is the aim of the subject? What is the aim of the subject? Why are OSes important? Why are OSes important? What is an OS?
O PERATING S YSTEMS BIT OUTLINE Introduction, concepts, review & historical perspective Processes Synchronization Scheduling Deadlock Memory management,
Advanced Operating Systems
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
CS 6560 Operating System Design Lecture 1. Overview 1.1 What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4.
System Calls 1.
Chapter 1 CS 1550: Introduction to Operating Systems Prof. Ahmed Amer
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
 Introduction, concepts, review & historical perspective  Processes ◦ Synchronization ◦ Scheduling ◦ Deadlock  Memory management, address translation,
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3: Operating Systems Computer Science: An Overview Tenth Edition.
Introduction to Operating Systems Chapter 1. cs431 -cotter2 Lecture Objectives Understand the relationship between computing hardware, operating system,
1 Operating System Overview. 2 Today’s Objectives Explain the main purpose of operating systems and describe milestones of OS evolution Explain fundamental.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Chapter 1 Introduction 1.1 What is an operating system
ITEC 502 컴퓨터 시스템 및 실습 Chapter 1: Introduction. ITEC 502 컴퓨터 시스템 및 실습 Chapter 1: Introduction Mi-Jung Choi DPNM Lab. Dept. of CSE,
1 Instructor :Erdal Kose Office hours: Tuesday 9:00-9:30 pm. Mail box : 2109 Ingersoll Hall (Erdal ) Web site :
1 Introduction Chapter What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 E-Main: Phone:
1 Introduction. 2 A computer system consists of –hardware –system programs –application programs.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 1 Introduction Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview Part 2: History (continued)
Background: Operating Systems Brad Karp UCL Computer Science CS GZ03 / M th November, 2008.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Processes Introduction to Operating Systems: Module 3.
Copyright ©: University of Illinois CS 241 Staff1 Operating Systems Orientation.
Computer Basics. Samples of Operating Systems IBSYS (IBM 7090) OS/360 (IBM 360) TSS/360 (360 mod 67) Michigan Terminal System CP/CMS & VM 370 MULTICS.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
CIS250 OPERATING SYSTEMS Chapter One Introduction.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Operating System Overview Tarek Abdelzaher Lawrence Angrave Vikram Adve.
Chapter 1 Introduction  What is an operating system  History of operating systems  The operating system zoo  Computer hardware review  Operating system.
操作系统原理 OPERATING SYSTEM Chapter 1 Introduction 概 述.
L ECTURE -6 Topics: Introduction to Operating system. Functions of an Operating system. Classification of Operating systems.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Operating Systems: History, Hardware & Concepts Ch 1.4 & 1.5 Thursday, January 18, 2007.
Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved OPERATING SYSTEMS DESIGN.
10/2/20161 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
Introduction to Operating Systems Concepts
Computer System Structures
Operating System Overview
Operating System Structure
Avani R.Vasant V.V.P. Engineering College
CS 3305 System Calls Lecture 7.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Chapter 1 Introduction to Operating System Part 5
Lecture Topics: 11/1 General Operating System Concepts Processes
Introduction and Overview
Presentation transcript:

Chapter 1 1 CS 111, UC Santa Cruz Overview: Chapter 1  What is an operating system, anyway?  Operating systems history  The phylogeny 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 2 CS 111, UC Santa Cruz What is an operating system?  It’s a program that runs on the “raw” hardware Acts as an intermediary between computer and users Standardizes the interface to the user across different types of hardware: extended machine  Hides the messy details which must be performed  Presents user with a virtual machine, easier to use  It’s a resource manager 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 3 CS 111, UC Santa Cruz 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: ??? (maybe 2001–?) Systems connected by high-speed networks? Wide area resource management? Peer-to-peer systems?

Chapter 1 4 CS 111, UC Santa Cruz 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 5 CS 111, UC Santa Cruz 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 6 CS 111, UC Santa Cruz $END $RUN $LOAD Structure of a typical 2nd generation job $FORTRAN $JOB, 10, , ETHAN MILLER FORTRAN program Data for program

Chapter 1 7 CS 111, UC Santa Cruz 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 on- line (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 8 CS 111, UC Santa Cruz Operating system Third generation: multiprogramming  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 Job 1 Job 2 Job 3 Memory partitions

Chapter 1 9 CS 111, UC Santa Cruz 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 10 CS 111, UC Santa Cruz Types of modern operating systems  Mainframe operating systems: MVS  Server operating systems: FreeBSD, Solaris, Linux  Multiprocessor operating systems: Cellular IRIX  Personal computer operating systems: MacOS X, Windows XP, Linux (?)  Real-time operating systems: VxWorks  Embedded operating systems  Smart card operating systems  Some operating systems can fit into more than one category

Chapter 1 11 CS 111, UC Santa Cruz Components of a simple PC Hard drive controller Memory USB controller Network controller Outside world CPU Computer internals (inside the “box”) Video controller

Chapter 1 12 CS 111, UC Santa Cruz Execute unit Buffer Fetch unit Decode unit Fetch unit Decode unit Fetch unit Decode unit CPU internals Pipelined CPU Superscalar CPU

Chapter 1 13 CS 111, UC Santa Cruz Access latency 1 ns 2–5 ns 50 ns 5 ms 50 sec < 1 KB 1 MB 1 GB 200 GB > 1 TB Capacity Registers Cache (SRAM) Main memory (DRAM) Magnetic disk Magnetic tape Better Storage pyramid  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 14 CS 111, UC Santa Cruz sector cylinder platter spindle track head actuator surfaces 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  512B per sector Cylinder: corresponding tracks on all surfaces  Data read and written by heads Actuator moves heads Heads move in unison

Chapter 1 15 CS 111, UC Santa Cruz Memory User program and data Operating system Address 0x1dfff 0x x27fff 0x2b000 0x2ffff 0  Single base/limit pair: set for each process  Two base/limit registers: one for program, one for data Base Limit User data User program Operating system User data Base 1 Limit 2 Limit 1 Base 2 Address 0x1dfff 0x x x2bfff 0x2ffff 0 0x2d000 0x24fff

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

Chapter 1 17 CS 111, UC Santa Cruz 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 18 CS 111, UC Santa Cruz Processes  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 A B EF CD G

Chapter 1 19 CS 111, UC Santa Cruz Inside a (Unix) process  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” Stack Data Text 0x7fffffff 0 Data

Chapter 1 20 CS 111, UC Santa Cruz Deadlock Potential deadlock Actual deadlock

Chapter 1 21 CS 111, UC Santa Cruz Root directory bin cse facultygrads lspscpcsh Hierarchical file systems elmsbrandtrgheroqxin stuff 80s musicresearch stuff

Chapter 1 22 CS 111, UC Santa Cruz 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 AB

Chapter 1 23 CS 111, UC Santa Cruz System calls  OS runs in privileged mode Some operations are permitted only in privileged (also called supervisor or system) mode  Example: access a device like a disk or network card  Example: change allocation of memory to processes User programs run in user mode and can’t do the operations  Programs want the OS to perform a service Access a file Create a process Others…  Accomplished by system call

Chapter 1 24 CS 111, UC Santa Cruz How system calls work  User program enters supervisor mode Must enter via well-defined entry point  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!  OS needs to be paranoid! Users do the darnedest things….

Chapter 1 25 CS 111, UC Santa Cruz Making a system call  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 Return to caller Trap to kernel Trap code in register Increment SP Call read Push arguments Dispatch Sys call handler Kernel space (OS) User space 0xffffffff Library ( read call) User code

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

Chapter 1 27 CS 111, UC Santa Cruz CallDescription pid = fork() Create a child process identical to the parent pid=waitpid(pid,&statloc,options) Wait for a child to terminate s = execve(name,argv,environp) Replace a process’ core image exit(status) Terminate process execution and return status s = chdir(dirname) Change the working directory s = chmod(name,mode) Change a file’s protection bits s = kill(pid,signal) Send a signal to a process seconds = time(&seconds) Get the current time More system calls

Chapter 1 28 CS 111, UC Santa Cruz A simple shell while (TRUE) {/* repeat forever */ print_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 CS 111, UC Santa Cruz Operating system structure  OS is composed of lots of pieces Memory management Process management Device drivers File system  How do the pieces of the operating system fit together and communicate with each other?  Different ways to structure an operating system Monolithic  Modular is similar, but more extensible Virtual machines Microkernel

Chapter 1 30 CS 111, UC Santa Cruz Monolithic OS structure Main procedure Service routines Utility routines  All of the OS is one big “program” Any piece can access any other piece  Sometimes modular (as with Linux) Extra pieces can be dynamically added Extra pieces become part of the whole  Easy to write, but harder to get right…

Chapter 1 31 CS 111, UC Santa Cruz Virtual machines  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 Bare hardware Linux VMware Linux App 1 App 2 App 3 VMware Windows NTFreeBSD I/O instructions System calls Calls to simulate I/O “Real” I/O instructions

Chapter 1 32 CS 111, UC Santa Cruz Microkernel Client process Process server Terminal server Client process File server Memory server … User mode Kernel mode Microkernels (client-server)  Processes (clients and OS servers) don’t share memory Communication via message-passing Separation reduces risk of “byzantine” failures  Examples include Mach (used by MacOS X)