The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
fork() problem ddx08 High Level Programming 3 03-01-2007 05:06 AM
Error Checking Problem pokeycam Shell Programming and Scripting 4 09-13-2006 12:38 AM
fork problem qntmteleporter High Level Programming 4 01-25-2006 02:56 AM
link error problem niukun Linux 4 11-18-2004 12:14 AM
fork error santoshsonawane UNIX for Dummies Questions & Answers 1 08-17-2002 06:59 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-03-2008
Registered User
 

Join Date: Oct 2007
Posts: 20
Stumble this Post!
Problem due to Fork Error

Hi,
I have developed a datastage job...which has many process running in parallel..but because of Fork Error my job is not working

Can any body help me out to solve this Fork error problem.
My Os is SUNOS.
IS there any setting in Unix through admin where in if i set some paramter my process will get atomatically killed when specific duration has elapsed...

Thanks in Advance!!
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-03-2008
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,572
Stumble this Post!
there are two approaches to this.
1) set a timer in the child - which generates SIGALRM after specified 'n' units of time, register handler for that signal and in the handler, it should terminate itself

2) have a controller program which takes care of creating new process on need, monitoring them and if it lives more than the threshold trigger it with a signal and accordingly in the child register handler for that signal and it should terminate.

Both the methods are doable, and you will have more control with the second approach, as number of child to be spawned, time for which child should live everything can be configured in the invoker process
Reply With Quote
  #3 (permalink)  
Old 07-06-2008
Registered User
 

Join Date: Oct 2007
Posts: 20
Stumble this Post!
Quote:
Originally Posted by matrixmadhan View Post
there are two approaches to this.
1) set a timer in the child - which generates SIGALRM after specified 'n' units of time, register handler for that signal and in the handler, it should terminate itself

2) have a controller program which takes care of creating new process on need, monitoring them and if it lives more than the threshold trigger it with a signal and accordingly in the child register handler for that signal and it should terminate.

Both the methods are doable, and you will have more control with the second approach, as number of child to be spawned, time for which child should live everything can be configured in the invoker process
Thanks for your reply!

Can you please tell me Second Method in detail..means which all commands i have to use(any sample) ...I am quite new to unix....
Reply With Quote
  #4 (permalink)  
Old 07-07-2008
Registered User
 

Join Date: Oct 2007
Posts: 20
Stumble this Post!
Hello
While searching in this forum i have found the below link:
fork error

As per hell666 there is :
There's a limit to the number of fork() processes that can exist at any given point in time, and this limit is configurable. This threshold is there somewhere in the control panel (don't remember where), increase this limit.

So can anybody tell me what exactly i have to set??

Thanks in Advance!
Reply With Quote
  #5 (permalink)  
Old 07-09-2008
Registered User
 

Join Date: Oct 2007
Posts: 20
Stumble this Post!
Any Help on this???
Reply With Quote
  #6 (permalink)  
Old 07-13-2008
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,572
Stumble this Post!
Please do read the rules of the forum and donot bump up with questions if they are not promptly answered.

Coming to the point,

monitor program would be a parent process which would fork() to create new child process, better to have some kind of count to control the child process creation ( MAX_CHILD_PROCESS_ALLOWED ), once fork is successful parent gets the child pid, store them in an array or any other data structure, check for the existence of the child by sending kill -0 ( to see if they exist ), or register any signal handlers in the child if any communication needs to be carried over between parent and child.

This is just a pointer and you will have many interesting challenges like daemon -izing, defunct process creation etc.

Give it a shot, post us if you are stuck up somewhere.
Reply With Quote
  #7 (permalink)  
Old 07-13-2008
Registered User
 

Join Date: Apr 2006
Location: Northern Virginia
Posts: 23
Stumble this Post!
fork() error

As mentioned, this is sometimes due to a resource limitation, but you would be seeing a long list of "child" processes in your "ps" command if that were the case. Memory leaks can exhaust available RAM, which can also result in fork failures. The "second option" mentioned here is often done through use of IPC's such as semaphore's. We also use these for management of threads. Threads are more efficient because it does not cause a full process duplication. There are pthread.h management facilities available also, very cool to use and to have in your code.

The question gets down to whether one is multi-processing with the same code, or doing a fork/exec in order to spawn a completely separate process.

Does this help?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0