Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Memory. Björn Döbel. Dresden,

Size: px
Start display at page:

Download "Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Memory. Björn Döbel. Dresden,"

Transcription

1 Faculty of Computer Science Institute for System Architecture, Operating Systems Group Memory Björn Döbel Dresden,

2 So far... Introduction Monolithic vs. microkernels L4 concepts: Threads and IPC Fiasco.OC/TUDOS introduction Today: Memory Management Task creation Page-fault handling Flexpages Hierarchical pagers Region manager Dataspaces TU Dresden, MOS - Memory Slide 2 / 47

3 Task Creation TU Dresden, MOS - Memory Slide 3 / 47

4 Address Space Layout 4GB 3GB Kernel Area Thread needs to access code/data/stack/ to execute Stack ESP 0 Code Data EIP Moe Root Task Sigma0 Root Pager Fiasco.OC Microkernel TU Dresden, MOS - Memory Slide 4 / 47

5 Create Task and Thread /* Create a new task. */ l4_msgtag_t L4::Factory::create_task (Cap< Task > const & task_cap, ) l4_fpage_t const & l4_utcb_t utcb_area, *utcb = l4_utcb() /* Create a new thread. */ l4_msgtag_t L4::Factory::create_thread (Cap< Thread > const & target_cap, l4_utcb_t *utcb = l4_utcb() ) TU Dresden, MOS - Memory Slide 5 / 47

6 Start new Thread /* Commit the given thread-attributes object. */ l4_msgtag_t L4::Thread::control (Attr const & attr) /* Exchange basic thread registers. */ l4_msgtag_t L4::Thread::ex_regs (l4_addr_t ip, /* instruction pointer */ ) l4_addr_t sp, /* stack pointer */ l4_umword_t flags, l4_utcb_t *utcb = l4_utcb() TU Dresden, MOS - Memory Slide 6 / 47

7 L4::Thread::ex_regs 4GB 3GB Kernel Area ESP EIP 0 L4::Thread::ex_regs Moe Root Task Sigma0 Root Pager Fiasco.OC Microkernel TU Dresden, MOS - Memory Slide 7 / 47

8 First thread executes... 4GB 3GB Kernel Area CPU tries to fetch instruction Page fault exception at EIP ESP EIP 0 Moe Root Task Sigma0 Root Pager Fiasco.OC Microkernel TU Dresden, MOS - Memory Slide 8 / 47

9 Page Fault Handling TU Dresden, MOS - Memory Slide 9 / 47

10 Page-fault handling EIP Application s address space Page fault exception is caught by kernel page-fault handler No management of user memory in kernel Invoke user-level memory management Pager Fiasco.OC Microkernel Page Fault Handler TU Dresden, MOS - Memory Slide 10 / 47

11 Pager Thread which is invoked on page fault Fiasco.OC: each thread has a (potentially different) pager assigned Application s address space Pager s address space Pager Memory Pager Code Fiasco.OC Microkernel Page Fault Handler TU Dresden, MOS - Memory Slide 11 / 47

12 Pager Invocation Communication with pager thread using IPC Kernel page fault handler sets up IPC to pager Pager sees faulting thread as sender of IPC Application s address space Pager s address space Pager Memory Pager Code call(fault address, fault eip) Fiasco.OC Microkernel Page Fault Handler TU Dresden, MOS - Memory Slide 12 / 47

13 Page-fault IPC UTCB[0] fault address / 4 (30) w p UTCB[1] faulting EIP (32) w = 0 w = 1 p = 0 p = 1 read page fault write page fault no page present page present TU Dresden, MOS - Memory Slide 13 / 47

14 Pager's Reply Pager maps pages of it's own address space to the application's address space Flexpage IPC enables these mappings Application s address space Pager s address space Pager Memory Pager Code Fiasco.OC Microkernel Page Fault Handler TU Dresden, MOS - Memory Slide 14 / 47

15 Page Mapping map() creates an entry in the receiver's address space pointing to the same page frame In hardware: page table entry Only valid pager address space entries can be mapped Application s address space Pager s address space map Virtual memory Virtual memory Physical memory Fiasco.OC Microkernel TU Dresden, MOS - Memory Slide 15 / 47

16 Page Granting Special case: grant pages (flag: L4_FPAGE_GRANT) Removes mapping from sender's address space Application s address space Pager s address space grant Virtual memory Virtual memory Physical memory Fiasco.OC Microkernel TU Dresden, MOS - Memory Slide 16 / 47

17 Page Granting Special case: grant pages (flag: L4_FPAGE_GRANT) Removes mapping from sender's address space ATTENTION: aliases remain Application s address space Pager s address space grant Virtual memory Virtual memory Physical memory Fiasco.OC Microkernel TU Dresden, MOS - Memory Slide 17 / 47

18 Page Unmap Removes entries to a page frame (fpage is specified in invoker's address space) Dedicated system call: do not need partner's consent Kernel tracks mappings in a database unmap Application s address space Pager s address space Virtual memory Virtual memory Physical memory Fiasco.OC Microkernel Mapping database TU Dresden, MOS - Memory Slide 18 / 47

19 Flexpages TU Dresden, MOS - Memory Slide 19 / 47

20 Flexpage Types Flexpages represent resources attached to an address space Flexpages in Fiasco.OC are used to describe: Memory pages I/O ports Capabilities Today: only flexpages for memory TU Dresden, MOS - Memory Slide 20 / 47

21 Flexpage IPC in Detail Size-aligned Size 2 size, smallest is hardware page Source and target area of a map IPC are described by flexpages Sender s Address Space l4_ipc_receive( ) page address (20) size (6) ~ (2) rights (4) Receiver s Address Space Receive Window send base (32) page address (20) size (6) ~ (2) rights (4) l4_ipc_send( ) TU Dresden, MOS - Memory Slide 21 / 47

22 Flexpage Offset Send flexpage is smaller than the receive window Target position is derived from send flexpage alignment and send base l4_ipc_send( ) l4_ipc_receive( ) send base (32) page address (20) size (6) ~ (2) rights (4) page address (20) size (6) ~ (2) rights (4) TU Dresden, MOS - Memory Slide 22 / 47

23 Flexpage Offset Send flexpage is larger than receive window Target position is derived from receive flexpage alignment and send base Send base depends on information about the receiver l4_ipc_send( ) l4_ipc_receive( ) send base (32) page address (20) size (6) ~ (2) rights (4) page address (20) size (6) ~ (2) rights (4) TU Dresden, MOS - Memory Slide 23 / 47

24 Page fault in detail Kernel page fault handler sets receive window to whole address space Pager can map more than just one page, where the page fault happened to the client Application's Address Space send base pf address page address (20) size (6) ~ (2) rights (4) Pager s Address Space Fiasco.OC Microkernel Page Fault Receive Window whole space Page Fault Handler TU Dresden, MOS - Memory Slide 24 / 47

25 Root task: Initial Pager Pages are mapped as they are needed demand paging Application s address space Root Task s address space esp Stack Memory eip Code Data App Code Section App Data Section Roottask Fiasco.OC Microkernel TU Dresden, MOS - Memory Slide 25 / 47

26 Basic Memory Management Initial pager can only implement basic memory management No knowlegde about application requirements Different requirements at the same time Missing services for advanced memory management e.g. no disk driver for swapping Build more advanced pagers on top of the initial one Pager hierarchy TU Dresden, MOS - Memory Slide 26 / 47

27 Hierarchical Pagers TU Dresden, MOS - Memory Slide 27 / 47

28 Pager Hierarchy Application Application Pager 3 Disk Driver Pager 1 Pager 2 Phys. Memory 1-to-1 mapped Root Task Fiasco.OC Microkernel TU Dresden, MOS - Memory Slide 28 / 47

29 Real World Example L 4 Linux implements Linux paging policy RT pager implements real-time paging policy (e.g. no swapping) L 4 Linux Applications L 4 Linux Applications Real-Time Applications Real-Time Applications Linux Swap Linux Paging L 4 Linux Kernel Server RT Pager Phys. Memory 1-to-1 mapped Initial Address Space Fiasco.OC Microkernel TU Dresden, MOS - Memory Slide 29 / 47

30 Region Mapper TU Dresden, MOS - Memory Slide 30 / 47

31 Virtual Memory Management Pager has to specify send base Pager needs to know client's address space layout No problems with only one pager (e.g. L 4 Linux) Possible conflicts if more than one pager manages an address space: Application Application Pager 3 Disk Driver Pager 1 Pager 2 Phys. Memory 1-to-1 mapped Initial Address Space Fiasco.OC Microkernel Virtual memory must be managed independent of pagers TU Dresden, MOS - Memory Slide 31 / 47

32 Region Map Per address space map that keeps track which part of the address space is managed by which pager Address space Region Map VM Region Pager Pager 1 Pager 2 <start, end> Pager 1 <start, end> Pager 2 <start, end> Pager 2 Pager 2 TU Dresden, MOS - Memory Slide 32 / 47

33 Region Mapper Intermediate pager that identifies which pager should handle a page fault Resides in the application's address space Region mapper is the pager of all threads of a task Application VM Region Pager Pager 1 Region Mapper Pager 1 <start, end> Pager 1 <start, end> Pager 2 <start, end> Pager 2 Pager Memory Pager 2 Pager 2 call( region mapper, pf addr, pf eip, ) Pager Code Fiasco.OC Microkernel Page-Fault Handler TU Dresden, MOS - Memory Slide 33 / 47

34 Region Mapper Region mapper calls the pager that is responsible Receive window gets restricted to the area managed by that pager No interference between different pagers Application VM Region Pager Pager 1 Region Mapper Pager 1 Pager 2 Pager 2 <start, end> Pager 1 <start, end> Pager 2 <start, end> Pager 2 Call(pager1, pf addr, pf eip, receive window,...) Pager Memory Pager Code Fiasco.OC Microkernel Page-Fault Handler TU Dresden, MOS - Memory Slide 34 / 47

35 High-level Memory Abstraction Memory management in terms of pages so far Application s view to memory: code / data sections memory mapped files anonymous memory (heaps, stacks, ) network / file system buffers Abstraction to map this view to low-level memory management TU Dresden, MOS - Memory Slide 35 / 47

36 Dataspaces TU Dresden, MOS - Memory Slide 36 / 47

37 Dataspaces Dataspace: unstructured data container Abstraction for anything that contains data: Files Anonymous memory I/O adapter memory Dataspaces are implemented by Dataspace Managers Dataspaces can be attached to regions of an address space TU Dresden, MOS - Memory Slide 37 / 47

38 Dataspace Manager DS Manager determines the semantic of a dataspace Each DS is the pager for its dataspaces Implements the paging policy (page replacement etc.) Dataspaces Dataspace Manager s Address Space ds 1 ds 2 Dataspace Manager s Memory TU Dresden, MOS - Memory Slide 38 / 47

39 Dataspaces & Region Mapper Region map keeps track which dataspaces are attached to which virtual memory regions Region mapper translates page faults to dataspace offsets Application s Address Space Dataspaces Dataspace Manager s Address Space Dataspace Manager 1 Dataspace 1 ds 1 Dataspace Manager 2 Dataspace 1 ds 2 Dataspace Manager s Memory Dataspace Manager 2 Dataspace 2 Region Map VM Region Dataspace <start, end> Dataspace Manager 1, 1 <start, end> Dataspace Manager 2, 1 <start, end> Dataspace Manager 2, 2 TU Dresden, MOS - Memory Slide 39 / 47

40 Dataspaces & Region mapper Region mapper propagates fault to dataspace manager's fault handler Dataspace fault (ds_manager_id, ds_id, offset) Application s Address Space Dataspaces Dataspace Manager s Address Space Dataspace Manager 1 Dataspace 1 ds 1 Dataspace Manager 2 Dataspace 1 ds 2 Dataspace Manager s Memory Dataspace Manager 2 Dataspace 2 Region Map VM Region Dataspace <start, end> Dataspace Manager 1, 1 <start, end> Dataspace Manager 2, 1 <start, end> Dataspace Manager 2, 2 TU Dresden, MOS - Memory Slide 40 / 47

41 Application's View on Dataspaces allocate / free dataspaces create / destroy dataspace semantic depends on dataspace type: anonymous memory: open (size) file: open (filename, mode, )... attach / detach dataspace create / remove entry in region map Makes dataspace contents accessible to application propagate capability grant access rights to other applications very easy shared memory implementation TU Dresden, MOS - Memory Slide 41 / 47

42 Application Address Spaces Application address spaces are constructed from several dataspaces: Application s Address Space Mmap ed File File System Files-System Buffers Code RO Data Data BSS Memory Manager Stack Memory TU Dresden, MOS - Memory Slide 42 / 47

43 Further Issues Page Allocation Algorithms List-based algorithms, bitmaps, trees, Page Replacement Algorithms Least-Recently-Used (LRU) Working Sets Clock Page allocation and replacement are implemented by dataspace managers Can have different strategies for the dataspaces of an application TU Dresden, MOS - Memory Slide 43 / 47

44 Memory sharing Memory sharing important for Shared libraries Data transfer between system components Different types of sharing Full sharing: all clients see modifications easy to implement, pager / dataspace manager grants access rights to pages / dataspaces Lazy copying of dataspaces copy-on-write TU Dresden, MOS - Memory Slide 44 / 47

45 Summary Closer look on tasks/threads: Creation Page-fault handling Flexpages Memory pages, I/O ports, Capabilities Structure Offset computation Pager hierarchy Region mapper & dataspaces TU Dresden, MOS - Memory Slide 45 / 47

46 More information Flexpages H.Härtig, J.Wolter, J.Liedtke: Flexible sized page objects, Dataspaces Mohit Aron, Yoonho Park, Trent Jaeger, Jochen Liedtke, Kevin Elphinstone, Luke Deller: The SawMill Framework for VM Diversity, ftp://ftp.cse.unsw.edu.au/pub/users/disy/ papers/aron_pjled_01.ps.gz TU Dresden, MOS - Memory Slide 46 / 47

47 Next Lesson Next lecture (12.11.): 'Real-Time Systems' TU Dresden, MOS - Memory Slide 47 / 47

Memory, IPC, and L4Re

Memory, IPC, and L4Re Faculty of Computer Science Institute for System Architecture, Operating Systems Group Memory, IPC, and L4Re Björn Döbel What we talked about so far Microkernels Fiasco.OC Threads in Fiasco.OC Lecture

More information

µ-kernel Construction (12)

µ-kernel Construction (12) µ-kernel Construction (12) Review 1 Threading Thread state must be saved/restored on thread switch We need a Thread Control Block (TCB) per thread TCBs must be kernel objects TCBs implement threads We

More information

MICROKERNEL CONSTRUCTION 2014

MICROKERNEL CONSTRUCTION 2014 MICROKERNEL CONSTRUCTION 2014 THE FIASCO.OC MICROKERNEL Alexander Warg MICROKERNEL CONSTRUCTION 1 FIASCO.OC IN ONE SLIDE CAPABILITY-BASED MICROKERNEL API single system call invoke capability MULTI-PROCESSOR

More information

Faculty of Computer Science, Operating Systems Group. The L4Re Microkernel. Adam Lackorzynski. July 2017

Faculty of Computer Science, Operating Systems Group. The L4Re Microkernel. Adam Lackorzynski. July 2017 Faculty of Computer Science, Operating Systems Group The L4Re Microkernel Adam Lackorzynski July 2017 2 Agenda Plan What is L4Re? History The L4Re Microkernel / Hypervisor Fiasco Interfaces SMP Virtualization...

More information

Microkernel-based Operating Systems - Introduction

Microkernel-based Operating Systems - Introduction Faculty of Computer Science Institute for System Architecture, Operating Systems Group Microkernel-based Operating Systems - Introduction Nils Asmussen Dresden, Oct 09 2018 Lecture Goals Provide deeper

More information

Microkernel-based Operating Systems - Introduction

Microkernel-based Operating Systems - Introduction Faculty of Computer Science Institute for System Architecture, Operating Systems Group Microkernel-based Operating Systems - Introduction Björn Döbel Dresden, Oct 14 th 2008 Lecture Goals Provide deeper

More information

Microkernel Construction. Introduction. Michael Hohmuth. Lars Reuther. TU Dresden Operating Systems Group

Microkernel Construction. Introduction. Michael Hohmuth. Lars Reuther. TU Dresden Operating Systems Group Introduction Lecture Goals Provide deeper understanding of OS mechanisms Make all of you enthusiastic kernel hackers Illustrate alternative system design concepts Promote OS research at 2 Administration

More information

Microkernel-based Operating Systems - Introduction

Microkernel-based Operating Systems - Introduction Faculty of Computer Science Institute for System Architecture, Operating Systems Group Microkernel-based Operating Systems - Introduction Carsten Weinhold Dresden, Oct 09 th 2012 Lecture Goals Provide

More information

Practical Exercise Inter-Process Communication

Practical Exercise Inter-Process Communication Faculty of Computer Science Institute for System Architecture, Operating Systems Group Practical Exercise Inter-Process Communication Björn Döbel Dresden, 2008-12-16 Exercise Outline IPC Recap & Implementation

More information

Microkernel Construction

Microkernel Construction Introduction SS2013 Class Goals Provide deeper understanding of OS mechanisms Introduce L4 principles and concepts Make you become enthusiastic L4 hackers Propaganda for OS research at 2 Administration

More information

Inter-Process Communication

Inter-Process Communication Faculty of Computer Science Institute for System Architecture, Operating Systems Group Inter-Process Communication Björn Döbel Dresden, So far... Microkernels Basic resources in an operating system Tasks

More information

The SawMill Framework for Virtual Memory Diversity

The SawMill Framework for Virtual Memory Diversity The SawMill Framework for Virtual Memory Diversity Mohit Aron Department of Computer Science Rice University Jochen Liedtke and Kevin Elphinstone System Architecture Group University of Karlsruhe Yoonho

More information

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Complex Lab Operating Systems 2016 Winter Term.

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Complex Lab Operating Systems 2016 Winter Term. Faculty of Computer Science Institute for System Architecture, Operating Systems Group Complex Lab Operating Systems 2016 Winter Term Introduction Requirements Basic Operating Systems Know-How Virtual

More information

L4Env An Environment for L4 Applications

L4Env An Environment for L4 Applications L4Env An Environment for L4 Applications Operating Systems Research Group Technische Univerität Dresden drops@os.inf.tu-dresden.de June 30, 2003 Preface This document gives an introduction into L4Env,

More information

Microkernels. Overview. Required reading: Improving IPC by kernel design

Microkernels. Overview. Required reading: Improving IPC by kernel design Microkernels Required reading: Improving IPC by kernel design Overview This lecture looks at the microkernel organization. In a microkernel, services that a monolithic kernel implements in the kernel are

More information

Inter-Process Communication

Inter-Process Communication Faculty of Computer Science Institute for System Architecture, Operating Systems Group Inter-Process Communication Björn Döbel Dresden, So far... Microkernels as a design alternative Flexibility Security

More information

Systems Design and Implementation II.1 L4 API Crash Course Part I

Systems Design and Implementation II.1 L4 API Crash Course Part I Systems Design and Implementation II.1 L4 API Crash Course Part I System, SS 2007 University of Karlsruhe 22 April 2009 Jan Stoess University of Karlsruhe Tuesdays 17:30-19:00 Thursdays 15:45-17:15 SR-134,

More information

DRAFT. 27th July :43. L4 User Manual API Version X.2. Ihor Kuz

DRAFT. 27th July :43. L4 User Manual API Version X.2. Ihor Kuz Embedded, Real-Time and Operating Systems Program http://nicta.com.au/ertos.html L4 User Manual API Version X.2 Ihor Kuz Document Version 1.6 of 14th July 2004 27th July 2004-- 17:43 ihor.kuz@nicta.com.au

More information

L4 User Manual API Version X.2

L4 User Manual API Version X.2 Embedded, Real-Time, and Operating Systems Program http://ertos.nicta.com.au/ L4 User Manual API Version X.2 Ihor Kuz Document Version 1.9 of September 23, 2004 ihor.kuz@nicta.com.au http://www.cse.unsw.edu.au/

More information

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

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 03 From Programs to Processes Hello. In

More information

RESOURCE MANAGEMENT MICHAEL ROITZSCH

RESOURCE MANAGEMENT MICHAEL ROITZSCH Faculty of Computer Science Institute of Systems Architecture, Operating Systems Group RESOURCE MANAGEMENT MICHAEL ROITZSCH AGENDA done: time, drivers today: misc. resources architectures for resource

More information

Virtual Memory Paging

Virtual Memory Paging Virtual Memory Paging An important task of a virtual-memory system is to relocate pages from physical memory out to disk Early UNIX systems swapped out the entire process at once Modern UNIX systems relay

More information

RESOURCE MANAGEMENT MICHAEL ROITZSCH

RESOURCE MANAGEMENT MICHAEL ROITZSCH Faculty of Computer Science Institute of Systems Architecture, Operating Systems Group RESOURCE MANAGEMENT MICHAEL ROITZSCH AGENDA done: time, drivers today: misc. resources architectures for resource

More information

Fundamental Concepts. L4 Programming Introduction. Root Task. KernelInterface. Kernel Information Page. Drivers at User Level

Fundamental Concepts. L4 Programming Introduction. Root Task. KernelInterface. Kernel Information Page. Drivers at User Level Fundamental Concepts L4 Programming Introduction Address Spaces Unit of protection, resource management Threads Execution abstraction and provide unique identifiers Communication: IPC Synchronous Identification:

More information

Falling in Love with EROS (Or Not) Robert Grimm New York University

Falling in Love with EROS (Or Not) Robert Grimm New York University Falling in Love with EROS (Or Not) Robert Grimm New York University The Three Questions What is the problem? What is new or different? What are the contributions and limitations? Basic Access Control Access

More information

L4 User Manual NICTA L4-embedded API

L4 User Manual NICTA L4-embedded API Embedded, Real-Time, and Operating Systems Program http://ertos.nicta.com.au/ L4 User Manual NICTA L4-embedded API Ihor Kuz Document Version 1.11 of October 5, 2005 ihor.kuz@nicta.com.au http://www.cse.unsw.edu.au/

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Spring 2018 Lecture 10: Paging Geoffrey M. Voelker Lecture Overview Today we ll cover more paging mechanisms: Optimizations Managing page tables (space) Efficient

More information

CSE 560 Computer Systems Architecture

CSE 560 Computer Systems Architecture This Unit: CSE 560 Computer Systems Architecture App App App System software Mem I/O The operating system () A super-application Hardware support for an Page tables and address translation s and hierarchy

More information

Pintos Virtual Memory

Pintos Virtual Memory Pintos Virtual Memory Daniel Chiu Slides adapted from previous quarters Overview: Project Components High Level Goal: Implement Virtual Memory Page Table Management Page Fault Handler Interacts with most

More information

@2010 Badri Computer Architecture Assembly II. Virtual Memory. Topics (Chapter 9) Motivations for VM Address translation

@2010 Badri Computer Architecture Assembly II. Virtual Memory. Topics (Chapter 9) Motivations for VM Address translation Virtual Memory Topics (Chapter 9) Motivations for VM Address translation 1 Motivations for Virtual Memory Use Physical DRAM as a Cache for the Disk Address space of a process can exceed physical memory

More information

Fakultät Informatik Institut für Systemarchitektur, Betriebssysteme THE NOVA KERNEL API. Julian Stecklina

Fakultät Informatik Institut für Systemarchitektur, Betriebssysteme THE NOVA KERNEL API. Julian Stecklina Fakultät Informatik Institut für Systemarchitektur, Betriebssysteme THE NOVA KERNEL API Julian Stecklina (jsteckli@os.inf.tu-dresden.de) Dresden, 5.2.2012 00 Disclaimer This is not about OpenStack Compute.

More information

Inter-Process Communication

Inter-Process Communication Faculty of Computer Science Institute for System Architecture, Operating Systems Group Inter-Process Communication Nils Asmussen Dresden, So far... Microkernels as a design alternative Flexibility Security

More information

2 nd Half. Memory management Disk management Network and Security Virtual machine

2 nd Half. Memory management Disk management Network and Security Virtual machine Final Review 1 2 nd Half Memory management Disk management Network and Security Virtual machine 2 Abstraction Virtual Memory (VM) 4GB (32bit) linear address space for each process Reality 1GB of actual

More information

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Memory Management & Program Loading

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Memory Management & Program Loading Faculty of Computer Science Institute for System Architecture, Operating Systems Group Memory Management & Program Loading Course Goal Pong Server Paddle Client 1 Paddle Client 2 Keyboard Driver Memory

More information

Virtual Memory Nov 9, 2009"

Virtual Memory Nov 9, 2009 Virtual Memory Nov 9, 2009" Administrivia" 2! 3! Motivations for Virtual Memory" Motivation #1: DRAM a Cache for Disk" SRAM" DRAM" Disk" 4! Levels in Memory Hierarchy" cache! virtual memory! CPU" regs"

More information

TCBs and Address-Space Layouts Universität Karlsruhe, System Architecture Group

TCBs and Address-Space Layouts Universität Karlsruhe, System Architecture Group µ-kernel Construction (3) TCBs and Address-Space Layouts 1 Thread Control Blocks (TCBs) 2 Fundamental Abstractions Thread Address space What is a thread? How to implement it? 3 Construction Conclusion

More information

CS533 Concepts of Operating Systems. Jonathan Walpole

CS533 Concepts of Operating Systems. Jonathan Walpole CS533 Concepts of Operating Systems Jonathan Walpole Improving IPC by Kernel Design & The Performance of Micro- Kernel Based Systems The IPC Dilemma IPC is very import in µ-kernel design - Increases modularity,

More information

virtual memory Page 1 CSE 361S Disk Disk

virtual memory Page 1 CSE 361S Disk Disk CSE 36S Motivations for Use DRAM a for the Address space of a process can exceed physical memory size Sum of address spaces of multiple processes can exceed physical memory Simplify Management 2 Multiple

More information

Virtual Memory Oct. 29, 2002

Virtual Memory Oct. 29, 2002 5-23 The course that gives CMU its Zip! Virtual Memory Oct. 29, 22 Topics Motivations for VM Address translation Accelerating translation with TLBs class9.ppt Motivations for Virtual Memory Use Physical

More information

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

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture Last 2 Classes: Introduction to Operating Systems & C++ tutorial User apps OS Virtual machine interface hardware physical machine interface An operating system is the interface between the user and the

More information

Virtual Memory. Motivations for VM Address translation Accelerating translation with TLBs

Virtual Memory. Motivations for VM Address translation Accelerating translation with TLBs Virtual Memory Today Motivations for VM Address translation Accelerating translation with TLBs Fabián Chris E. Bustamante, Riesbeck, Fall Spring 2007 2007 A system with physical memory only Addresses generated

More information

CS162 - Operating Systems and Systems Programming. Address Translation => Paging"

CS162 - Operating Systems and Systems Programming. Address Translation => Paging CS162 - Operating Systems and Systems Programming Address Translation => Paging" David E. Culler! http://cs162.eecs.berkeley.edu/! Lecture #15! Oct 3, 2014!! Reading: A&D 8.1-2, 8.3.1. 9.7 HW 3 out (due

More information

CISC 360. Virtual Memory Dec. 4, 2008

CISC 360. Virtual Memory Dec. 4, 2008 CISC 36 Virtual Dec. 4, 28 Topics Motivations for VM Address translation Accelerating translation with TLBs Motivations for Virtual Use Physical DRAM as a Cache for the Disk Address space of a process

More information

Management of Revocable Resources. Romain Treboux

Management of Revocable Resources. Romain Treboux Management of Revocable Resources Romain Treboux romain.treboux@centraliens.net February 26, 2010 Declaration I declare to have written this work independently and without using unmentioned sources. Erklärung

More information

Computer Architecture Background

Computer Architecture Background CSE 5095 & ECE 4451 & ECE 5451 Spring 2017 Lecture 2b Computer Architecture Background Marten van Dijk Syed Kamran Haider, Chenglu Jin, Phuong Ha Nguyen Department of Electrical & Computer Engineering

More information

stack Two-dimensional logical addresses Fixed Allocation Binary Page Table

stack Two-dimensional logical addresses Fixed Allocation Binary Page Table Question # 1 of 10 ( Start time: 07:24:13 AM ) Total Marks: 1 LRU page replacement algorithm can be implemented by counter stack linked list all of the given options Question # 2 of 10 ( Start time: 07:25:28

More information

Motivations for Virtual Memory Virtual Memory Oct. 29, Why VM Works? Motivation #1: DRAM a Cache for Disk

Motivations for Virtual Memory Virtual Memory Oct. 29, Why VM Works? Motivation #1: DRAM a Cache for Disk class8.ppt 5-23 The course that gives CMU its Zip! Virtual Oct. 29, 22 Topics Motivations for VM Address translation Accelerating translation with TLBs Motivations for Virtual Use Physical DRAM as a Cache

More information

Complex Lab Operating Systems 2015/16 Winter Term. Sessions & Dynamic Memory

Complex Lab Operating Systems 2015/16 Winter Term. Sessions & Dynamic Memory Faculty of Computer Science Institute for System Architecture, Operating Systems Group Complex Lab Operating Systems 2015/16 Winter Term Sessions & Dynamic Memory 1 st Assignment General Coding Style use

More information

Lecture 19: Virtual Memory: Concepts

Lecture 19: Virtual Memory: Concepts CSCI-UA.2-3 Computer Systems Organization Lecture 9: Virtual Memory: Concepts Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified) from: Clark Barrett

