CSCI 6411: Operating Systems. Acknowledgements: Some slide material derived from Silberschatz, et al.

Similar documents
csci3411: Operating Systems

csci3411: Operating Systems

csci 297: Advanced Operating Systems

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Slide 6-1. Processes. Operating Systems: A Modern Perspective, Chapter 6. Copyright 2004 Pearson Education, Inc.

Lecture 2 Fundamental OS Concepts. Bo 2018, Spring

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

Lecture 4: Mechanism of process execution. Mythili Vutukuru IIT Bombay

Anne Bracy CS 3410 Computer Science Cornell University

CSCE Operating Systems Interrupts, Exceptions, and Signals. Qiang Zeng, Ph.D. Fall 2018

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?

2/14/2012. Using a layered approach, the operating system is divided into N levels or layers. Also view as a stack of services

Four Components of a Computer System

Anne Bracy CS 3410 Computer Science Cornell University

Process Description and Control

Operating System Structure

Operating System Architecture. CS3026 Operating Systems Lecture 03

The Kernel Abstraction. Chapter 2 OSPP Part I

Chap.6 Limited Direct Execution. Dongkun Shin, SKKU

Processes & Threads. Recap of the Last Class. Microkernel System Architecture. Layered Structure

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Operating System Structure

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

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

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

COS 318: Operating Systems

Operating System Design

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

OS lpr. www. nfsd gcc emacs ls 9/18/11. Process Management. CS 537 Lecture 4: Processes. The Process. Why Processes? Simplicity + Speed

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

www nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed

Processes. Dr. Yingwu Zhu

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

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

Disciplina Sistemas de Computação

Inter-Process Communication and Synchronization of Processes, Threads and Tasks: Lesson-1: PROCESS

Hardware OS & OS- Application interface

Unix API Books. Linux Kernel Books. Assignments and Exams. Grading for CSC 256. Operating Systems 8/31/2018. CSC 256/456 Fall

CS 550 Operating Systems Spring Interrupt

COS 318: Operating Systems

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

Operating-System Structures

Protection and System Calls. Otto J. Anshus

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

Chapter 4: Threads. Operating System Concepts 8 th Edition,

Four Components of a Computer System. Operating System Concepts 7 th Edition, Jan 12, 2005

CSE 153 Design of Operating Systems Fall 2018

Frequently asked questions from the previous class survey

CSC 539: Operating Systems Structure and Design. Spring 2006

CSE 153 Design of Operating Systems

Chapter 4: Multithreaded Programming

!! How is a thread different from a process? !! Why are threads useful? !! How can POSIX threads be useful?

Syscalls, exceptions, and interrupts, oh my!

EEE 435 Principles of Operating Systems

PROCESSES. Jo, Heeseung

Processes. Jo, Heeseung

Chapter 1: Introduction

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

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

Hakim Weatherspoon CS 3410 Computer Science Cornell University

Processes. Johan Montelius KTH

Last time: introduction. Networks and Operating Systems ( ) Chapter 2: Processes. This time. General OS structure. The kernel is a program!

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

Operating System Control Structures

OS Structure. Kevin Webb Swarthmore College January 25, Relevant xkcd:

Process. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

A process. the stack

Operating System Services

Reserves time on a paper sign-up sheet. Programmer runs his own program. Relays or vacuum tube hardware. Plug board or punch card input.

Chapter 5: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads

Processes and Threads

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476

COURSE OVERVIEW & OPERATING SYSTEMS CONCEPT Operating Systems Design Euiseong Seo

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals

Lecture 2 - Fundamental Concepts

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

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

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems

Operating Systems. Computer Science & Information Technology (CS) Rank under AIR 100

CS 537 Lecture 2 - Processes

System Call. Preview. System Call. System Call. System Call 9/7/2018

Operating Systems Structure and Processes Lars Ailo Bongo Spring 2017 (using slides by Otto J. Anshus University of Tromsø/Oslo)

Andrew S. Tanenbaum, Operating Systems, Design and Implementation, (Second Edition), Prentice Hall.

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)

Process Description and Control

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

Motivation. Threads. Multithreaded Server Architecture. Thread of execution. Chapter 4

COS 318: Operating Systems

Chap 4, 5: Process. Dongkun Shin, SKKU

CS 550 Operating Systems Spring System Call

Process Scheduling Queues

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission 1

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

Processes & Threads. Recap of the Last Class. Layered Structure. Virtual Machines. CS 256/456 Dept. of Computer Science, University of Rochester

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve?

OPERATING SYSTEM OVERVIEW

Transcription:

CSCI 6411: Operating Systems Acknowledgements: Some slide material derived from Silberschatz, et al.

High level Cars Computers

...details... Cars Computers

... low level Cars Computers

What is an Operating System!??

What is an OS: Where is it? Applications (excel, word, browser,...) Operating Systems Hardware (CPU, memory, hard drive) things you can kick

