Shared Memory David Ferry, Chris Gill

Slides:



Advertisements
Similar presentations
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
Advertisements

Precept 3 COS 461. Concurrency is Useful Multi Processor/Core Multiple Inputs Don’t wait on slow devices.
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.
Threads CSCI 444/544 Operating Systems Fall 2008.
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for Threads.
4.7.1 Thread Signal Delivery Two types of signals –Synchronous: Occur as a direct result of program execution Should be delivered to currently executing.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Silberschatz, Galvin and Gagne ©2011Operating System Concepts Essentials – 8 th Edition Chapter 4: Threads.
 2004 Deitel & Associates, Inc. All rights reserved. 1 Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for.
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
Middleware Services. Functions of Middleware Encapsulation Protection Concurrent processing Communication Scheduling.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Processes and Virtual Memory
CS307 Operating Systems Threads Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2011.
CSE 466 – Fall Introduction - 1 User / Kernel Space Physical Memory mem mapped I/O kernel code user pages user code GPLR virtual kernel C
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Kernel Structure and Infrastructure David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Operating System Concepts
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,
Interrupts and Interrupt Handling David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
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
Program Execution in Linux David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Kernel Synchronization David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Chapter 4 – Thread Concepts
Chapter 4: Threads Modified by Dr. Neerja Mhaskar for CS 3SH3.
Threads Some of these slides were originally made by Dr. Roger deBry. They include text, figures, and information from this class’s textbook, Operating.
Chapter 4: Threads.
Linux Details: Device Drivers
Final Review David Ferry, Chris Gill
CS 6560: Operating Systems Design
Midterm Review David Ferry, Chris Gill
Day 12 Threads.
Chapter 4 – Thread Concepts
Chapter 4: Multithreaded Programming
Linux Pipes and FIFOs David Ferry, Chris Gill
Chapter 4 Threads.
Processes David Ferry, Chris Gill
Program Execution in Linux
INTER-PROCESS COMMUNICATION
CSE 153 Design of Operating Systems Winter 2018
Lecture 45 Syed Mansoor Sarwar
Threads and Cooperation
Interrupts and Interrupt Handling
Threads & multithreading
Operating System Concepts
Making Virtual Memory Real: The Linux-x86-64 way
Chapter 4: Threads.
Kernel Structure and Infrastructure
Threads and Concurrency
Linux Details: Device Drivers
CHAPTER 4:THreads Bashair Al-harthi OPERATING SYSTEM
Threads Chapter 5 2/17/2019 B.Ramamurthy.
Operating Systems Lecture 1.
Kernel Synchronization I
Threads Chapter 5 2/23/2019 B.Ramamurthy.
How & When The Kernel Runs
Chapter 4: Threads.
Program Execution in Linux
Kernel Memory Chris Gill, David Ferry, Brian Kocoloski
Chapter 4: Threads.
Interrupts and Interrupt Handling
Processes David Ferry, Chris Gill, Brian Kocoloski
User-level Memory Chris Gill, David Ferry, Brian Kocoloski
Virtual Memory and Paging
Threads CSE 2431: Introduction to Operating Systems
Presentation transcript:

Shared Memory David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO 63130

CSE 522S – Advanced Operating Systems The Common Theme So Far? What we have seen… Signals: Kernel carries/delivers event notifications Pipes/FIFOs: Intra-machine communication Many-to-many Kernel reads/writes through the pipe file system Sockets: Inter/Intra-machine communication Point-to-point Kernel reads/writes through networking system CSE 522S – Advanced Operating Systems

Kernel’s Involvement in IPC Saves data into kernel address space Delivers data from kernel address space Sleeps and wakes processes that block on communications channels Delivers asynchronous notifications Useful, but incurs overhead! Multiple copies of data Event delivery timing at mercy of kernel Access requires system calls CSE 522S – Advanced Operating Systems

Shared Memory Concepts Processes share a physical memory region: Communication by modifying memory values Kernel only invoked at creation & deletion No read or write overhead vs. regular memory 0x1000 Process A shm_ptr 1 2 3 5 8 13 Process B shm_ptr CSE 522S – Advanced Operating Systems

CSE 522S – Advanced Operating Systems Recall - Paging All physical memory is divided into pages Pages get mapped to virtual memory Virtual addresses require translation Virtual Address Translation: Process A Process B Virtual Address Page # Offset 4KB 4KB 4KB 4KB 4KB 4KB Physical Page Phys. Addr CSE 522S – Advanced Operating Systems

Efficient Shared memory Same address translation as usual (little or no overhead) Addresses map to same physical page Page must be readable/ writable by both processes Process A Virtual Address Page # Offset Process B Virtual Address Page # Offset Physical Page CSE 522S – Advanced Operating Systems

CSE 522S – Advanced Operating Systems Shared Memory in Linux Three steps to use shared memory: Create a shared file descriptor - shm_create() Resize shared region - ftruncate() Map region into process - mmap() Shared regions identified by name Creator can specify user-level permissions CSE 522S – Advanced Operating Systems

CSE 522S – Advanced Operating Systems Using Shared Memory Basic interface: void* pointer Programmer must impose organization on shared memory region: Structs Libraries Provides multi-threaded-like environment Concurrency libraries may or may not work when shared across processes E.g. Pthreads and PTHREAD_PROCESS_SHARED May need own concurrency code CSE 522S – Advanced Operating Systems