More information

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Virtualization. Henning Schild. Dresden,

Faculty of Computer Science Institute for System Architecture, Operating Systems Group. Virtualization. Henning Schild. Dresden, Faculty of Computer Science Institute for System Architecture, Operating Systems Group Virtualization Henning Schild Dresden, 2009-12-01 So Far... Basics Introduction Threads & synchronization Memory Real-time

More information

CS 152 Computer Architecture and Engineering. Lecture 11 - Virtual Memory and Caches

CS 152 Computer Architecture and Engineering. Lecture 11 - Virtual Memory and Caches CS 152 Computer Architecture and Engineering Lecture 11 - Virtual Memory and Caches Krste Asanovic Electrical Engineering and Computer Sciences University of California at Berkeley http://www.eecs.berkeley.edu/~krste

More information

Recap: Memory Management

Recap: Memory Management , 4/13/2018 EE445M/EE360L.12 Embedded and Real-Time Systems/ Real-Time Operating Systems : Memory Protection, Virtual Memory, Paging References: T. Anderson, M. Dahlin, Operating Systems: Principles and

More information

Microkernel Construction

Microkernel Construction Microkernel Construction Interprocess Communication Nils Asmussen 05/03/2018 1 / 33 Outline Introduction Microkernel vs. Monolithic kernel Synchronous vs. Asynchronous Different Implementations Synchronous

More information

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

Operating System. Operating System Overview. Structure of a Computer System. Structure of a Computer System. Structure of a Computer System Overview Chapter 1.5 1.9 A program that controls execution of applications The resource manager An interface between applications and hardware The extended machine 1 2 Structure of a Computer System Structure

More information

Memory Allocation. Copyright : University of Illinois CS 241 Staff 1

Memory Allocation. Copyright : University of Illinois CS 241 Staff 1 Memory Allocation Copyright : University of Illinois CS 241 Staff 1 Recap: Virtual Addresses A virtual address is a memory address that a process uses to access its own memory Virtual address actual physical

More information

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1 Memory Management Disclaimer: some slides are adopted from book authors slides with permission 1 Recap Paged MMU: Two main Issues Translation speed can be slow TLB Table size is big Multi-level page table

More information

Threads (light weight processes) Chester Rebeiro IIT Madras

Threads (light weight processes) Chester Rebeiro IIT Madras Threads (light weight processes) Chester Rebeiro IIT Madras 1 Processes Separate streams of execution Each process isolated from the other Process state contains Process ID Environment Working directory.

More information

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

Processes & Threads. Recap of the Last Class. Layered Structure. Virtual Machines. CS 256/456 Dept. of Computer Science, University of Rochester Recap of the Last Class Processes & Threads CS 256/456 Dept. of Computer Science, University of Rochester Hardware protection kernel and mode System components process management, memory management, I/O

