Solved

is shared memory automatically inherited to child process?

Posted on 2007-11-23
2
799 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
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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