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

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

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

CS3600 SYSTEMS AND NETWORKS

Operating System Structures

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

System Structures. Services Interface Structure

Example of Standard API

OPERATING SYSTEMS STRUCTURES

Chapter 2 System Structures

The Plan Today... System Calls and API's Basics of OS design Virtual Machines

CS420: Operating Systems OS Services & System Calls

Operating System Structure

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

CSE 120 Principles of Operating Systems. Modules, Interfaces, Structure

OPERATING SYSTEM SERVICES

Lecture 1 Operating System Overview

Chapter 3 Operating-System Structures

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

Operating System Components

How do Users and Processes interact with the Operating System? Services for Processes. OS Structure with Services. Services for the OS Itself

ELEC 377. Operating Systems. Week 1 Class 3

CS161: Operating Systems

OS Concepts and structure

How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X

Introduction. What is an Operating System?

Chapter 3: Operating-System Structures. Common System Components

Operating- System Structures

Chapter 6, The Operating System Machine Level

Operating Systems and Networks

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson


Operating Systems. Rafael Ramirez (T, S)

Overview of Operating Systems Instructor: Dr. Tongping Liu

Components of a Computer System

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Multiprogramming. IT 3123 Hardware and Software Concepts. Program Dispatching. Multiprogramming. Program Dispatching. Program Dispatching

Lecture 25 Symbian OS

Operating System Components and Services

COS 318: Operating Systems

CPS221 Lecture: Operating System Structure; Virtual Machines

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Introduction to Virtual Machines

Multi-core Programming System Overview

Operating System Organization. Purpose of an OS

Operating Systems: Basic Concepts and History

Introduction. System Calls

Operating System Structures

General Introduction

Chapter 2: OS Overview

Operating Systems. Lecture 03. February 11, 2013

Have both hardware and software. Want to hide the details from the programmer (user).

Tools Page 1 of 13 ON PROGRAM TRANSLATION. A priori, we have two translation mechanisms available:

Operating System Overview. Otto J. Anshus

Cloud Computing. Up until now

Introduction to Operating Systems. Perspective of the Computer. System Software. Indiana University Chen Yu

Operating Systems OS Architecture Models

Page 1 of 5. IS 335: Information Technology in Business Lecture Outline Operating Systems

CSC 2405: Computer Systems II

Operating Systems 4 th Class

FAME Operating Systems

Processes and Non-Preemptive Scheduling. Otto J. Anshus

ECE 677: Distributed Computing Systems. Distributed Operating Systems: Design Issues Case Studies

CHAPTER 15: Operating Systems: An Overview

Encryption Wrapper. on OSX

Kernel comparison of OpenSolaris, Windows Vista and. Linux 2.6

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015

Embedded Systems. 6. Real-Time Operating Systems

Security Overview of the Integrity Virtual Machines Architecture

Stack Allocation. Run-Time Data Structures. Static Structures

Real Time Programming: Concepts

Virtualization. Jia Rao Assistant Professor in CS

CHAPTER 1: OPERATING SYSTEM FUNDAMENTALS

Distributed File Systems

Microkernels, virtualization, exokernels. Tutorial 1 CSC469

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

Computers: Tools for an Information Age

Operating System Tutorial

Virtualization. Types of Interfaces

Computer Organisation Operating Systems

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

KVM: Kernel-based Virtualization Driver

I/O. Input/Output. Types of devices. Interface. Computer hardware

Introduction to Embedded Systems. Software Update Problem

Star System Deitel & Associates, Inc. All rights reserved.

Full and Para Virtualization

Characteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming

Uses for Virtual Machines. Virtual Machines. There are several uses for virtual machines:

1 Organization of Operating Systems

DB2 Connect for NT and the Microsoft Windows NT Load Balancing Service

Overview of CS 282 & Android

Why Threads Are A Bad Idea (for most purposes)

Replication on Virtual Machines

Advanced Operating Systems ( L)

Chapter 11 I/O Management and Disk Scheduling

Mobile Operating Systems. Week I

Virtual Machines.

(Advanced Topics in) Operating Systems

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

Transcription:

Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, 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 3, page 2

Today: OS Structures & Services More on System Calls Introduce the organization and components in an OS. Four example OS organizations Monolithic kernel Layered architecture Microkernel Modular Lecture 3, page 3 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 3, page 4

Standard C Library Example C program invoking printf() library call, which calls write() system call Lecture 3, page 5 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 3, page 6

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 3, page 7 API System Call OS Relationship Lecture 3, page 8

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 3, page 9 Examples of Windows and Unix System Calls Lecture 3, page 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) - monolithic kernels Lecture 3, page 11 Mac OS X Architecture Lecture 3, page 12

Windows 8 Architecture Lecture 3, page 13 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 3, page 14

Microkernel Small kernel that provides communication (message passing) and other basic functionality other OS functionality implemented as user-space processes Lecture 3, page 15 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 3, page 16

Mac OS X - hybrid approach Layered system: Mach microkernel (mem, RPC, IPC) + BSD (threads, CLI, networking, filesystem) + user-level services (GUI) Lecture 3, page 17 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 3, page 18

Solaris Modular Approach Lecture 3, page 19 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 3, page 20

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 3, page 21 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 3, page 22

What's in a Process? Process: dynamic execution context of an executing program Several processes may run the same program, but each is a distinct process with its own state (e.g., MS Word). A process executes sequentially, one instruction at a time Process state consists of at least:! the code for the running program,! the static data for the running program,! space for dynamic data (the heap), the heap pointer (HP),! the Program Counter (PC), indicating the next instruction,! an execution stack with the program's call chain (the stack), the stack pointer (SP)! values of CPU registers! a set of OS resources in use (e.g., open files)! process execution state (ready, running, etc.). Lecture 3, page 23 Example Process State in Memory What you wrote: What s in memory PC -> void X (int b){ } if ( b == 1 ) main(){ int a = 2; X ( a ); } Lecture 3, page 24

Process Execution State Execution state of a process indicates what it is doing new: the OS is setting up the process state running: executing instructions on the CPU ready: ready to run, but waiting for the CPU waiting: waiting for an event to complete terminated: the OS is destroying this process As the program executes, it moves from state to state, as a result of the program actions (e.g., system calls), OS actions (scheduling), and external actions (interrupts). Lecture 3, page 25 Process Execution State state sequence Example: void main() { printf( Hello World ); } The OS manages multiple active process using state queues (More on this in a minute ) Lecture 3, page 26

Process Execution State state sequence new Example: ready running void main() { waiting for I/O printf( Hello World ); ready } running terminated The OS manages multiple active process using state queues (More on this in a minute ) Lecture 3, page 27