operating-system-shared-memory.html
* created: 2025-06-04T17:08
* modified: 2025-07-14T09:11
title
Shared Memory
description
Shared Memory refers to areas in memory that multiple process can access.
related notes
Sharing is caring
Sharing a certain area of our memory between multiple process can be dangerous, but there are a couple of reasons we would want to do so:
- If we start the same program multiple times we don't want each process to have its own area in memory, they could instead generally share the same pages and, if required, get separate pages for their mutable state.
- A process wants to share information. It could store such information in memory which would then be referenced by other processes.
Implementation
The operating system with its virtual memory management and its Page Tables can now grant access to a shared page frame by altering the entries in said page tables such that n (n>=2) processes can access it.
This page frame can now be accessed by all virtual address spaces that have the corresponding entry in their page table.
This is used for Shared Libraries for example.