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

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

Operating System Services

Lecture 2 Operating System Structures (chapter 2)

Chapter 2: Operating-System Structures

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

Chapter 2: Operating-System Structures

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

Operating-System Structures

Chapter 2: Operating-System Structures

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

Chapter 2: System Structures

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

Chapter 2: Operating-System

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

Operating-System Structures

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

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

CS307: Operating Systems

Lecture 2 - Fundamental Concepts

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

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

Chapter 2. Operating-System Structures

Chapter 2: Operating-System Structures

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

Four Components of a Computer System

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

Operating System Architecture. CS3026 Operating Systems Lecture 03

OS concepts and structure. q OS components & interconnects q Structuring OSs q Next time: Processes

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

Chapter 2: Operating-System Structures

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

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

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.

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

Chapter 2: System Structures

Chapter 2. Operating System Structures

CS420: Operating Systems. OS Services & System Calls

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

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

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

Chapter 3 Process Description and Control

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

CSC 453 Operating Systems

Chapter 2: OS Structures

Operating-System Structures

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

Introduction to Operating Systems (Part III)

Chapter 2 Operating-System Structures

Operating System Structure

Process Description and Control

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

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

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

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

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

Chapter 2 Operating System Structures

Operating System Structure

Module 1 Introduction/OS Overview

CSE 4/521 Introduction to Operating Systems

TDDB68 Concurrent Programming and Operating Systems. Lecture 1: Introduction, interrupts and system calls

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

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

Chapter 3: Operating-System Structures

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

Chapter 3: Operating-System Structures

CHAPTER 2 BASIC OPERATING SYSTEM CONCEPT MANAGEMENT

Chapter 3: Operating-System Structures

UNIT 2. OPERATING SYSTEM STRUCTURES

EECS 3221 Operating System Fundamentals

EECS 3221 Operating System Fundamentals

Threads Implementation. Jo, Heeseung

Operating Systems Overview. Chapter 2

OPERATING SYSTEMS: Lesson 1: Introduction to Operating Systems

OPERATING SYSTEM OVERVIEW

What we saw. Desarrollo de Aplicaciones en Red. 1. OS Design. 2. Service description. 1.1 Operating System Service (1)

CS370 Operating Systems

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

Agenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008

OPERATING SYSTEMS UNIT - 1

CS 390 Chapter 2 Homework Solutions

ELEC 377 Operating Systems. Week 1 Class 2

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

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!

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads

Chapter 1: Introduction. Operating System Concepts 9 th Edit9on

Operating- System Structures

Chapter 1: Introduction

Module 3: Operating-System Structures. Common System Components

Unit 2 : Computer and Operating System Structure

System Call System Program Linker/Loader with Examples Types of computing Environment

EEE 435 Principles of Operating Systems

Real Time and Embedded Systems. by Dr. Lesley Shannon Course Website:

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

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

Operating System Review

Transcription:

Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 4, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts System calls I/O Scheduling, error recovery, accounting Syncronization Virtual memory Hardware Support Kernel/user mode, protected instructions, base/limit registers Interrupt vectors Trap instructions and trap vectors Interrupts and memory mapping Timer Atomic instructions Translation look-aside buffers Lecture 4, page 2 1

Today: OS Structures & Services Introduce the organization and components in an OS. OS Components Processes Synchronization Memory & Secondary Storage Management File Systems I/O Systems Distributed Systems Three example OS organizations Monolithic kernel Layered architecture Microkernel Lecture 4, page 3 From the Architecture to the OS to the User From the Architecture to the OS to the User: Architectural resources, OS management, and User Abstractions. Hardware abstraction Processor Memory I/O devices File System Distributed systems Example OS Services Process management, Scheduling, Traps, protection, accounting, synchronization Management, Protection, virtual memory Concurrency with CPU, Interrupt handling File management, Persistence Networking, security, distributed file system User abstraction Process Address spaces Terminal, mouse, printer, system calls Files Remote procedure calls, network file system Lecture 4, page 4 2

Processes The OS manages a variety of activities: User programs Batch jobs and command scripts System programs: printers, spoolers, name servers, file servers, network listeners, etc. Each of these activities is encapsulated in a process. A process includes the execution context (PC, registers, VM, resources, etc.) and all the other information the activity needs to run. A process is not a program. A process is one instance of a program in execution. Many processes can be running the same program. Processes are independent entities. Lecture 4, page 5 OS and Processes The OS creates, deletes, suspends, and resumes processes. The OS schedules and manages processes. The OS manages inter-process communication and synchronization. The OS allocates resources to processes. Lecture 4, page 6 3

Synchronization Example: Banking transactions Cooperating processes on a single account: ATM machine transaction, balance computation, Monthly interest computation and addition. All of the processes are trying to access the same account simultaneously. What can happen? Lecture 4, page 7 Memory & Secondary Storage Management Main memory is the direct access storage for the CPU. Processes must be stored in main memory to execute. The OS must allocate memory space for processes, deallocate memory space, maintain the mappings from virtual to physical memory (page tables), decide how much memory to allocate to each process, and when a process should be removed from memory (policies). Lecture 4, page 8 4

