Solved

about shared memory

Posted on 2007-11-21
4
293 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Linux daemon 11 348
benchmark write speed to disk on linux 2 65
Trying to compile syslinux 4.03 on Ubuntu 14.04 14 134
Cron jobs 12 88
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

707 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

16 Experts available now in Live!

Get 1:1 Help Now