“Virtual” Memory How does the OS kernel provide “private” and “shared” memory areas to multiple concurrent processes?

Slides:



Advertisements
Similar presentations
Crafting a ‘boot time’ program How we can utilize some standard ‘real-mode’ routines that reside in the PC’s ROM-BIOS firmware.
Advertisements

The ‘process’ abstraction
Introduction to Operating Systems CS-2301 B-term Introduction to Operating Systems CS-2301, System Programming for Non-majors (Slides include materials.
The ‘thread’ abstraction A look at the distinction between the idea of a ‘process’ and the concept of a ‘thread’
Linux Memory Issues An introduction to some low-level and some high-level memory management concepts.
IA32 Paging Scheme Introduction to the Pentium’s support for “virtual” memory.
Processes CSCI 444/544 Operating Systems Fall 2008.
Linux Memory Management High-Level versus Low-Level.
Introduction to Kernel
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
Linux Memory Issues Introduction. Some Architecture History 8080 (late-1970s) 16-bit address (64-KB) 8086 (early-1980s) 20-bit address (1-MB) (mid-’80s)
The kernel’s task list Introduction to process descriptors and their related data-structures for Linux kernel version
Managing physical memory
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.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
A device-driver for Video Memory Introduction to basic principles of the PC’s graphics display.
The ‘mmap()’ method Adding the ‘mmap()’ capability to our ‘vram.c’ device-driver.
VGA System Services How to use Linux’s ‘vm86()’ system-call to access the video ROM-BIOS functions.
1 Introduction Chapter What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5.
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
Process Concept An operating system executes a variety of programs
Linux Memory Management How does the Linux kernel keep track of the Virtual Memory Areas that each process uses?
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Chapter 6 - Implementing Processes, Threads and Resources Kris Hansen Shelby Davis Jeffery Brass 3/7/05 & 3/9/05 Kris Hansen Shelby Davis Jeffery Brass.
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
Computer Organization
Protection and the Kernel: Mode, Space, and Context.
Overview Embedded Linux Graphics Typical desktop Linux graphics stack SystemRAMDisk X Window System5MB16MB GNOME14MB95MB KDE11MB96MB Mozilla12MB95MB.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Threads and Processes.
Laface Operating System Design Booting a PC to run a kernel from Low memory VGA display.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
The Structure of Processes. What is a Process? an instance of running program Program vs process(task) Program : just a passive collection of instructions.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Windows Memory Architecture 井民全製作. A Process ’ s Virtual Address Space Every Process has its own private virtual address 32-bits processes  4 GB address.
Process Description and Control
CS533 - Concepts of Operating Systems 1 The Mach System Presented by Catherine Vilhauer.
Silberschatz, Galvin and Gagne  Operating System Concepts Process Concept An operating system executes a variety of programs:  Batch system.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
University of Amsterdam Computer Systems – virtual memory Arnoud Visser 1 Computer Systems Virtual Memory.
Processes and Virtual Memory
Lecture on Central Process Unit (CPU)
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Logical & Physical Address Nihal Güngör. Logical Address In simplest terms, an address generated by the CPU is known as a logical address. Logical addresses.
What is a Process ? A program in execution.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-2: Threads Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Linux Boot Process on the Raspberry Pi 2 1 David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis,
Introduction To Computer Programming – 1A Computer Parts, Words, and Definition Herriman High School.
Introduction to Operating Systems Concepts
Introduction to Kernel
Process Management Process Concept Why only the global variables?
Mechanism: Address Translation
Jonathan Walpole Computer Science Portland State University
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
Process Realization In OS
Threads & multithreading
Processes in Unix, Linux, and Windows
Virtual Memory: Systems
Today’s agenda Hardware architecture and runtime system
Lecture Topics: 11/1 General Operating System Concepts Processes
Windows Virtual PC / Hyper-V
Processes in Unix, Linux, and Windows
Computer System Structures
Processes in Unix and Windows
Processes David Ferry, Chris Gill, Brian Kocoloski
Mechanism: Address Translation
Presentation transcript:

“Virtual” Memory How does the OS kernel provide “private” and “shared” memory areas to multiple concurrent processes?

Hardware/Firmware/Software The PC ‘s memory management system is a cooperative venture involving hardware, software, and firmware The hardware and firmware would be the same no matter which Operating System we choose to run (i.e., Linux or Windows) An operating system utilizes the hardware (in its own unique way) to provide multiple processes with protected memory-spaces

The Linux/x86 scheme Let’s focus on the particular approach that Linux takes in utilizing the Intel x86 CPU’s memory-addressing capabilities There are two conceptual levels (because “processor independence” is a goal Linux strives for): much of the Linux ‘mm’ code runs on almost any CPU, yet there’s some code is (unavoidably) specific to the x86

Source-code organization High-level ‘mm’ code is processor-independent (It’s in the ‘/usr/src/linux/mm’ subdirectory) Low-level ‘mm’ code is processor-specific (It’s in the ‘/usr/src/linux/arch/’ subdirectories) i386/mmppc/mmmips/mmalpha/mm...

Our machines have 1GB of RAM Main Memory (1 GB) Intel Pentium CPU 0x x3FFFFFFF system bus NICVGA FIFO (4 KB) VRAM (32 MB) some devices have RAM, too

Booting up At power-on, the CPU sees only 1-MB of the physical memory (including the ROMs) The OS initialization code must “activate” the processor’s “protected-mode” MMU so that all the ‘Extended Memory’ (including device-memory) will become addressable Finally the OS enables “virtual memory” to allow the illusion of a 4-GB address-space

Kernel memory-mapping Virtual Memory 0x xFFFFFFFF 4-GB Physical memory 0x x3FFFFFFF 1-GB 896-MB 0xC display memory device memory mappings

Application memory-mapping kernel space user space text data stack text data stack physical memory virtual memory mappings 3-GB

‘mm_struct’ Each application-process uses a different mapping of physical memory regions into the Pentium’s “virtual” address-space, so one process can’t access memory owned by another process (i.e., private regions) The OS switches these mapping when it suspends one process to resume another The ‘map’ for each task is in ‘task_struct’

How Linux tracks mappings task_struct mm mm_struct pgd start, end, etc vm_area_struct start, end, etc vm_area_struct start, end, etc vm_area_struct start, end, etc vm_area_struct vma mapping-tables

When a program ‘forks()’ We already know how new processes get created in the UNIX/Linux environment (i.e., via the ‘fork()’ function or system-call) A child-process gets constructed using the same code and data as its parent-process Yet each task’s memory-regions are kept ‘private’ (i.e., accessible to it alone) So how exactly is this feat achieved?

user space Similar memory-mappings kernel space user space text data stack parent-process kernel space text data stack child-process text data stack physical memory virtual memory

Some Linux demos We have written a Linux kernel module to display some info in a task’s ‘mm_struct’ (using a pseudo-file named ‘/proc/mm’) We also wrote a program (‘mmfork.cpp’) that forks a child process, so each task can read and display its ‘mm_struct’ info A user can compare the contents of the mm_struct’s info for the parent and child

More demos We wrote a Linux module (named ‘vma.c’) that displays information from a task’s list of ‘vm_area_struct’ data-structures You could write a program, similar to our ‘mmfork.cpp’ demo, that would let a user compare the list of memory-regions which a parent-process owns and the list that its child-process has inherited

In-class exercise Write an application program that allows a user to compare BOTH the ‘mm_struct’ and the ‘vm_area_struct’ information that belong to a parent-process and to its child You can use our ‘mm.c’ and ‘vma.c’ Linux kernel modules, and you can imitate the programming ideas we used in ‘mmfork’ TURN IN printouts of your code and output