CSE451 Section 7: Virtual memory. Table of content Real address space Process creation optimization Debugging: watch point.

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Unix system calls (part 1) history and.
Chapter 3 Process Description and Control
MACHINE-INDEPENDENT VIRTUAL MEMORY MANAGEMENT FOR PAGED UNIPROCESSOR AND MULTIPROCESSOR ARCHITECTURES R. Rashid, A. Tevanian, M. Young, D. Golub, R. Baron,
Virtual Memory Management G. Anuradha Ref:- Galvin.
Memory Management All data in memory before and after processing
Chap 4 Multithreaded Programming. Thread A thread is a basic unit of CPU utilization It comprises a thread ID, a program counter, a register set and a.
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
Misc Exercise 2 updated with Part III.  Due on next Tuesday 12:30pm. Project 2 (Suggestion)  Write a small test for each call.  Start from file system.
Processes CSCI 444/544 Operating Systems Fall 2008.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
3.5 Interprocess Communication
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
CS533 Concepts of Operating Systems Class 3 Integrated Task and Stack Management.
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
ThreadsThreads operating systems. ThreadsThreads A Thread, or thread of execution, is the sequence of instructions being executed. A process may have.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Operating Systems CSE 411 CPU Management Sept Lecture 11 Instructor: Bhuvan Urgaonkar.
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
CSC 501 Lecture 2: Processes. Process Process is a running program a program in execution an “instantiation” of a program Program is a bunch of instructions.
Threads, Thread management & Resource Management.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Chapter 4 Memory Management Virtual Memory.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 9: Virtual Memory.
Process Management Jerrod Howlett Sarah Sullivan.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
Department of Computer Science and Software Engineering
Processes and Virtual Memory
CS307 Operating Systems Virtual Memory Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2012.
LINUX 15 : Memory Management
Shahriar Pirnia Operating system سيستم عامل.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples (not covered.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Processes David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Embedded Real-Time Systems
Virtual Memory Alan L. Cox Some slides adapted from CMU slides.
Virtual Memory CSSE 332 Operating Systems
CS 6560: Operating Systems Design
Chapter 9: Virtual Memory – Part I
Chapter 9: Virtual Memory
Thread Programming.
Chapter 5: Threads Overview Multithreading Models Threading Issues
Section 10: Last section! Final review.
Processes David Ferry, Chris Gill
Processes in Unix, Linux, and Windows
Processes in Unix, Linux, and Windows
Chapter 9: Virtual-Memory Management
CS 143A Quiz 1 Solution.
Processes in Unix, Linux, and Windows
Light-weight Contexts: An OS Abstraction for Safety and Performance
Chapter 9: Virtual Memory
Lab 5 Process Control Operating System Lab.
CSE 451 Autumn 2003 Section 3 October 16.
Concurrency: Processes CSE 333 Summer 2018
Processes in Unix, Linux, and Windows
Lecture 7: Flexible Address Translation
Processes in Unix and Windows
Processes David Ferry, Chris Gill, Brian Kocoloski
Chapter 9: Virtual Memory
Chapter 8 & 9 Main Memory and Virtual Memory
CSE 542: Operating Systems
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

CSE451 Section 7: Virtual memory

Table of content Real address space Process creation optimization Debugging: watch point

Real address space User address spaceKernel space 0x xc on x86 0xffffffff From Understanding The Linux Virtual Memory Manager

Kernel address space –Remain constant in user address space –Why does all processes have the same shape of address space? Kernel can’t access user address space directly –Why? Understanding The Linux Virtual Memory Manager –

Optimization What do you think about memory copy? –Inter Process Communication –Network packet processing –Booting embedded system Is it really fast?

Process creation Fork() –Allocate process control block –Copy address space including shared resources –Schedule new process Let’s analyze real cases

When do we use fork? Web server –Why? –Usage? What are shared? What are not shared? Shell –Why? –Usage? What are shared? What are not shared?

Optimize fork – Web server Most of address space is shared –Program code –Configuration of web server –Heap May contain useful data What is not shared? –Stack & Heap Do we need to copy entire address space?

Copy-on-write Principle of laziness –Do action when it is REALLY required Do copy when the data is really changed Effect on fork? –Code: never be copied –Heap & stack: copy only changed portion Much faster, eh? –Linux fork() implements copy-on-write

How is it implemented? P1P2 CODE1 STACK2 HEAP1 HEAP3 HEAP2 HEAP4 HEAP3 HEAP2 HEAP1 STACK1 STACK2 STACK1 CODE1 CODE2 HEAP4 HEAP3 HEAP1 STACK1 CODE1 CODE2 STACK2’ HEAP2’ HEAP2 STACK2STACK2’ HEAP2’ Fork Call function A’ Write HEAP2

More copy-on-write Packet processing: Router –Can be seen as a chain of filters –Copy a packet whenever it passes a filter? Ethernet: 1500Byte frame size 10Mbps ~ 1.25MB/s Sample NAT/firewall enabled configuration has 37 filters –30MB memory copies per second –300MB when 100Mbps –3GB when 1Gbps This is just pure overhead! Copy on write! –Comparison does not change the content Other applications?

Optimize fork – shell What is shared? –NOTHING! –exec() will overwrite entire address space Copy? –Noooooo! Do not copy page table –Suspend parents until child calls exec() –exec() builds a new address space from the scratch vfork does this

Implementing thread? Linux 2.6 thread implementation –NPTL: Native POSIX Thread Library –1:1 threading model –Process/thread creation is integrated in clone() NPTL design paper – design.pdf

Debugging: watch point Watch point –Stop execution whenever the value of interesting variable has been changed Naïve approach –The variable is in page P –Let P as unmapped –Accessing P will cause page fault –Intercept page fault and temporarily map the page –Single instruction step over –If it touches, watched area, TRAP debugger