Stack Management Each process/thread has two stacks  Kernel stack  User stack Stack pointer changes when exiting/entering the kernel Q: Why is this necessary?

Slides:



Advertisements
Similar presentations
Threads, SMP, and Microkernels
Advertisements

OS Components and Structure
Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented by Alana Sweat.
Extensibility, Safety and Performance in the SPIN Operating System Brian Bershad, Stefan Savage, Przemyslaw Pardyak, Emin Gun Sirer, Marc E. Fiuczynski,
1 CSE451 Introduction to Operating Systems Spring 2007 Module 3 Components and Structure Gary Kimura & Mark Zbikowski March 30, 2007.
CS533 Concepts of Operating Systems Class 14 Virtualization.
Operating System Structure. Announcements Make sure you are registered for CS 415 First CS 415 project is up –Initial design documents due next Friday,
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
Figure 1.1 Interaction between applications and the operating system.
1 Gary Kimura Lecture #3 October 4, 2002 CSE451 Operating Systems Components and Basic Organization Autumn 2002.
CS533 Concepts of Operating Systems Class 6 Micro-kernels Extensibility via Hardware or Software Based Protection.
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
The Design of Robust and Efficient Microkernel ManRiX, The Design of Robust and Efficient Microkernel Presented by: Manish Regmi
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 Operating System Organization.
CSE 451: Operating Systems Spring 2012 Module 3 Operating System Components and Structure Ed Lazowska Allen Center 570 © 2012.
Microkernels, virtualization, exokernels Tutorial 1 – CSC469.
Introduction and Overview Questions answered in this lecture: What is an operating system? How have operating systems evolved? Why study operating systems?
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
CS533 Concepts of Operating Systems Jonathan Walpole.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 7 OS System Structure.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 2 (Part II) Operating System Overview.
OSes: 3. OS Structs 1 Operating Systems v Objectives –summarise OSes from several perspectives Certificate Program in Software Development CSE-TC and CSIM,
Processes Introduction to Operating Systems: Module 3.
Operating Systems Structure what is the organizational principle?
EXTENSIBILITY, SAFETY AND PERFORMANCE IN THE SPIN OPERATING SYSTEM
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
A. Frank - P. Weisberg Operating Systems Structure of Operating Systems.
Examples of Operating Systems.
Operating-System Structures
Chapter 2 Operating System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
CENG334 Introduction to Operating Systems 1 Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
CS533 Concepts of Operating Systems Jonathan Walpole.
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Overview of today’s lecture Major components of an operating system Structure and internal architecture of an operating system Monolithic Vs Micro-kernels.
Introduction to Operating Systems Concepts
Computer System Structures
Computer System Structures
Modularity Most useful abstractions an OS wants to offer can’t be directly realized by hardware Modularity is one technique the OS uses to provide better.
Kernel Design & Implementation
Operating System Structure
CS490 Windows Internals Quiz 2 09/27/2013.
CSE 451: Operating Systems Autumn 2004 Module 3 Operating System Components and Structure Hank Levy 1.
CSE451 Operating Systems Winter 2010
CSE 451: Operating Systems Winter 2007 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
Hank Levy (for Hank Levy :)
Operating Systems: A Modern Perspective, Chapter 3
Operating System Introduction.
CSE 451: Operating Systems Autumn 2009 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
OS Components and Structure
CSE 451: Operating Systems Spring 2005 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
CSE 451: Operating Systems Winter 2004 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
© 2007 Gribble, Lazowska, Levy, Zahorjan
CSE 451: Operating Systems Winter 2003 Lecture 3 Operating System Structure: Components and Interfaces Hank Levy 412 Sieg Hall.
CSE 451: Operating Systems Autumn 2010 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
Operating Systems Structure
CSE 451: Operating Systems Autumn 2003 Lecture 3 Operating System Structure: Components and Interfaces Hank Levy Allen Center 596.
Operating Systems Structure
CSE 451: Operating Systems Winter 2006 Module 3 Operating System Components and Structure Ed Lazowska Allen Center
CSE 451: Operating Systems Spring 2006 Module 3 Operating System Components and Structure John Zahorjan Allen Center 534.
Presentation transcript:

Stack Management Each process/thread has two stacks  Kernel stack  User stack Stack pointer changes when exiting/entering the kernel Q: Why is this necessary? User space Kernel space SP

Answer The user stack pointer is under the control of the (untrusted) application. A buggy or malicious application could set the stack pointer to a bogus value  For example, a nonexistent address or an address inside the kernel

Alternate Answer In a multi-threaded environment, thread A can modify thread B’s stack (they reside in the same address space).  Thus, thread A could change thread B’s control flow inside the OS Modifying arguments Changing return values etc.

Operating System Structure Andrew Whitaker CSE451

Operating System Structure Goal: Arrange OS software components to maximize:  Reliability  Security  Readability  Extensibility  Performance  ….

Motivation: OS Projects Gone Awry

What Is Writing an OS So Difficult? Complexity  Millions of source code lines  Thousands of developers and testers Unforgiving programming environment  OS runs on the raw hardware  A bug crashes the whole machine Interrupts and concurrency Backwards compatibility constraints

The Simplest Approach: Monolithic Kernels Traditionally, OS’s are built as a monolithic entity:  Single linked binary  Any function can call any other function everything user programs hardware OS

Monolithic design Major advantage:  cost of module interactions is low (procedure call) Disadvantages:  As system scales, it becomes: Hard to understand Hard to modify Hard to maintain  Unreliable (no isolation between system modules) What is the alternative?  Find a way to organize the OS in order to simplify its design and implementation

Layering Idea: Implement OS as a set of layers The first description of this approach was Dijkstra’s THE system (1968!)  Layer 5: Job Managers Execute users’ programs  Layer 4: Device Managers Handle devices and provide buffering  Layer 3: Console Manager Implements virtual consoles  Layer 2: Page Manager Implements virtual memories for each process  Layer 1: Kernel Implements a virtual processor for each process  Layer 0: Hardware Each layer can be tested and verified independently

Problems with Layering Strict hierarchical structure is too inflexible  Real systems have “uses” cycles File system requires virtual memory services (buffers) Virtual memory would like to use files for its backing store Poor performance  Each layer crossing has overhead associated with it File System Virtual Memory

Hardware Abstraction Layer An example of layering in modern operating systems Goal: separates hardware- specific routines from the “core” OS  Provides portability  Improves readability Core OS (file system, scheduler, system calls) Hardware Abstraction Layer (device drivers, assembly routines)

Microkernels Philosophy  Strict hierarchy is bad  But, modularity is good Design:  Minimize what goes in kernel  Organize rest of OS as user-level processes e.g., file system “server”  Processes communicate using message-passing Like a distributed system Examples  Hydra (1970s)  Mach ( )

Microkernel structure illustrated hardware microkernel system processes user processes virtual memory communication protection processor control file system threads network scheduling paging Firefoxpowerpoint apache user mode kernel

Microkernels: Pros and Cons Pros  Simplicity Core kernel is very small  Extensibility Can add new functionality in user-mode code  Reliability OS services confined to user-mode programs Cons  Poor performance Message transfer operations instead of system call

State of the Art: Kernel Modules Basic idea: users can supply modules, which run directly in the kernel’s address space Pros:  Good performance  Extensibility Cons:  Modules can compromise security, reliability Device drivers cause 85% of crashes in Windows 2000!

Safe Languages in the OS UW’s SPIN Operating System  All kernel extensions written in a type-safe language Fast and safe MSR’s Singularity Project  Entire system written for a type-safe runtime environment