Lecture 4: Operating System Structures

Slides:



Advertisements
Similar presentations
Dr. Kalpakis CMSC 421, Operating Systems Operating-System Structures.
Advertisements

Chap 2 System Structures.
Operating-System Structures
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Chapter 2: Operating-System Structures
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
Chapter 2 Operating System Structures
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 2: Operating-System Structures Modified from the text book.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
2.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 2: Operating-System Structures.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 2: Operating-System Structures.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
Chapter 2: Operating-System Structures Adapted to COP4610 by Robert van Engelen.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 6 System Calls OS System.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
Shan Gao Fall 2007 Department of Computer Science Georgia State University.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
2.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition System Programs (p73) System programs provide a convenient environment.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 2: Operating-System Structures Operating.
Chapter 2: Operating-System Structures
Topic 2 (Textbook - Chapter 2) Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2:Operating System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Operating System Structures
Tuesday, January 17, 2012 Questions? Syllabus Accounts Homework Lab
Chapter 2: Operating-System Structures
Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: System Structures
Chapter 2: Operating-System Structures
Chapter 1 Introduction to Operating System Part 5
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Outline Chapter 2 (cont) OS Design OS structure
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
System calls….. C-program->POSIX call
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Presentation transcript:

Lecture 4: Operating System Structures Joe McCarthy CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Outline More examples fork, pipe, dup2 Chapter 2: Operating Systems Structures Next time Chapter 3: Processes CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures More examples C++ programs using fork(), pipe(), dup2() testpipe[0-2].cpp Send “hello” through pipe to STDOUT Differences: hardcoded string vs. arg, write() vs execlp() pipedup2[a-d].cpp Using system calls to do ‘ps –A | tr a-z A-Z’ Differences Parent vs. child calling ps vs. tr Using read() & write() vs. execlp() for tr Linked from prog1b assignment page: http://courses.washington.edu/css430/joemcc/prog/prog1b.html CSS 430: Operating Systems - OS Structures

Chapter 2: OS Structures Operating System Services User Operating System Interface System Calls Types of System Calls System Programs Operating System Design and Implementation Operating System Structure Virtual Machines Operating System Debugging Operating System Generation System Boot Material derived, in part, from Operating Systems Concepts with Java, 8th Ed. © 2009 Silberschatz, Galvin & Gagne CSS 430: Operating Systems - OS Structures

A View of Operating System Services CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures 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? (Note that the system-call names used throughout this text are generic) CSS 430: Operating Systems - OS Structures

Example of System Calls System call sequence to copy the contents of one file to another file CSS 430: Operating Systems - OS Structures

Example of System Calls System call sequence to copy the contents of one file to another file CSS 430: Operating Systems - OS Structures

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 CSS 430: Operating Systems - OS Structures

API – System Call – OS Relationship CSS 430: Operating Systems - OS Structures

Standard C Library Example printf() library call  write() system call CSS 430: Operating Systems - OS Structures

System Call Parameter Passing Often, more information is required than simply identity of desired system call Exact type & amount of information vary according to OS & call Three general methods used to pass parameters to the OS CSS 430: Operating Systems - OS Structures

System Call Parameter Passing Often, more information is required than simply identity of desired system call Exact type & amount of information vary according to OS & 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 CSS 430: Operating Systems - OS Structures

Parameter Passing via Table CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Types of System Calls Process control File management Device management Status Information Communications Protection CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Process Control CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Process Control End, abort Load, execute Create process, terminate process Get process attributes, set process attributes Wait for time Wait for event, signal event Allocate memory, free memory CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures File Management CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures File Management Create file, delete file Open, close Read, write, reposition Get file attributes, set file attributes CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Device Management CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Device Management Request device, release device Read, write, reposition Get device attributes, set device attributes Logically attach (mount) or detach (unmount) devices CSS 430: Operating Systems - OS Structures

Information Maintenance CSS 430: Operating Systems - OS Structures

Information Maintenance Get time or date, set time or date Get system data, set system data Get process, file or device attributes Set process, file or device attributes CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Communications CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Communications Create, delete communication connection Send, receive messages Transfer status information Attach or detach remote devices CSS 430: Operating Systems - OS Structures

Windows & Unix System Calls CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures MS-DOS execution (a) At system startup (b) running a program CSS 430: Operating Systems - OS Structures

FreeBSD Running Multiple Programs CSS 430: Operating Systems - OS Structures

OS Design & Implementation Important distinction: Policy: What will be done? Mechanism: How to do it? Benefits: Maximum flexibility Policy changes need not entail mechanism changes & vice versa CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Simple Structure MS-DOS Goal: most functionality in the least space Not divided into modules Interfaces & levels of functionality not well separated CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Layered Approach Modularity: Each layer (level) uses functions & services only from layer(s) directly below Provides functions & services only to layer(s) directly above CSS 430: Operating Systems - OS Structures

Layered Approach to Networking CSS 430: Operating Systems - OS Structures

Traditional UNIX System Structure CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures UNIX Two components Systems programs ls, rm, cp, mv, ps, grep, wc, … The kernel Everything below the system-call interface and above the physical hardware Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level CSS 430: Operating Systems - OS Structures

Microkernel System Structure Moves as much from the kernel into “user” space Communication takes place between user modules using message passing Benefits: Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode) More secure Detriments: Performance overhead of user space to kernel space communication CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Mac OS X Structure CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures 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 CSS 430: Operating Systems - OS Structures

Solaris Modular Approach CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures 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 operating system host creates the illusion that a process has its own processor and (virtual memory). Each guest is provided with a (virtual) copy of underlying computer. CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Virtual Machines (a) Nonvirtual machine (b) virtual machine CSS 430: Operating Systems - OS Structures

Solaris 10 with Two Containers CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures VMware Architecture CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Java Java consists of: Programming language specification Application programming interface (API) Virtual machine specification CSS 430: Operating Systems - OS Structures

The Java Development Kit CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Cloud Computing CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures http://news.cnet.com/8301-13953_3-9917409-80.html CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures Amazon Web Services CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures

The Cost of Convenience CSS 430: Operating Systems - OS Structures

CSS 430: Operating Systems - OS Structures For next time Readings Chapters 3: Processes CSS 430: Operating Systems - OS Structures