More information

Operating System Architecture. CS3026 Operating Systems Lecture 03

Operating System Architecture. CS3026 Operating Systems Lecture 03 Operating System Architecture CS3026 Operating Systems Lecture 03 The Role of an Operating System Service provider Provide a set of services to system users Resource allocator Exploit the hardware resources

More information

Virtual Memory. Robert Grimm New York University

Virtual Memory. Robert Grimm New York University Virtual Memory Robert Grimm New York University The Three Questions What is the problem? What is new or different? What are the contributions and limitations? VAX/VMS VAX-11 Memory Hardware Each process

More information

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1 Memory Management Disclaimer: some slides are adopted from book authors slides with permission 1 CPU management Roadmap Process, thread, synchronization, scheduling Memory management Virtual memory Disk

More information

Stub-Code Performance is Becoming Important

Stub-Code Performance is Becoming Important Stub-Code Performance is Becoming Important Andreas Haeberlen Jochen Liedtke Yoonho Park Lars Reuther Volkmar Uhlig University of Karlsruhe System Architecture Group 76128 Karlsruhe, Germany {haeberlen,liedtke,uhlig}@ira.uka.de

More information

Memory management, part 3: outline

Memory management, part 3: outline Memory management, part 3: outline Segmentation Case studies o MULTICS o Pentium o Unix o Linux o Windows 1 Segmentation Several address spaces per process a compiler needs segments for o source text o

