Solved

about shared memory

Posted on 2007-11-21
4
297 Views
Last Modified: 2010-04-22
Hi,

I am using shared memory. And I got some questions...

1. When a parent process has already attach the shared memory and fork a child, would the child inherite the shared memory segment??

2. I am running a program that I wrote using fork and shared memory. It compills okay and when I run, I get this message " No space left on device shared memory".
I have done some research and found out I can see how many shared memory currently exist. I typed in "ipcs -m" command line to see how many shared mem exist and found out there are so many!! (more than 50!!) IS there anyway that I can just delete existing shared memory??

Thank you for any advise~! And happy Thanksgiving!
0
Comment
Question by:shinymoon
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
SwassLikeMe earned 500 total points
ID: 20330904
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296

Customizing these for your system and adding them into the /etc/sysctl.conf file should make it work.  You'll need to reboot of course.

Yes, you can delete shared memory segments, but please make sure you're processes are no longer using them.  Do a 'man ipcs' to see how to do that.  Also, if your program isn't running anymore but still has hold of the shared memory, you'll need to make sure it gives it back to the operating system when it's finished running.  This will chew up memory allocation very quickly if you don't do that.
0
 

Author Comment

by:shinymoon
ID: 20341100
I opend /etc/sysctl.conf file to add those customizations. But, the file is read-olny file so that I could not modify anything........

In my program, I did not remove shared memory segments before ( now I added code to remove shared mem segment after I am done using)......And I guess the shared memory segments I've created still exist and used up the memory.....

What should I do??
please help. I need to pass my operating class......
0
 
LVL 2

Expert Comment

by:SwassLikeMe
ID: 20378158
Sorry for the delay in responding.  I've been out of town for the Thanksgiving.  You'll need write permissions to the file otherwise it won't work.  If you are root, you automatically have the permissions, but you'll need to force them by doing a :w!  

Rebooting the box will clear the memory segments up that you have in place.  I wouldn't actually modify the sysctl.conf file if you don't need to -- and it sounds as though you don't need to.  But if you do choose to, please make sure you modify the parameters for your system -- they are based on memory, etc.  This can cause more problems for you if they are inappropriately set.
0
 

Author Comment

by:shinymoon
ID: 20380512
thanks for your reply :)
The server administrator removed all shared memory segments that are not being used. So, the problem is solved. Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

930 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now