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

Similar documents
Operating Systems 2010/2011

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

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

Four Components of a Computer System

Operating System Services

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

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

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Lecture 2 - Fundamental Concepts

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals

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

Introduction to Operating Systems. Chapter Chapter

Operating Systems 2010/2011

CS370 Operating Systems

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

Introduction to Operating. Chapter Chapter

Module 2: Computer-System Structures. Computer-System Architecture

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

Introduction to Operating Systems. Chapter Chapter

Lecture 1 Introduction (Chapter 1 of Textbook)

CS370 Operating Systems

Part I Overview Chapter 1: Introduction

ELEC 377 Operating Systems. Week 1 Class 2

I/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Lecture 2 Operating System Structures (chapter 2)

Chapter 2. Operating-System Structures

Hardware OS & OS- Application interface

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

Module 1 Introduction/OS Overview

Lecture 5: Process Description and Control Multithreading Basics in Interprocess communication Introduction to multiprocessors

Process Description and Control

Operating System Review

CS3600 SYSTEMS AND NETWORKS

Computer-System Architecture (cont.) Symmetrically Constructed Clusters (cont.) Advantages: 1. Greater computational power by running applications

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

Computer-System Structures

C02: Interrupts and I/O

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

Operating System: Chap2 OS Structure. National Tsing-Hua University 2016, Fall Semester

Introduction to Computer Systems and Operating Systems

Chapter 1: Introduction

Chapter 1: Introduction. Operating System Concepts 9 th Edit9on

Chapter 2: Operating-System Structures

CS420: Operating Systems

Instruction Cycle. Computer-System Architecture. Computer-System Operation. Common Functions of Interrupts. Chapter 2: Computer-System Structures

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

Chapter 2: Operating-System Structures

Chapter 2: Operating-System Structures

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

Computer-System Architecture

Computer-System Architecture. Common Functions of Interrupts. Computer-System Operation. Interrupt Handling. Chapter 2: Computer-System Structures

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

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

Chapter 13: I/O Systems

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

Common Computer-System and OS Structures

Operating System Architecture. CS3026 Operating Systems Lecture 03

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

Chapter 1: Introduction

CS420: Operating Systems. OS Services & System Calls

Distributed Systems Operation System Support

Lecture 4: Memory Management & The Programming Interface

Chapter 1: Introduction

Chapter 1: Introduction. Chapter 1: Introduction

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

Processes. Johan Montelius KTH

Last class: Today: Course administration OS definition, some history. Background on Computer Architecture

Chapter 2: Operating-System Structures

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 2: Operating-System Structures. Chapter 2: Operating-System Structures. Objectives. Operating System Services

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

A process. the stack

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

CS420: Operating Systems

I/O Design, I/O Subsystem, I/O-Handler Device Driver, Buffering, Disks, RAID January WT 2008/09

Protection and System Calls. Otto J. Anshus

COS 318: Operating Systems

OPERATING SYSTEM OVERVIEW

Chapter 2: Operating-System Structures

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester

Computer Architecture and OS. EECS678 Lecture 2

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

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

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

Operating-System Structures

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

1 System & Activities

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

Chapter 1 Computer System Overview

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

Unit 2 : Computer and Operating System Structure

Introduction. CS3026 Operating Systems Lecture 01

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

Anne Bracy CS 3410 Computer Science Cornell University

Computer System Architecture. CMPT 300 Operating Systems I. Summer Segment 3: Computer System Architecture. Melissa O Neill

Computer System Overview

Chapter 2: Operating-System

Architectural Support for Operating Systems

Transcription:

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

Course Overview Introduction to operating systems Processes, threads and scheduling Concurrency atomicity and interference action synchronization condition synchronization deadlock Memory management Input/output general issues file systems 2

Agenda Course overview OS: place in the computer system Some common notions Motivation & OS tasks Extra-functional requirements 3

Agenda Course overview OS: place in the computer system Some common notions Motivation & OS tasks Extra-functional requirements 4

Elements of a computer system Users humans machines Software application programs OS, system programs Hardware CPU, memory (storage), battery input/output devices USER DATA & APPs OS HW Images from Techstereo 5

Computer system hardware BUS HW operates at a very low abstraction level compared to user programs. A mediator in between is needed. HW resources are shared among running programs (in time / in space). A burden that must be taken away from the programmer. HW can be expensive. Use of HW resources needs to be optimized. 6

