Module 1 Introduction/OS Overview

Similar documents
Chapter 2: Operating-System Structures

Chapter 2: Operating-System Structures. Chapter 2: Operating-System Structures. Objectives. Operating System Services

Chapter 2: Operating-System Structures

Chapter 2: Operating-System Structures

Chapter 2: Operating-System Structures

Operating System Services

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

Objectives. Chapter 2: Operating-System Structures. 2.1 Operating System Services

Chapter 2. Operating-System Structures

Chapter 2: Operating-System

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

Operating Systems Course 2 nd semester 2016/2017 Chapter 1: Introduction

Operating-System Structures

Four Components of a Computer System

Lecture 2 Operating System Structures (chapter 2)

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

Chapter 2: Operating-System Structures

CS420: Operating Systems. OS Services & System Calls

Chapter 2: System Structures

CS307: Operating Systems

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

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

Chapter 2: System Structures

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

OPERATING SYSTEMS UNIT - 1

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

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

Lecture 1 Introduction (Chapter 1 of Textbook)

OPERATING SYSTEMS Lecture Notes. Prepared by K.Rohini, Assistant Professor, CSE Department, GVPCEW.

Chapter 1: Introduction

Chapter 3: Operating-System Structures

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

CS370 Operating Systems

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

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

Operating-System Structures

Chapter 2 Operating-System Structures

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-System Structures

Chapter 3: Operating-System Structures

European University of Lefke. Instructor: Dr. Arif SARI

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Chapter 1: Introduction

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

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

Chapter 3: Operating-System Structures

CS3600 SYSTEMS AND NETWORKS

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

Chapter 1: Introduction

Chapter 1: Introduction. Chapter 1: Introduction

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

Chap2: Operating-System Structures

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - VII CPU Scheduling - II. Louisiana State University

Roadmap. Multilevel Queue Scheduling. Multilevel Queue. Example of Multilevel Feedback Queue. Multilevel Feedback Queue. Tevfik Ko!

UNIT 2. OPERATING SYSTEM STRUCTURES

Module 3: Operating-System Structures. Common System Components

Chapter 1: Introduction. Operating System Concepts 9 th Edit9on

DM510 Operating Systems. Jacob Aae Mikkelsen

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

Introduction to Operating Systems (Part II)

Chapter 2. Operating System Structures

Chapter 1: Introduction Dr. Ali Fanian. Operating System Concepts 9 th Edit9on

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

Overview of Operating Systems

Often, more information is required when designing system call Information varies according to OS and types of system call

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

Operating System Structure

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

Module 3: Operating-System Structures

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

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

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

Operating System Structure

OPERATING SYSTEMS. Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne

Overview of Operating Systems

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

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