What is an OS: Where is it? Applications (excel, word, browser,...) Operating Systems Hardware (CPU, memory, hard drive) things you can kick

What is an OS: Analogy You! Customer1 Customer2 Customern

What is an OS: Analogy You! Customer1 Customer2 Customern

What is an OS: Analogy Hardware Operating System Applications You! Customer1 Customer2 Customern

Operating System as Abstraction "The effective exploitation of his powers of abstraction must be regarded as one of the most vital activities of a competent programmer." Edsger W. Dijkstra Provides abstractions for resources (memory, CPU, disk) and controls application execution Provide environment for application execution Each application can pretend like it is using the entire computer! Allow users to translate intentions into actions Aside: Edsger Dijkstra Discipline in Thought

OS as Abstraction: System Layers

Source: xkcd.com

Computers as Distributed Systems Hardware: The parts of a computer system that can be kicked. Jeff Pesis

OS as Hardware Manager Control a diverse set of hardware Processors Memory Disks Networking cards Video cards Coordinates these hardware resources amongst user programs OS as a resource manager/multiplexer

? Applications (excel, word, browser,...) Operating Systems Hardware (CPU, memory, hard drive) things you can kick OS Services

Interrupts, exceptions, and traps OH MY Interrupts thus far: Device kernel Software triggered events Application state saved (as for interrupt) and can be resumed Exceptions Program faults (divide by zero, general protection fault, segmentation fault) Not requested by executing application Traps/Software Interrupts Requested by application by executing specific instruction: sysenter or int %d on x86

MSDOS: No Structure/Protection

System Calls Wait, hardware support for calling the kernel? Why can't I just call it directly (function call)?

System Call w/ Dual Mode HW Timesharing systems: 1) protection applications from each other, and 2) kernel from applications (why the latter?) Mode bit == 0 Access kernel memory segments Protected instructions Access I/O: instructions to read/write to device control registers (in/out on x86) Sensitive instructions What happens to the registers, and stack?

Syscall Mechanics printf( print me! ) write(1, print me! ) put syscall number for write (4), file descriptor (1), and pointer to print me! into registers sysenter: mode bit = 0 Change to kernel stack Call address in syscall tbl at index 4 Execute write system call sysexit: mode bit = 1 Restore application registers

Abstraction for syscalls: APIs Application Programmer Interfaces (APIs) Hide the details of how a syscall is carried out POSIX (UNIX, Linux) Win32 (Windows).Net (Windows XP and later) Cocoa (OS X)

System Structure System Structure How different parts of software 1) Are separated from each other (Why?) 2) Communicate How does a system use dual mode virtual address spaces Implications on Security/Reliability Programming style/maintainability

Monolithic System Structure Includes Unix/Windows/OSX Word Excel Browser User Level System Call Operating System (File System, Networking, Memory Mgmt, Scheduling,...) open(...) Hardware (CPU, Memory, Peripherals hard drive, NIC, GPU) Kernel most trusted must work

Monolithic System Structure Includes Unix/Windows/OSX 60 50 Word System Call 40 Excel Browser 30 User Level Millions of Lines of Code 20 10 Operating System open(...) (File 0System, Networking, Windows 98 Windows Vista Memory Mgmt, Windows 95 Scheduling, Windows XP...) When's the last time you tried to get 50 MLOC to work??? Hardware (CPU, Memory, Peripherals hard drive, NIC, GPU) Kernel most trusted must work

Microkernel System Structure App open(...) User level Kernel level File System Memory Management IPC Networking <10 KLOC Moves functionality from the kernel to user space Communication takes place between user servers using inter process communication (IPC) Benefits: Easier to add functionality More reliable (less code is running in kernel mode) More secure Detriments: performance! (why?)

Processes.c file compiler source.o/.exe loader load sections into memory OS program set ip to prog. start An executable program (seen in ls) exec process passive collection of code and data; kept in file UNIX Process: active entity that includes (seen in ps) Registers (instruction counter, stack pointer, etc..) Execution stack Heap Data and text (code) segments

Process in Memory empty char *s = malloc(10); printf( stk: %p\n, &s); printf( malloc: %p\n, s); printf( global: %p\n, &global_variable); printf( fn: %p\n, main); stk: 0xBC87B240 malloc: 0x1070B4F0 global: 0x004C72A0 fn: 0x000BC240 malloc, free int global_variable; int main(void) { return 0; }

OS Support for Process Memory OS uses HW to provide virtual address space (VAS) Each process thinks it has all memory OS abstraction!!! Provides protection between processes Only subset of that address space is populated by actual memory

OS Support for Process Memory II Kernel must manage virtual address spaces Create mapping between virtual and actual memory Switch between apps == switch between VAS Only mode 0 can switch VAS!

Process Control Block (PCB) Kernel, per process, data structure includes: CPU registers (including instruction counter) Scheduling state (priority) Memory management information (amount of memory allocated, virtual address space mapping, stack location) CPU accounting info (exec time at user/kernel level) File info (open files) Process state