Sponsored Content
Top Forums Programming memory sharing - not shared memory - Post 302116087 by porter on Tuesday 1st of May 2007 05:33:03 PM
Old 05-01-2007
Quote:
Originally Posted by elzalem
i have 2 linked lists that are constantly growing or shrinking, both r visible to all processes, i don't want each process to have a copy, i hope you're understanding what i mean.
without "shared memory" is it possible?
... and the moon on a stick presumably?

You can share it in memory or have another server process that contains the list and all other processes use some form of IPC or RPC to access.

You can't share something by not sharing it.

Last edited by porter; 05-01-2007 at 07:26 PM..
 

10 More Discussions You Might Find Interesting

1. Programming

Shared memory

Dear Reader, Is is necessary to attach / dettach the shared memory segments for write operations , if more than one program is accessing same shared memory segments.. I have used semaphore mutex and still I'm getting segmentation fault when I write to the segment when other program is already... (1 Reply)
Discussion started by: joseph_shibu
1 Replies

2. UNIX for Advanced & Expert Users

Shared memory shortage but lots of unused memory

I am running HP-UX B.11.11. I'm increasing a parameter for a database engine so that it uses more memory to buffer the disk drive (to speed up performance). I have over 5GB of memory not being used. But when I try to start the DB with the increased buffer parameter I get told. "Not... (1 Reply)
Discussion started by: cjcamaro
1 Replies

3. UNIX for Advanced & Expert Users

mmap vs shared memory - which is best for sharing data between applications?

Between mmap and shared memory which is the best method of sharing data between multiple applications, interms of speed? (2 Replies)
Discussion started by: nmds
2 Replies

4. Linux

all about shared memory

Hi all :confused: , I am new to unix.I have been asked to implement shared memory in user's mode.What does this mean?What is the difference it makes in kernel mode and in users mode?What are the advantages of this impemenation(user's mode)? And also i would like to know why exactly shared... (0 Replies)
Discussion started by: vijaya2006
0 Replies

5. Programming

Shared memory in shared library

I need to create a shared library to access an in memory DB. The DB is not huge, but big enough to make it cumbersome to carry around in every single process using the shared library. Luckily, it is pretty static information, so I don't need to worry much about synchronizing the data between... (12 Replies)
Discussion started by: DreamWarrior
12 Replies

6. Programming

Shared memory for shared library

I am writing a shared library in Linux (but compatible with other UNIXes) and I want to allow multiple instances to share a piece of memory -- 1 byte is enough. What's the "best" way to do this? I want to optimize for speed and portability. Obviously, I'll have to worry about mutual exclusion. (0 Replies)
Discussion started by: otheus
0 Replies

7. UNIX for Advanced & Expert Users

Shared Memory

Hi, Using ipcs we can see shared memory, etc.. details. How can I add/remove shared memory(command name)? Thanks, Naga:cool: (2 Replies)
Discussion started by: Nagapandi
2 Replies

8. AIX

shared memory

1.How to know wich process is using the shared memory? 2.How to flush (release) the process from the shared memory? (1 Reply)
Discussion started by: pchangba
1 Replies

9. Programming

Memory sharing with NCURSES

Hey, Im using a shared memory segment to share a WINDOW structure among 2 processes. Basically I'm building a multi-player snake game in which multiple prrocesses access the window. The 'parent' process initializes the shared memory segment and puts the window in it. I can access and perform... (1 Reply)
Discussion started by: dgre0018
1 Replies

10. Programming

Shared library with acces to shared memory.

Hello. I am new to this forum and I would like to ask for advice about low level POSIX programming. I have to implement a POSIX compliant C shared library. A file will have some variables and the shared library will have some functions which need those variables. There is one special... (5 Replies)
Discussion started by: iamjag
5 Replies
vmmap(1)						    BSD General Commands Manual 						  vmmap(1)