More information

6.033 Spring Lecture #6. Monolithic kernels vs. Microkernels Virtual Machines spring 2018 Katrina LaCurts

6.033 Spring Lecture #6. Monolithic kernels vs. Microkernels Virtual Machines spring 2018 Katrina LaCurts 6.033 Spring 2018 Lecture #6 Monolithic kernels vs. Microkernels Virtual Machines 1 operating systems enforce modularity on a single machine using virtualization in order to enforce modularity + build

More information

Linux Memory Management

Linux Memory Management Linux Memory Management Virtual memory layout: a closer look Applications require memory with different properties access permissions sharing file backed vs. anonymous dynamically sized /proc/{pid}/maps

More information

Modeling Page Replacement: Stack Algorithms. Design Issues for Paging Systems

Modeling Page Replacement: Stack Algorithms. Design Issues for Paging Systems Modeling Page Replacement: Stack Algorithms 7 4 6 5 State of memory array, M, after each item in reference string is processed CS450/550 Memory.45 Design Issues for Paging Systems Local page replacement

More information

Memory System Case Studies Oct. 13, 2008

Memory System Case Studies Oct. 13, 2008 Topics 15-213 Memory System Case Studies Oct. 13, 2008 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping Class15+.ppt Intel P6 (Bob Colwell s Chip,

More information

INFLUENTIAL OPERATING SYSTEM RESEARCH: SECURITY MECHANISMS AND HOW TO USE THEM CARSTEN WEINHOLD

INFLUENTIAL OPERATING SYSTEM RESEARCH: SECURITY MECHANISMS AND HOW TO USE THEM CARSTEN WEINHOLD Faculty of Computer Science Institute of Systems Architecture, Operating Systems Group INFLUENTIAL OPERATING SYSTEM RESEARCH: SECURITY MECHANISMS AND HOW TO USE THEM CARSTEN WEINHOLD OVERVIEW Fundamental

More information

CSE 4/521 Introduction to Operating Systems. Lecture 15 Virtual Memory I (Background, Demand Paging) Summer 2018

CSE 4/521 Introduction to Operating Systems. Lecture 15 Virtual Memory I (Background, Demand Paging) Summer 2018 CSE 4/521 Introduction to Operating Systems Lecture 15 Virtual Memory I (Background, Demand Paging) Summer 2018 Overview Objective: To describe the benefits of a virtual memory system. To explain the concept

More information

Pentium/Linux Memory System March 17, 2005

Pentium/Linux Memory System March 17, 2005 15-213 The course that gives CMU its Zip! Topics Pentium/Linux Memory System March 17, 2005 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping 17-linuxmem.ppt

More information

CS140 Project 3: Virtual Memory. TA: Diveesh Singh

CS140 Project 3: Virtual Memory. TA: Diveesh Singh CS140 Project 3: Virtual Memory TA: Diveesh Singh High level Project requirements High level goal: Remove current limitation that the number and size of programs running in Pintos is limited by main memory

More information

L4 Nucleus Version X Reference Manual. x86

L4 Nucleus Version X Reference Manual. x86 L4 Nucleus Version X Reference Manual x86 Version X.0 Jochen Liedtke Universität Karlsruhe liedtke@ira.uka.de September 3, 1999 Under Construction How To Read This Manual This reference manual consists

More information

Microkernel Design A walk through selected aspects of

Microkernel Design A walk through selected aspects of Microkernel Design A walk through selected aspects of kernel design and sel4 These slides are made distributed under the Creative Commons Attribution 3.0 License, unless otherwise noted on individual slides.

More information

IPC Functionality & Interface Universität Karlsruhe, System Architecture Group

IPC Functionality & Interface Universität Karlsruhe, System Architecture Group µ-kernel Construction (4) IPC Functionality & Interface 1 IPC Primitives Send to (a specified thread) Receive from (a specified thread) Two threads communicate No interference from other threads Other

More information

Memory management, part 3: outline

Memory management, part 3: outline Memory management, part 3: outline Segmentation Case studies o MULTICS o x86 (Pentium) o Unix o Linux o Windows 1 Segmentation Several address spaces per process a compiler needs segments for o source

More information

Virtual Memory, Address Translation

Virtual Memory, Address Translation Memory Hierarchy Virtual Memory, Address Translation Slides contents from: Hennessy & Patterson, 5ed Appendix B and Chapter 2 David Wentzlaff, ELE 475 Computer Architecture MJT, High Performance Computing,

More information

Advanced Operating Systems. COMP9242 Introduction

Advanced Operating Systems. COMP9242 Introduction Advanced Operating Systems COMP9242 Introduction Staff Lecturer in Charge Gernot Heiser Lecturer Kevin Elphinstone Various Support Staff TBA 2 Why are you here? You ve done comp3231 Did well (minimum credit)

More information

CSE 120 Principles of Operating Systems Spring 2017

CSE 120 Principles of Operating Systems Spring 2017 CSE 120 Principles of Operating Systems Spring 2017 Lecture 12: Paging Lecture Overview Today we ll cover more paging mechanisms: Optimizations Managing page tables (space) Efficient translations (TLBs)

More information

Staff. Advanced Operating Systems. Why are you here? What can you expect?

Staff. Advanced Operating Systems. Why are you here? What can you expect? Staff Advanced Operating Systems COMP9242 Introduction Lecturer in Charge Gernot Heiser Lecturer Kevin Elphinstone Various Support Staff TBA 2 Why are you here? You ve done comp3231 Did well (minimum credit)

More information

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. November 15, MIT Fall 2018 L20-1

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. November 15, MIT Fall 2018 L20-1 Virtual Memory Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. L20-1 Reminder: Operating Systems Goals of OS: Protection and privacy: Processes cannot access each other s data Abstraction:

More information

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Last Class: Intro to OS An operating system is the interface between the user and the architecture. User-level Applications

More information

Intel P6 (Bob Colwell s Chip, CMU Alumni) The course that gives CMU its Zip! Memory System Case Studies November 7, 2007.

Intel P6 (Bob Colwell s Chip, CMU Alumni) The course that gives CMU its Zip! Memory System Case Studies November 7, 2007. class.ppt 15-213 The course that gives CMU its Zip! ory System Case Studies November 7, 07 Topics P6 address translation x86-64 extensions Linux memory management Linux fault handling ory mapping Intel

More information

1. Creates the illusion of an address space much larger than the physical memory

1. Creates the illusion of an address space much larger than the physical memory Virtual memory Main Memory Disk I P D L1 L2 M Goals Physical address space Virtual address space 1. Creates the illusion of an address space much larger than the physical memory 2. Make provisions for

More information

G Virtual Memory. Robert Grimm New York University

G Virtual Memory. Robert Grimm New York University G22.3250-001 Virtual Memory Robert Grimm New York University Altogether Now: The Three Questions! What is the problem?! What is new or different?! What are the contributions and limitations? VAX-11 Memory

More information

CIS Operating Systems Memory Management Cache and Demand Paging. Professor Qiang Zeng Spring 2018

CIS Operating Systems Memory Management Cache and Demand Paging. Professor Qiang Zeng Spring 2018 CIS 3207 - Operating Systems Memory Management Cache and Demand Paging Professor Qiang Zeng Spring 2018 Process switch Upon process switch what is updated in order to assist address translation? Contiguous

More information

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory CPS 104 Computer Organization and Programming Lecture 20: Virtual Nov. 10, 1999 Dietolf (Dee) Ramm http://www.cs.duke.edu/~dr/cps104.html CPS 104 Lecture 20.1 Outline of Today s Lecture O Virtual. 6 Paged

More information

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1 Memory Management Disclaimer: some slides are adopted from book authors slides with permission 1 Demand paging Concepts to Learn 2 Abstraction Virtual Memory (VM) 4GB linear address space for each process

More information

Outline. 1 Details of paging. 2 The user-level perspective. 3 Case study: 4.4 BSD 1 / 19

Outline. 1 Details of paging. 2 The user-level perspective. 3 Case study: 4.4 BSD 1 / 19 Outline 1 Details of paging 2 The user-level perspective 3 Case study: 4.4 BSD 1 / 19 Some complications of paging What happens to available memory? - Some physical memory tied up by kernel VM structures

More information

Intel P The course that gives CMU its Zip! P6/Linux Memory System November 1, P6 memory system. Review of abbreviations

Intel P The course that gives CMU its Zip! P6/Linux Memory System November 1, P6 memory system. Review of abbreviations 15-213 The course that gives CMU its Zip! P6/Linux ory System November 1, 01 Topics P6 address translation Linux memory management Linux fault handling memory mapping Intel P6 Internal Designation for

More information

Memory management. Knut Omang Ifi/Oracle 10 Oct, 2012

Memory management. Knut Omang Ifi/Oracle 10 Oct, 2012 Memory management Knut Omang Ifi/Oracle 1 Oct, 212 (with slides from V. Goebel, C. Griwodz (Ifi/UiO), P. Halvorsen (Ifi/UiO), K. Li (Princeton), A. Tanenbaum (VU Amsterdam), and M. van Steen (VU Amsterdam))

More information

ECE331: Hardware Organization and Design

ECE331: Hardware Organization and Design ECE331: Hardware Organization and Design Lecture 29: an Introduction to Virtual Memory Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Overview Virtual memory used to protect applications

More information

Virtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory

Virtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory Virtual Memory Virtual Memory CSCI Operating Systems Design Department of Computer Science Virtual memory separation of user logical memory from physical memory. Only part of the program needs to be in

More information

Hardware OS & OS- Application interface

Hardware OS & OS- Application interface CS 4410 Operating Systems Hardware OS & OS- Application interface Summer 2013 Cornell University 1 Today How my device becomes useful for the user? HW-OS interface Device controller Device driver Interrupts

More information

P6/Linux Memory System Nov 11, 2009"

P6/Linux Memory System Nov 11, 2009 P6/Linux Memory System Nov 11, 2009" REMEMBER" 2! 3! Intel P6" P6 Memory System" DRAM" external system bus (e.g. PCI)" L2" cache" cache bus! bus interface unit" inst" TLB" instruction" fetch unit" L1"

More information

Project 2! CSE 421/521 - Operating Systems! Virtual Memory in Pintos

Project 2! CSE 421/521 - Operating Systems! Virtual Memory in Pintos Project 2! CSE 421/521 - Operating Systems! Virtual Memory in Pintos Deadline: December 4, 2013 @ 11.59pm Muhammed Fatih Bulut Preparation Chapters 8-9 from Silberschatz.! Lecture slides on Memory and

More information

Operating Systems Overview. Chapter 2

Operating Systems Overview. Chapter 2 Operating Systems Overview Chapter 2 Operating System A program that controls the execution of application programs An interface between the user and hardware Masks the details of the hardware Layers and

More information

Today. Process Memory Layout. CSCI 4061 Introduction to Operating Systems. Where does the memory come from?

Today. Process Memory Layout. CSCI 4061 Introduction to Operating Systems. Where does the memory come from? Today CSCI 4061 Introduction to Operating Systems OS Management Virtual Paging and Swapping Instructor: Abhishek Chandra 2 Process Layout Where does the memory come from? High Address Args, environment

More information

CIS Operating Systems Memory Management Cache. Professor Qiang Zeng Fall 2017

CIS Operating Systems Memory Management Cache. Professor Qiang Zeng Fall 2017 CIS 5512 - Operating Systems Memory Management Cache Professor Qiang Zeng Fall 2017 Previous class What is logical address? Who use it? Describes a location in the logical memory address space Compiler

More information

CSE 120. Translation Lookaside Buffer (TLB) Implemented in Hardware. July 18, Day 5 Memory. Instructor: Neil Rhodes. Software TLB Management

CSE 120. Translation Lookaside Buffer (TLB) Implemented in Hardware. July 18, Day 5 Memory. Instructor: Neil Rhodes. Software TLB Management CSE 120 July 18, 2006 Day 5 Memory Instructor: Neil Rhodes Translation Lookaside Buffer (TLB) Implemented in Hardware Cache to map virtual page numbers to page frame Associative memory: HW looks up in

More information

Microkernels and Client- Server Architectures

Microkernels and Client- Server Architectures Microkernels and Client- Server Architectures I m not interested in making devices look like user-level. They aren t, they shouldn t, and microkernels are just stupid. Linus Torwalds 1 Motivation Early

More information