Architectural Support for Operating Systems. Jinkyu Jeong ( Computer Systems Laboratory Sungkyunkwan University

Chapter 1: Introduction. Operating System Concepts 8th Edition,

Operating System Structure

SRIMAAN COACHING CENTRE-TRB-COMPUTER INSTRUCTORS STUDY MATERIAL CONTACT: III

Chapter 1: Introduction

Part I Overview Chapter 1: Introduction

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

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

Introduction CHAPTER. Practice Exercises. 1.1 What are the three main purposes of an operating system? Answer: The three main puropses are:

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

Operating System Concepts Ch. 2: Operating System Structures

Chapter 1: Introduction

Operating System Review

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

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

CSE 4/521 Introduction to Operating Systems

CHAPTER 1 - INTRODUCTION. Jacob Aae Mikk elsen

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

CS370 Operating Systems

Transcription:

Module 1 Introduction/OS Overview Reading: Chapter 1 and 2 (Silberchatz) Objective: Quick overview of computer system organization the processor (CPU), memory, and input/output, architecture and general operations. Introduce operating systems to understand its role and principal functions. 1

Organization Computer System Operating System 2

Memory Device Controllers Bus CPU Hardware Organization Computer System Operating System 3

Computer System Organization Computer-system operation One or more CPUs, device controllers connected through common bus providing access to shared memory Concurrent execution of CPUs and devices competing for memory cycles 4

Memory Device Controllers Bus CPU Hardware Organisation Storage Structure Computer System Operating System Secondary Storage Main Memory 5

Storage Structure Primary storage Main memory, directly accessible by the CPU Program must be in main memory in order to be executed Main memory usually not large enough to hold all programs and data Main memory is volatile loses contents on power loss/reboot Secondary storage holds large quantities of data, permanently In general, we have a hierarchy of storage devices varying by speed, cost, size and volatility 6

Storage-Device Hierarchy 7

Memory Device Controllers Bus CPU Hardware Organisation Storage Structure Computer System Operating System Direct I/O I/O Structure Secondary Storage Main Memory Interrupt Driven DMA 8

I/O Structure Controller has registers for accepting commands and transferring data (i.e. data-in, data-out, command, status) Device driver for each device controller talks to the controller The driver is the one who knows details of controller Provides uniform interface to kernel 9 I/O operation Device driver loads controller registers appropriately Controller examines registers, executes I/O

I/O Structure How does the driver know when the I/O completes? Periodically read the status register Called direct I/O Low overhead if I/O is fast If I/O is slow, lots of busy waiting Any idea how to deal with slow I/O? Do something else and let the controller signal device driver (raising and interrupt) that I/O has completed Called interrupt-driver I/O More overhead, but gets rid of busy waiting 10

Interrupt Timeline 11

I/O Structure Interrupt driven I/O still has lots of overhead if used for bulk data transfer An interrupt for each byte is too much Ideas? Have a smart controller that can talk directly with the memory Tell the controller to transfer block of data to/from memory The controller raises interrupt when the transfer has completed Called Direct Memory Access (DMA) 12

How a Modern Computer Works 13

Memory Multi processor Clusters Distributed Single * processor Device Controllers Bus CPU Hardware Architecture Organisation Storage Structure Computer System Operating System Direct I/O I/O Structure Secondary Storage Main Memory Interrupt Driven DMA 14

Computer-System Architecture 15 Single-processor system From PDAs to mainframes Almost all have special-purpose processors for graphics, I/O Not considered multiprocessor Multi-processor systems Increase throughput Economy of scale Increased reliability Asymmetric multiprocessing Each processor assigned a specific task Symmetric multiprocessing (SMP) most common All processors perform tasks within the OS Clusters, distributed systems

Memory Multi processor Clusters Distributed Single * processor Device Controllers Bus CPU Hardware Architecture Organisation Storage Structure Computer System Operating System User View Direct I/O I/O Structure Secondary Storage Main Memory Services What is it? Interrupt Driven DMA User Interface GUI or CLI 16

The Role of the Operating System 17

User View of a Computer This is my box, only I am using it i.e. desktop system with one user monopolizing its resources OS maximizes the work (or play) user is performing OS designed mostly for ease of use, not for resource utilization Handheld systems usability + low hardware demands This is The Big Holy Computer, I am blessed to get some CPU time i.e. mainframe or minicomputer OS is designed to maximize resource use (CPU, memory, I/O) Communism in practice - Let s share our computers i.e. workstations connected to network of servers Dedicated and shared resources OS compromises between individual usability and resource utilization What? There is a computer inside?! Embedded systems designed to run without user intervention 18

Why Operating Systems? If there are several users/applications sharing the computer i.e. Big Holy Computer who should get which resources? when? what is each user/application allowed to do? how should we bill the users? Ok, ok, if there are many users/programs, something has to manage them, but what if there is single user? (i.e. for my desktop/pda)? hardware abstraction I might still want to run several applications concurrently 19

20 What Operating Systems Do? Give me a 1-2 sentence summary of what OS does OS is program most involved with the hardware hardware abstraction OS is a resource allocator Manages all resources Decides between conflicting requests for efficient and fair resource use OS is a control program Controls execution of programs to prevent errors and improper use of the computer

21 Defining Operating Systems So, what is an operating system? No universally accepted definition Everything a vendor ships when you order an operating system is good approximation But varies wildly (see system programs) The one program running at all times on the computer is the one generally used in this course This is the kernel Everything else is either a system program (ships with the operating system) or an application program Ha! What does it mean running at all times? When I am playing Tetris, Tetris is running on the CPU, no?

System Programs Are these part of the Operating System? Whatever is not in the kernel, but is shipped with the OS Of course, depends on the OS and the vendor Provide a lot of system-type functionality, i.e. most commands you type in Unix CLI (Command Line Interface) are not shell commands, but standalone system programs that perform system tasks Most users view of the operation system is defined by system programs, not the actual system calls 22

System Programs System programs provide a convenient environment for program development and execution. The can be divided into: File management i.e. copy, rm, ls, mkdir Status information i.e. ps, who, regedit File modification - editors Programming language support i.e. cc, javac Program loading and execution loaders, debuggers Communications ssh, ftp Also called system utilities Application programs browsers, spreadsheets, games 23

Operating System Services Services provided to user programs: I/O operations User program cannot directly access I/O hardware, OS does the low level part for them Communications Both inter-process on the same computer, and between computers over a network via shared memory or through message passing Error detection Errors do occur: in the CPU and memory hardware, in I/O devices, in user programs OS should handle them appropriately to ensure correct and consistent computing Low level debugging tools really help 24

25 Operating System Services (Cont.) Services for ensuring efficient operation of the system itself Resource allocation and management Needed when there are multiple users/ multiple jobs running concurrently Some resources need specific management code CPU cycles, main memory, file storage Others can be managed using general code - I/O devices Accounting Which users use how much and what kinds of computer resources Protection and security Between different processes/user in the computer From the outsiders in a networked computer system Protection: ensuring that all access to system resources is controlled Security: user authentication, defending external I/O devices from invalid access attempts

OS interface for users - CLI Command Line Interface allows direct command entry from keyboard Command interpreter is itself a program that reads command lines typed in by the user Often called a shell (UNIX terminology) Execution of commands accomplished in one of two ways The command interpreter executes the command itself Programming instructions allow command interpreters to execute shell programs The command is used to invoke a separate program (system program) 26

OS interface for users - GUI User-friendly desktop metaphor interface Usually mouse, keyboard, and monitor Icons represent files, programs, actions, etc Various mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory Invented at Xerox PARC Many systems now include both CLI and GUI interfaces Microsoft Windows is GUI with CLI command shell Apple Mac OS X as Aqua GUI interface with UNIX kernel underneath and shells available Solaris and Linux are CLI with optional GUI interfaces (Java Desktop, KDE) 27

CLI vs GUI So, which one is better? What would your grandma prefer? True hacker would never use GUI! By definition, anybody using GUI is wimp, not a true hacker! Depends on what you want to do GUI benefits Intuitive, easy to use Ha! If well designed not always. CLI benefits Easier to execute complex commands 28

OS Interfaces CLI and GUI interfaces for the user What other interfaces the Operating Systems have? Interface to the programs running on the computer and requesting OS services System Call interface Interface to the hardware Interrupts, drivers device controllers Shall talk about the System Call interface a little later We will talk about the interface to the hardware in Ch13 - Kernel I/O subsystem 29

Memory Multi processor Clusters Distributed Input/Output Management Memory Management Single * processor Process Manag. Device Controllers Dual Mode Bus CPU Hardware Architecture Organisation Storage Structure Computer System Operating System Operation User View Direct I/O I/O Structure Secondary Storage Main Memory Services What is it? Interrupt Driven DMA User Interface GUI or CLI 30

Operating-System Operations 31 OS is interrupt driven Interrupts raised by hardware and software Mouse click, division by zero, request for operating system service Timer interrupt (i.e. process in an infinite loop), memory access violation (processes trying to modify each other or the operating system) Some operations should be performed only by a trusted party Accessing hardware, memory-management registers A rogue user program could damage other programs, steal the system for itself, Solution: dual-mode operation

Transition from User to Kernel Mode Dual-mode operation allows OS to protect itself and other system components User mode and kernel mode Mode bit provided by hardware Provides ability to distinguish when system is running user code or kernel code Some instructions designated as privileged, only executable in kernel mode System call changes mode to kernel, return from call resets it to user 32

System Calls Programming interface to the services provided by the OS Process control i.e. launch a program File management i.e. create/open/read a file, list a directory Device management i.e. request/release a device Information maintenance i.e. get/set time, process attributes Communications i.e. open/close connection, send/receive messages 33

System Calls Typically written in a high-level language (C or C++) Called from user program by invoking trap instruction Software interrupt that sets the mode bit to kernel mode and jumps to the appropriate routine, chosen from the system call table based on the provided trap number Linux example: http://docs.cs.up.ac.za/programming/asm/derick_tut/syscall s.html Upon completion, the mode is switched back to user mode and status of the system call and any return values are returned 34

API System Call OS Relationship 35

Accessing System Calls Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use Three most common APIs: Win32 API for Windows POSIX API for POSIX-based systems UNIX, Linux, and Mac OS X Java API for the Java virtual machine (JVM) The caller need know nothing about how the system call is implemented Just needs to obey API and understand what OS will do as a result call Most details of OS interface hidden from programmer by API Managed by run-time support library (set of functions built into libraries included with compiler) 36

Standard C Library Example C program invoking printf() library call, which calls write() system call 37

Main Operations of an Operating System Process Management Program is passive, process is active, unit of work within system OS manages resources required by processes CPU, memory, I/O, files Initialization data OS manages process activities: e.g. creation/deletion, interaction between processes, etc. Memory Management Memory management determines what and when is in memory to optimize CPU utilization and computer response to users Storage Management OS provides uniform, logical view of information storage File Systems, Mass Storage Management I/O SubSystem One purpose of OS is to hide peculiarities of hardware devices from the user 38

39 Memory Multi processor Clusters Distributed Input/Output Management Memory Management Single * processor Process Manag. Device Controllers Dual Mode Bus CPU Hardware Architecture Organisation Storage Structure Computer System Operating System Operation Different Flavors User View Design issues Direct I/O I/O Structure Secondary Storage Main Memory Services What is it? Modules Virtual Machine Micro Kernel Interrupt Driven DMA User Interface GUI or CLI Structure Layer

Operating System Design and Implementation The design is primarily affected by choice of hardware and the type of system Batch, time-shared, single-user, multi-user, distributed, real-time, general purpose User goals and System goals User goals operating system should be convenient to use, easy to learn, reliable, safe, and fast System goals operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient Implementation Traditionally in assembler Nowadays mostly in C, with small assembler sections (drivers, saving/restoring registers) 40

Operating System Structure Internal structure of different OSes can vary widely As the requirements vary widely Low hardware resources, simple functionality Simple, monolithic structure More functionality & resources Layered structure MSDOS and traditional Unix are OS-es with monolithic structure that uses some layering Even more functionality & resources, focus on clean design and flexibility Microkernel structure (MACH, QNX, early Windows NT) Flexibility & efficiency Modular structure (Solaris, Windows NT) 41

Traditional UNIX System Structure UNIX was created as a simple, relatively low functionality alternative to the complex mainframe OSes of that time 42

Virtual Machines A virtual machine takes the layered approach to its logical conclusion. It treats hardware and the operating system kernel as though they were all hardware A virtual machine provides an interface identical to the underlying bare hardware The VM creates the illusion of multiple computer system, each executing on its own processor with its own (virtual) memory 43

System Models Non-virtual Machine Virtual Machine (a) Nonvirtual machine (b) virtual machine 44

Virtual Machines - Implementation How to create several VM when we have only one set of hardware resources? Sharing resources CPU Time-shared scheduling Printers/card readers Spooling Memory HD Virtual memory Ha! Its not possible to have full HD for each VM! Other problems: real-time aspects 45

Advantages/Disadvantages of Virtual Machines Advantage: Complete protection/isolation of system resources between VMs Perfect vehicle for operating-systems research and development If the OS you are developing crashes, just restart the VM Useful when you have applications for different OSs Disadvantage No direct sharing of resources between different VMs Difficult to implement completely 46

Example: VMware Architecture 47

The Java Virtual Machine 48

We are not going to talk about Distributed systems Real-time embedded systems Multimedia systems Handheld systems Different computing environments Peer to peer computing Web-based computing 49

50 Memory Multi processor Clusters Distributed Input/Output Management Memory Management Single * processor Process Manag. Device Controllers Dual Mode Bus CPU Hardware Architecture Organisation Storage Structure Computer System Operating System Operation User View Design Differentissues Flavors Direct I/O I/O Structure Secondary Storage Main Memory Services What is it? Modules Virtual Machine Micro Kernel Interrupt Driven DMA User Interface GUI or CLI Structure Layer