NAME
vmmap -- Display the virtual memory regions allocated in a process SYNOPSIS
vmmap [-d seconds] [-w] [-resident] [-pages] [-interleaved] [-submap] [-allSplitLibs] [-noCoalesce] [-v] pid | partial-executable-name DESCRIPTION
vmmap displays the virtual memory regions allocated in a specified process, helping a programmer understand how memory is being used, and what the purposes of memory at a given address may be. The process can be specified by process ID or by full or partial executable name. OPTIONS
-d seconds Take two snapshots of the vm regions of the process, separated by the specified time, and print the delta between those snap- shots. -w, -wide Print wide output. -resident Show both the virtual and resident sizes for each region, in the form [ virtual/resident]. -pages Print region sizes in page counts rather than kilobytes. -interleaved Print all regions in ascending order of starting address, rather than printing all non-writable regions followed by all writable regions. -submap Print information about VM submaps. -allSplitLibs Print information about all shared system split libraries, even those not loaded by this process. -noCoalesce Do not coalesce adjacent identical regions. Default is to coalesce for more concise output. -v, -verbose Equivalent to -w -resident -dirty -purge -submap -allSplitLibs -noCoalesce EXPLANATION OF OUTPUT
For each region, vmmap describes the starting address, ending address, size of the region (in kilobytes or pages), read/write permissions for the page, sharing mode for the page, and the purpose of the pages. The size of the virtual memory region represents the virtual memory pages reserved, but not necessarily allocated. For example, using the vm_allocate Mach system call reserves the pages, but physical memory won't be allocated for the page until the memory is actually touched. A memory-mapped file may have a virtual memory page reserved, but the pages are not instantiated until a read or write happens. Thus, this size may not correctly describe the application's true memory usage. If the -resident flag is given, then both the virtual and physical size of each region is shown, in the form [virtual/resident]. By default, the sizes are shown in kilobytes. If the -pages flag is given, then the sizes are in number of 4KB pages. The protection mode describes if the memory is readable, writable, or executable. Each virtual memory region has a current permission, and a maximum permission. In the line for a virtual memory region, the current permission is displayed first, the maximum permission second. For example, the first page of an application (starting at address 0x00000000) permits neither reads, writes, or execution ("---"), ensuring that any reads or writes to address 0, or dereferences of a NULL pointer immediately cause a bus error. Pages representing an executable always have the execute and read bits set ("r-x"). The current permissions usually do not permit writing to the region. However, the maximum per- missions allow writing so that the debugger can request write access to a page to insert breakpoints. Permissions for executables appear as "r-x/rwx" to indicate these permissions. The share mode describes whether pages are shared between processes,and what happens when pages are modified. Private pages (PRV) are pages only visible to this process. They are allocated as they are written to, and can be paged out to disk. Copy-on-write (COW) pages are shared by multiple processes (or shared by a single process in multiple locations). When the page is modified, the writing process then receives its own private copy of the page. Empty (NUL) sharing implies that the page does not really exist in physical memory. Aliased (ALI) and shared (SHM) memory is shared between processes. The share mode typically describes the general mode controlling the region. For example, as copy-on-write pages are modified, they become private to the application. Even with the private pages, the region is still COW until all pages become private. Once all pages are pri- vate, then the share mode would change to private. The far left column names the purpose of the memory: malloc regions, stack, text or data segment, etc. For regions loaded from binaries, the far right shows the library loaded into the memory. If the -submap flag is given, then vmmap's output includes descriptions of submaps. A submap is a shared set of virtual memory page descrip- tions that the operating system can reuse between multiple processes. Submaps minimize the operating system's memory usage by representing the virtual memory regions only once. Submaps can either be shared by all processes (machine-wide) or local to the process (process-only). (Understanding where submaps are located is irrelevant for most developers, but may be interesting for anyone working with low levels of the virtual memory system.) For example, one submap contains the read-only portions of the most common dynamic libraries. These libraries are needed by most programs on the system, and because they are read-only, they will never be changed. As a result, the operating system shares these pages between all the processes, and only needs to create a single data structure to describe how this memory is laid out in every process. That section of memory is referred to as the "split library region", and it is shared system-wide. So, technically, all of the dynamic libraries that have been loaded into that region are in the VM map of every process, even though some processes may not be using some of those libraries. By default, vmmap shows only those shared system split libraries that have been loaded into the specified target process. If the -allSplitLibs flags is given, information about all shared system split libraries will be printed, regardless of whether they've been loaded into the specified target process or not. If the contents of a machine-wide submap are changed -- for example, the debugger makes a section of memory for a dylib writable so it can insert debugging traps -- then the submap becomes local, and the kernel will allocate memory to store the extra copy. SEE ALSO
heap(1), leaks(1), malloc_history(1), stringdups(1), lsof(8) The heap, leaks, and malloc_history commands can be used to look at various aspects of a process's memory usage. The lsof command can be used to get a list of open and mapped files in one or more processes, which can help determine why a volume can't be unmounted or ejected, for example. The Xcode developer tools also include Instruments, a graphical application that can give information similar to that provided by vmmap. The Allocations instrument graphically displays dynamic, real-time information about the object and memory use in an application (including VM allocations), as well as backtraces of where the allocations occured. The VM Tracker instrument in the Allocations template graphically dis- plays information about the virtual memory regions in a process. BSD
Mar. 16, 2013 BSD
All times are GMT -4. The time now is 09:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy