Q.DESCRIBE SHARED MEMORY ?
A.1. In Computer Science, shared memory is memory that may be simultaneously accessed
by multiple programs with an intent to provide communication among them or avoid
redundant copies. Shared memory is an efficient means of passing data between programs.
Depending on context, programs may run on a single processor or on multiple separate
processors. Using memory for communication inside a single program,
e.g. among its multiple threads, is also referred to as shared memory
2. In computer hardware, shared memory refers to a (typically large) block of random access
memory (RAM) that can be accessed by several different central processing units (CPUs) in
a multiprocessor computer system.
Shared memory systems may use:[1]
 uniform memory access (UMA): all the processors share the physical memory uniformly;
 non-uniform memory access (NUMA): memory access time depends on the memory
location relative to a processor;
 cache-only memory architecture (COMA): the local memories for the processors at each
node is used as cache instead of as actual main memory.
3. In computer software, shared memory is either
 a method of inter-process communication (IPC), i.e. a way of exchanging data between
programs running at the same time. One process will create an area in RAM which other
processes can access;
 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 mappings or with
explicit support of the program in question. This is most often used for shared libraries and
for Execute in place (XIP).
4. POSIX provides a standardized API for using shared memory, POSIX Shared Memory. This uses
the function shm_open from sys/mman.h. POSIX inter process communication (part of the
POSIX:XSI Extension) includes the shared-memory
functions shmat , shmctl , shmdt and shmget .[3
Unix System V 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.
5. The shared memory created by shm_open is persistent. It stays in the system until explicitly
removed by a process. This has a drawback that if the process crashes and fails to clean up shared
memory it will stay until system shutdown.
6. Linux distributions based on the 2.6 kernel and later offer /dev/shm as shared memory in the form
of a RAM disk, more specifically as a world-writable directory (a directory in which every user of the
system can create files) that is stored in memory. Both the Red Hat and Debian based distributions
include it by default. Support for this type of RAM disk is completely optional within the
kernel configuration file
7. On Windows, one can use Create File Mapping and Map View Of File functions to map a
region of a file into memory in multiple processes
8.Some C++ libraries provide a portable and object-oriented access to shared memory functionality.
For example, Boost contains the Boost. Inter process C++ Library and Qt provides the Q Shared
Memory class
9. There is native support for shared memory also in programming languages besides C/C++. For
example, PHP provides an API to create shared memory, similar to POSIX functions
10. Example of shared memory is:
Topic : Shared memory

Topic : Shared memory

  • 1.
    Q.DESCRIBE SHARED MEMORY? A.1. In Computer Science, shared memory is memory that may be simultaneously accessed by multiple programs with an intent to provide communication among them or avoid redundant copies. Shared memory is an efficient means of passing data between programs. Depending on context, programs may run on a single processor or on multiple separate processors. Using memory for communication inside a single program, e.g. among its multiple threads, is also referred to as shared memory 2. In computer hardware, shared memory refers to a (typically large) block of random access memory (RAM) that can be accessed by several different central processing units (CPUs) in a multiprocessor computer system. Shared memory systems may use:[1]  uniform memory access (UMA): all the processors share the physical memory uniformly;  non-uniform memory access (NUMA): memory access time depends on the memory location relative to a processor;  cache-only memory architecture (COMA): the local memories for the processors at each node is used as cache instead of as actual main memory.
  • 2.
    3. In computersoftware, shared memory is either  a method of inter-process communication (IPC), i.e. a way of exchanging data between programs running at the same time. One process will create an area in RAM which other processes can access;  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 mappings or with explicit support of the program in question. This is most often used for shared libraries and for Execute in place (XIP). 4. POSIX provides a standardized API for using shared memory, POSIX Shared Memory. This uses the function shm_open from sys/mman.h. POSIX inter process communication (part of the POSIX:XSI Extension) includes the shared-memory functions shmat , shmctl , shmdt and shmget .[3 Unix System V 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. 5. The shared memory created by shm_open is persistent. It stays in the system until explicitly removed by a process. This has a drawback that if the process crashes and fails to clean up shared memory it will stay until system shutdown. 6. Linux distributions based on the 2.6 kernel and later offer /dev/shm as shared memory in the form of a RAM disk, more specifically as a world-writable directory (a directory in which every user of the system can create files) that is stored in memory. Both the Red Hat and Debian based distributions include it by default. Support for this type of RAM disk is completely optional within the kernel configuration file 7. On Windows, one can use Create File Mapping and Map View Of File functions to map a region of a file into memory in multiple processes 8.Some C++ libraries provide a portable and object-oriented access to shared memory functionality. For example, Boost contains the Boost. Inter process C++ Library and Qt provides the Q Shared Memory class 9. There is native support for shared memory also in programming languages besides C/C++. For example, PHP provides an API to create shared memory, similar to POSIX functions 10. Example of shared memory is: