Solved

about shared memory

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Equivalent solution for gettimezoneinformation 12 148
what is Amazon Linux AMI 6 80
awk file 6 126
bash file 10 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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
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 …

739 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