Operating system (not a formal definition): is a piece of software that acts as an intermediary between users/applications and computer hardware. provides a level of abstraction that hides the gory details of the HW architecture from applications. organizes sharing of HW resources among applications and users (virtualization), maximizes computer performance (resource management). OS kernel: The one program that runs at all times on a computer. Everything else is either a system program or an application program. 7

OS: place in computer system Privileged instructions are only executable inside the kernel (i.e. in kernel mode)! separation between kernel and user mode Chrome Dropbox Outlook 8

How a computer works CPU and I/O devices execute concurrently I/O: data transfer between device and the local buffer of device controller CPU does other things in the meantime Device controller (hardware) informs CPU that the device is ready for I/O by means of an interrupt CPU moves data between MM and these local buffers Alternative: Direct Memory Access (DMA) 9

OS s are interrupt driven An interrupt is a signal to the CPU that transfers control to an interrupt service routine caused by hardware (e.g. clock tick, ready for i/o, i/o completion) interrupt vector contains addresses of all service routines OS preserves CPU state by storing registers and program counter (address of the interrupted instruction is saved) A trap or exception is a softwaregenerated interrupt caused either by a software error (e.g. division by zero, floating pt error) or by a system call (explicit SuperVisor Call or SVC), in line with control flow of program 10

OS: Dual-mode operation Different privileges required for different types of code most instructions (user code) can be executed in user mode some privileged instructions are only executable in kernel mode Dual-mode allows OS to protect itself and other system components Mode bit provided by hardware Provides ability to distinguish when system is running user code or kernel code System call changes mode to kernel, return from call resets it to user 11

Example interaction with OS: read data from file Interaction is named a system call Execute C language statement: status = read(fd, buffer, nbytes); is part of a program running on top of the OS read nbytes bytes from fd, storing it in buffer memory: kernel space/user space kernel space only accessible with processor in kernel mode parameters: either via registers or via memory 1-3: pushing parameters 4: call library function read 5: put code for read in reg. 6: trap (Linux@x86: int 0x80): switch mode & call trap handler 7: handler calls read function handler 8: handler performs read actions (store data at address). Here suspension of the calling process may occur if data needs to come from an i/o device. 9-11: give control back to caller suspension possible picture from slide by A.S. Tanenbaum 12

status = read(fd, buffer, nbytes); The filepointer, fd, refers to a data structure (probably within the kernel space) that stores information where the file is to be found current access state (particularly, the read position)... The requested data can be found in system buffers that store disk blocks already available or needing disk access Copying data from disk to these buffers is by hardware read requests that specify disk block and destination buffer issue the disk operation and wait for completion interrupt The file system may do look-aheads concurrently with user activities When this data is not available in system buffers at the time of reading, this results in the suspension of the calling process. Similar suspension occurs when the process has consumed its alotted time. 13

Agenda Course overview OS: place in the computer system Some common notions Motivation & OS tasks Extra-functional requirements 14

Policy vs mechanism Policy: defines what you want a system (e.g. an OS) to do Mechanism: defines how to do it Policies need appropriate mechanisms for their realization. Examples: policy: increase home-ownership mechanism: tax deduction policy: execute first the task with the earliest deadline mechanism: priority based scheduling & pre-emption 15

Transparency Hide details with respect to a given issue. Examples: processor architecture (Instruction Set Architecture - ISA) mechanism: use compiler physical memory size mechanism: virtual memory physical memory location mechanism: indirection using logical memory address 16

Virtualization Provides a simple, abstract, logical model of the system virtual memory, virtual CPU, virtual disk Current systems virtualize the entire hardware virtual machine Main Memory 17

Layering and virtualization An OS layer with a well-defined API yields a virtual machine for a programmer, the virtual machine is what he sees porting programs amounts to porting such virtual machines Virtualization can support several OS s on top of one OS (right) Implemented on a run-time virtualization layer (e.g. Vmware, VirtualBox) This virtualization can go down to immediately above the hardware (left)

Other examples of virtual machines Java virtual machine compilation Common Language Runtime comp.net Framework 19

Agenda Course overview OS: place in the computer system Some common notions Motivation & OS tasks Extra-functional requirements 20

OS Motivation: Deal with diversity CPU and main memory are required for basic operation There are many alternatives diverse CPUs Instruction Set Architectures diverse architectures (a) multi processor with shared memory (e.g. current multi-core systems) (b) multi computer with private memory and shared file system (e.g. cluster) (c) independent computers on a network (e.g. cluster, but also, internet-connected machines) 21

OS Motivation: Transparency and Virtualization OS task: e.g. hide inner workings and details of processing platform Transparency: Processor architecture, # processors, particular devices note: also compiler plays a role in this e.g. abstract from the complicated memory hierarchy and physical limitations Virtualization: present linear memory model that is larger than physical called: memory virtualization registers cache main memory solid-state disk magnetic disk optical disk magnetic tapes 22

OS Motivation: Shared functionality Large collection of services needed by virtually all programs... User interface (UI) e.g. Command-Line (CLI), Graphical User Interface (GUI), Batch Program execution load a program into MM and run end execution, either normally or abnormally (indicating error) I/O operations File-system management Communication between processes e.g. via shared memory or through message passing (packets) Error detection Debugging facilities Resource sharing & allocation CPU cycles, main memory, file storage, I/O devices (using timers) Accounting Who s using which resources for how long? Protection concurrent processes should not interfere with each other (memory) Security of the system against running processes and outsiders 23

OS Motivation: Shared functionality OS task: provide functionality common to most programs introduce well-defined abstractions of concepts files and filesystems instead of disk blocks exceptions and traps rather than something goes wrong linear memory rather than memory blocks, pages and disk space provide system calls for functions provided by the OS 24

OS shared functionality: System calls Programming interface to the services provided by the OS, typically written in a high-level language (C or C++) 25

OS shared functionality: System calls System calls are mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use Win32 API for Windows, POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X), Java API for the Java Virtual Machine (JVM), Cocoa Touch for ios, Java based Android API for Android (runs on top of Dalvik VM). Why are API s needed? 1) direct system calls are more difficult to work with than an API 2) system calls can be very frequent 3) a program written using an API can compile/run on any system supporting the API. 26

Types of system calls Process management create, destroy, communication, synchronization,... File management open, close, read, write,... Memory management allocation, free, virtual memory,... Device management access control, open, attach, send/receive,... Communications setup communications, exchange messages,... Miscellaneous timers, inspect system resources,... 27

Example of system calls System call sequence to copy the contents of one file to another file 28

OS Motivation: Concurrency The machine must be shared: multiple activities ( tasks, processes ) & multiple users devices and processor(s) operate concurrently (unavoidable) many common OS tasks are always running; termination is rare efficiency: utilize waiting times OS task: realize concurrency transparency (virtualization) each task virtually has a (virtual) machine of its own manage and protect (enforce) resource usage limits between tasks and between users resources: processor, memory, i/o equipment, keyboard, mouse, screen, disks, network and other communication facilities,... 29

OS Motivation: Portability Protect investments in application software support source code portability OS task (or: design criterion) give a unified machine view to applications i.e., a portable view, a good abstraction of commonly used architectures standardize on the API effectively, define a virtual machine POSIX (Portable Operating System Interface for Unix) initiative 30

Agenda Course overview OS: place in the system Some commons notions Motivation & OS tasks Extra-functional requirements 31

OS extra-functional requirements Efficiency the sacrificed efficiency (of having an OS rather than direct access) should be reasonable applications must be able to obtain close-to-optimal machine use tweak-able control by programmer example: provide raw disk access as well as file systems rule of thumb: if a (new) function can be implemented with the available ones, don t provide it (unless this indirect implementation needs to sacrifice an unreasonable amount of performance) 32

OS extra-functional requirements Extensibility support for adding application-specific (domain-specific) functionality Scalability wide range of environments, functionalities, machines Dependability robust, correct, safe & secure How dependable? à depends on the application domain 33

Domain-specific requirements Real-time OS predictability known performance instead of high performance (all resources) maximum latencies (response times) of API calls support for dealing with real-time control (pre-emptive) scheduling policies explicit control over resources real-time facilities: clocks and timers stringent dependability Embedded OS small footprint (e.g., leave all superfluous parts out) low system requirements (e.g. processor speed, energy) stringent dependability 34

Summarizing - OS views Abstraction provide useful generic concepts... to handle complexity Virtualization provide the same abstract model for a wide range of systems help in sharing the system each process/user sees single machine, linear memory Resource management resource sharing, protection optimized performance accounting and access control 35