All Topics  
Shared memory

 

   Email Print
   Bookmark   Link






 

Shared memory



 
 
In computing
Computing

Computing is usually defined as the activity of using and developing computer technology, computer hardware and computer software. It is the computer-specific part of information technology....
, shared memory is a memory that may be simultaneously accessed by multiple programs with an intent to provide communication among them or avoid redundant copies. Depending on context, programs may run on a single processor or on multiple separate processors. Using memory for communication inside a single program, for example among its multiple thread
Thread

----A thread is a kind of thin yarn used for textiles and sewing. Thread may also refer to:*Thread , a cotton yarn measure, equal to 54 inches...
s, is generally not referred to as shared memory.


The alternatives to shared memory are distributed memory
Distributed memory

In computer science, distributed memory refers to a Multiprocessing in which each central processing unit has its own private Computer memory. Computational tasks can only operate on local data, and if remote data is required, the computational task must communicate with one or more remote processors....
 and distributed shared memory
Distributed shared memory

Distributed Shared Memory , also known as a distributed global address space , is a term in computer science that refers to a wide class of software and hardware implementations, in which each node of a computer cluster has access to a large shared memory in addition to each node's limited non-shared private memory....
, each having a similar set of issues.






Discussion
Ask a question about 'Shared memory'
Start a new discussion about 'Shared memory'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In computing
Computing

Computing is usually defined as the activity of using and developing computer technology, computer hardware and computer software. It is the computer-specific part of information technology....
, shared memory is a memory that may be simultaneously accessed by multiple programs with an intent to provide communication among them or avoid redundant copies. Depending on context, programs may run on a single processor or on multiple separate processors. Using memory for communication inside a single program, for example among its multiple thread
Thread

----A thread is a kind of thin yarn used for textiles and sewing. Thread may also refer to:*Thread , a cotton yarn measure, equal to 54 inches...
s, is generally not referred to as shared memory.

In hardware


In computer hardware, shared memory refers to a (typically) large block of random access memory that can be accessed by several different central processing unit
Central processing unit

A central processing unit is an electronic circuit that can execute computer programs. This broad definition can easily be applied to many early computers that existed long before the term "CPU" ever came into widespread usage....
s (CPUs) in a multiple-processor computer system
Multiprocessing

Multiprocessing is the use of two or more CPU within a single computer system. The term also refers to the ability of a system to support more than one processor and/or the ability to allocate tasks between them....
.

A shared memory system is relatively easy to program since all processors share a single view of data and the communication between processors can be as fast as memory accesses to a same location.

The issue with shared memory systems is that many CPUs need fast access to memory and will likely cache
Cache

In computer science, a cache is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch or to compute, compared to the cost of reading the cache....
 memory, which has two complications:
  • CPU-to-memory connection becomes a bottleneck. Shared memory computers can not scale very well. Most of them have only ten processors.
  • Cache coherence: Whenever one cache is updated with information that may be used by other processors, the change needs to be reflected to the other processors, otherwise the different processors will be working with incoherent data (see cache coherence and memory coherence
    Memory coherence

    Memory coherence is an issue that affects the design of computer systems in which two or more Central processing units share a common area of memory ....
    ). Such coherence protocols can, when they work well, provide extremely high-performance access to shared information between multiple processors. On the other hand they can sometimes become overloaded and become a bottleneck to performance.


The alternatives to shared memory are distributed memory
Distributed memory

In computer science, distributed memory refers to a Multiprocessing in which each central processing unit has its own private Computer memory. Computational tasks can only operate on local data, and if remote data is required, the computational task must communicate with one or more remote processors....
 and distributed shared memory
Distributed shared memory

Distributed Shared Memory , also known as a distributed global address space , is a term in computer science that refers to a wide class of software and hardware implementations, in which each node of a computer cluster has access to a large shared memory in addition to each node's limited non-shared private memory....
, each having a similar set of issues. See also Non-Uniform Memory Access
Non-Uniform Memory Access

Non-Uniform Memory Access or Non-Uniform Memory Architecture is a computer storage design used in multiprocessors, where the memory access time depends on the memory location relative to a processor....
.

In software

In computer software, shared memory is either

  • a method of inter-process communication
    Inter-process communication

    Inter-Process Communication is a set of techniques for the exchange of data among multiple thread in one or more Process . Processes may be running on one or more computers connected by a computer network....
     (IPC), i.e. a way of exchanging data between programs running at the same time. One process
    Process (computing)

    In computing, a process is an Object of a computer program that is being sequentially executed by a computer system that has the ability to run several computer programs Concurrency ....
     will create an area in RAM
    Ram

    Ram, ram, or RAM as a non-acronymic wordAs a non-acronymic word Ram, ram, or RAM may refer to:...
     which other processes can access, or
  • a method of conserving memory space by directing accesses to what would ordinarily be copies of a piece of data to a single instance instead, by using virtual memory
    Virtual memory

    Virtual memory is a computer system technique which gives an application program the impression that it has contiguous working memory , while in fact it may be physically fragmented and may even overflow on to disk storage....
     mappings or with explicit support of the program in question. This is most often used for shared libraries and for Execute in Place.


Since both processes can access the shared memory area like regular working memory, this is a very fast way of communication (as opposed to other mechanisms of IPC such as named pipe
Named pipe

In computing, a named pipe is an extension to the traditional pipeline concept on Unix and Unix-like systems, and is one of the methods of inter-process communication....
s, Unix sockets or CORBA
Çorba

Chorba , shurpa , sorpa , or shorpo is one of various kinds of soup or stew found in national cuisines across Eurasia. The term is likely of Persian language or Turkic languages origin....
). On the other hand, it is less powerful, as for example the communicating processes must be running on the same machine (whereas other IPC methods can use a computer network
Computer network

A computer network is a group of interconnected computers. Networks may be classified according to a wide variety of characteristics. This article provides a general overview of some types and categories and also presents the basic components of a network....
), and care must be taken to avoid issues if processes sharing memory are running on separate CPUs and the underlying architecture is not cache coherent.

IPC by shared memory is used for example to transfer images between the application and the X server
X Window System

The X Window System is a computing software system and network protocol that provides a graphical user interface for networked computers. It implements the X Window System protocols and architecture and provides windowing system on raster graphics Visual display units and manages Keyboard and pointing device control functions....
 on Unix
Unix

Unix is a computer operating system originally developed in 1969 by a group of American Telephone & Telegraph employees at Bell Labs, including Ken Thompson , Dennis Ritchie, Douglas McIlroy, and Joe Ossanna....
 systems, or inside the IStream object returned by CoMarshalInterThreadInterfaceInStream in the COM libraries under Windows
Microsoft Windows

Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces ....
.

Dynamic libraries are generally held in memory once and mapped to multiple processes, and only pages that had to be customized for the individual process (because a symbol resolved differently there) are duplicated, usually with a mechanism that transparently copies the page when a write is attempted, and then lets the write succeed on the private copy.

POSIX
POSIX

POSIX or "Portable Operating System Interface" is the collective name of a family of related standardizations specified by the Institute of Electrical and Electronics Engineers to define the application programming interface , along with shell and utilities interfaces for software compatible with variants of the Unix operating system, altho...
 provides a standardized API for using shared memory, POSIX Shared Memory. This uses the function shm_open from sys/mman.h.

Unix System 5 provides an API for shared memory as well. This uses shmget from sys/shm.h.

BSD systems provide "anonymous mapped memory" which can be used by several processes.

See also

  • Shared Memory Architecture
    Shared Memory Architecture

    In computer architecture, Shared Memory Architecture refers to a design where the Graphics Card does not have its own dedicated memory, and instead shares the main system Random access memory with the Central processing unit and other components....
    , where the graphics chip uses main system RAM
  • Global variable
    Global variable

    In computer programming, a global variable is a variable that is accessible in every scope . Interaction mechanisms with global variables are called global environment mechanisms....
  • Distributed shared memory
    Distributed shared memory

    Distributed Shared Memory , also known as a distributed global address space , is a term in computer science that refers to a wide class of software and hardware implementations, in which each node of a computer cluster has access to a large shared memory in addition to each node's limited non-shared private memory....


External links

  • by Márcio Serolli Pinho
  • Article "" by Dave Marshall
    Dave Marshall

    Dave Marshall is a guitarist who has performed with Fiona , Vince Neil, and Slaughter .He toured with Vince Neil 93-95, opening for Van Halen and touring the world....
  • from the Single UNIX Specification
  • - POSIX
  • - documentation from SunOS 5.9
  • IPC SystemV shared memory. IPC message queues - posix ans system V.
  • from Win32-SDK
  • Paper "" by Marc Ronell