Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-06-2010, 06:55 AM   #1
LQ Newbie
Registered: Sep 2010
Posts: 3

Rep: Reputation: 0
Memory optimization for child processes

Hello everyone,

I have been following the forum for a while now. This is my first post here.

I work on Linux for ARM processor for cable modem. There is a tool that I have written (as the job demands) that sends/storms customized UDP packets using raw sockets. I form the packet from scratch so that we have the flexibility to play with different options. This tool is mainly for stress testing routers.

The details are here.

I actually have multiple interfaces created. Each interface will obtain IP addresses using DHCP. This is done in order to make the modem behave as virtual customer premises equipment (vcpe).

When the system comes up, I start those processes that are asked to. Every process that I start will continuously send packets. So process 0 will send packets using interface 0 and so on. Each of these processes that send packets would allow configuration (change in UDP parameters and other options at run time). Thats the reason I decide to have separate processes.

I start these processes using fork and excec from the provisioning processes of the modem.

The problem now is that each process takes up a lot of memory. Starting just 3 such processes, causes the system to crash and reboot.

I have tried the following:-
1-I have always assumed that pushing more code to the Shared Libraries will help. So when I tried moving many functions into shared library and keeping minimum code in the processes, it made no difference to my surprise.

2-I also removed all arrays and made them use the heap. However it made no difference. This maybe because the processes runs continuously and it makes no difference if it is stack or heap?

3-I suspect the process from I where I call the fork is huge and that is the reason for the processes that I make result being huge. I am not sure how else I could go about. say process A is huge -> I start process B by forking and excec. B inherits A's memory area. So now I do this -> A starts C which inturn starts B will also not help as C still inherits A?. I used vfork as an alternative which did not help either. I do wonder why.

I would appreciate if someone give me tips to help me reduce the memory used by each independent child processes.

Kindly do let me know if you need more details or clarification.

Thank you.
Old 09-06-2010, 11:39 AM   #2
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
I would appreciate if someone give me tips to help me reduce the memory used by each independent child processes.
We can't without any code snippet.
By the way, if your application run on a "normal" linux box, or if you're able to install tools and/or mem profilers on you ARM platform, just go for it, there's plenty of that shows you where your application eat memory (valgrind is certainly the most known of them)...

I think your thread would better suit in the "programming" sub-forum.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Child processes of a Parent Process occupying socket memory Linux - Newbie 2 08-03-2010 03:27 AM
[SOLVED] monitoring child processes caverdave Programming 5 12-10-2009 04:22 PM
forking 7 child processes ianomc Programming 5 11-07-2004 12:33 PM
Rotatelogs - Do I have too many child processes? fireman949 Linux - Software 2 06-08-2004 02:04 PM
Memory usage when spawning child processes brianvdc Programming 4 10-24-2003 06:03 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:45 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration