Solved

is shared memory automatically inherited to child process?

Posted on 2007-11-23
2
815 Views
Last Modified: 2012-08-13
Hi,

I have a question about a shared memory.
If a parent process gets and attaches a segment of shared memory and then forks a child, would the child process have an access to this shared memory????

Or do I need to explicitly attach this shared memory segment to the child process??
 
0
Comment
Question by:shinymoon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
PCableGuy earned 500 total points
ID: 20341539
Yes, the child has access to the same shared memory as the parent. In fact, shared memory is considered a form of interprocess communication. No need to attach the memory to the child. However, you still need to avoid the problem of the parent and child (or other child processes) writing to same memory location - in that case you need to use semapores too.

http://www.csl.mtu.edu/cs4411.ck/www/NOTES/process/shm/what-is-shm.html

Also check the section here called "Attaching a Shared Memory Segment to an Address Space"
http://www.ccse.kfupm.edu.sa/~akbar/ICS431_032/LabExercises/Lab13/Lab13.html


0
 

Author Comment

by:shinymoon
ID: 20341551
Thank you so much for the clear answer and great website!!! It helped me a lot.
Thank you!!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Google Mini is no longer serving everything 7 164
IPtables not running - RHEL7 64bit 5 252
Trying to compile syslinux 4.03 on Ubuntu 14.04 14 188
Cloning a part of HDD MIPS Linux 16 121
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question