Solved

about shared memory

Posted on 2007-11-21
4
323 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
[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
  • 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

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

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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 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