File System Secondary storage devices (disks) are too crude to use directly for long term storage. The file system provides logical objects and operations on these objects (files). A file is the long-term storage entity: a named collection of persistent information that can be read or written. File systems support directories which contain the names of files and other directories along with additional information about the files and directories (e.g., when they were created and last modified). Lecture 4, page 9 File System Management The File System provides file management, a standard interface to create and delete files and directories manipulate (read, write, extend, rename, copy, protect) files and directories map files onto secondary storage The File System also provides general services such as backups, maintaining mapping information, accounting, and quotas. Lecture 4, page 10 5

Secondary Storage (disk) Secondary Storage = persistent memory (endures system failures) Low-level OS routines: responsible for low-level disk functions, such as scheduling of disk operations, head movement, and error handling. These routines may also be responsible for managing the disk space (for example, keeping track of the free space). The line between managing the disk space and the file system is very fuzzy, these routines are sometimes in the file system. Example: A program executable is stored in a file on disk. To execute a program, the OS must load the program from disk into memory. Lecture 4, page 11 I/O Systems The I/O system supports communication with external devices: terminal, keyboard, printer, mouse,... The I/O System: Supports buffering and spooling of I/O Provides a general device driver interface, hiding the differences among devices, often mimicking the file system interface Provides device driver implementations specific to individual devices. Lecture 4, page 12 6

Distributed Systems A distributed system is a collection of processors that do not share memory or a clock. To use non-local resources in a distributed system, processes must communicate over a network, The OS must provide additional mechanisms for dealing with failures and deadlock that are not encountered in a centralized system. The OS can support a distributed file system on a distributed system. Users, servers, and storage devices are all dispersed among the various sites. The OS must carry out its file services across the network and manage multiple, independent storage devices. Lecture 4, page 13 System Calls Programming interface to the services provided by the OS Typically written in a high-level language (C or C++) Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use Three most common APIs are Win32 API for Windows, POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM) Why use APIs rather than system calls? Lecture 4, page 14 7

Example of Standard API Consider the ReadFile() function in the Win32 API a function for reading from a file A description of the parameters passed to ReadFile() HANDLE file the file to be read LPVOID buffer a buffer where the data will be read into and written from DWORD bytestoread the number of bytes to be read into the buffer LPDWORD bytesread the number of bytes read during the last read LPOVERLAPPED ovl indicates if overlapped I/O is being used Lecture 4, page 15 System Call Implementation Typically, a number associated with each system call System-call interface maintains a table indexed according to these numbers The system call interface invokes intended system call in OS kernel and returns status of the system call and any return values 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) Lecture 4, page 16 8

API System Call OS Relationship Lecture 4, page 17 Standard C Library Example C program invoking printf() library call, which calls write() system call Lecture 4, page 18 9

System Call Parameter Passing Often, more information is required than simply identity of desired system call Exact type and amount of information vary according to OS and call Three general methods used to pass parameters to the OS Simplest: pass the parameters in registers In some cases, may be more parameters than registers Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register This approach taken by Linux and Solaris Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system Block and stack methods do not limit the number or length of parameters being passed Lecture 4, page 19 Examples of Windows and Unix System Calls Lecture 4, page 20 10

One Basic OS Structure The kernel is the protected part of the OS that runs in kernel mode, protecting the critical OS data structures and device registers from user programs. Debate about what functionality goes into the kernel (above figure: UNIX) Lecture 4, page 21 Layered OS design User programs Device drivers Virtual memory I/O channel Cpu scheduler Hardware Layer N: uses layer N-1 and provides new functionality to N+1 Advantages: modularity, simplicity, portability, ease of design/debugging Disadvantage - communication overhead between layers, extra copying, book-keeping Lecture 4, page 22 11

Microkernel Small kernel that provides communication (message passing) and other basic functionality other OS functionality implemented as user-space processes Lecture 4, page 23 Microkernel Features Goal: to minimize what goes in the kernel (mechanism, no policy), implementing as much of the OS in User-Level processes as possible. Advantages better reliability, easier extension and customization mediocre performance (unfortunately) First Microkernel was Hydra (CMU '70). Current systems include Chorus (France) and Mach (CMU). Lecture 4, page 24 12

Mac OS X - hybrid approach Layered system: Mach microkernel (mem, RPC, IPC) + BSD (threads, CLI, networking, filesystem) + user-level services (GUI) Lecture 4, page 25 Modules Most modern operating systems implement kernel modules Uses object-oriented approach Each core component is separate Each talks to the others over known interfaces Each is loadable as needed within the kernel Overall, similar to layers but with more flexible Lecture 4, page 26 13

Solaris Modular Approach Lecture 4, page 27 Summary Big Design Issue: How do we make the OS efficient, reliable, and extensible? General OS Philosophy: The design and implementation of an OS involves a constant tradeoff between simplicity and performance. As a general rule, strive for simplicity except when you have a strong reason to believe that you need to make a particular component complicated to achieve acceptable performance (strong reason = simulation or evaluation study) Lecture 4, page 28 14