Problem due to Fork Error


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Problem due to Fork Error
# 1  
Old 07-03-2008
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 workingSmilie

Can any body help me out to solve this Fork error problem.Smilie
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!!
# 2  
Old 07-03-2008
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
# 3  
Old 07-07-2008
Quote:
Originally Posted by matrixmadhan
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!Smilie

Can you please tell me Second Method in detail..means which all commands i have to use(any sample)Smilie ...I am quite new to unix.... Smilie
# 4  
Old 07-07-2008
Hello
While searching in this forum i have found the below link:
https://www.unix.com/unix-dummies-que...ork-error.html

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??Smilie

Thanks in Advance!
# 5  
Old 07-09-2008
Any Help on this???Smilie Smilie
# 6  
Old 07-13-2008
Please do read the rules of the forum and donot bump up with questions if they are not promptly answered. Smilie

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. Smilie
# 7  
Old 07-13-2008
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?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Very basic problem with fork() using c

Hi guys, I have the following code: int main(int argc, char *argv) { int pid1,pid2,i=0; pid1=fork(); i+=2; if(!pid1) i++; if(i%3) pid2=fork(); if (pid2==0) { printf("sea \n "); i-=1; } if(i>=2)... (4 Replies)
Discussion started by: pfpietro
4 Replies

2. Programming

problem with mutltiple fork()

Hi, can someone please help me with creating mutltiple fork.. I was expecting something like this: I am a child: 1 PID: 1215 I am a child: 2 PID: 1216 I am a child: 3 PID: 1217 I am a child: 4 PID: 1218 I am a child: 5 PID: 1219 I am a child: 6 PID: 1215 I am a child: 7 PID: 1216 I am a... (4 Replies)
Discussion started by: Placenzo
4 Replies

3. Programming

help in C of fork() problem

i am a beginner of C, and i tired to fork multiple child and all of them belongs to same parents and each of child responsible for printing individual data. but i don't have any idea how to do...... Can any body help? thanks a lot really. (7 Replies)
Discussion started by: wendy1089
7 Replies

4. IP Networking

FTP failure due to network problem

Hi, I've been searching through out this forum to find the exact message when during the on-going FTP, suddenly the network went down but i cannot find some. Could anyone provide me the exact return codes when FTP failed during FTP or prior to FTP the network went down and you still proceeded to... (3 Replies)
Discussion started by: vibora
3 Replies

5. SCO

Booting problem due to adding hard drive incorrectly

I have tried to (unsuccessfully) add an old drive to get drivers (for the 3Com network card) onto a Sco Openserver 5.1 server. Now it wont boot: I used Sco Admin to do this. It have 3 scuzzi drives I added an IDE I think what I did wrong was add the IDE to existing space, and I should not have... (6 Replies)
Discussion started by: lappies67
6 Replies

6. Programming

problem implementing fork

Hi, I was honing my linux programming skill when this nuisance started bugging me. I wanted to create an empty file creator program. While creating a large file it must print # for progress bar. But the output shows it happening reverse way. ie. first it copies file and shows the progress... (7 Replies)
Discussion started by: dheerajsuthar
7 Replies

7. Shell Programming and Scripting

Script problem due to recursive directories Help please

Hello everyone , I am looking for a better solution then the one I have created for the my Task The task is: Create an automated script that will check for Uploads in a specified Directory and move them to another specified Directory if the files are completely uploaded. Files are FTP'd to... (2 Replies)
Discussion started by: robertmcol
2 Replies

8. Filesystems, Disks and Memory

ACL problem due to mv command used in solaris

Hi All, Is there any way to use mv command and that should apply ACL on the moved files that is already set in distination location This mv command is running in a solaris system. File system is NFS. Problem I am facing : Currently mv command removes ACL from moved files and also it... (0 Replies)
Discussion started by: Tlogine
0 Replies

9. Programming

fork() problem

i'm just trying to make 2 process read from the same 1 line a time. For some reason only the child reads. #include<stdio.h> #include <sys/types.h> void getlinefromfilep(void); void getlinefromfilec(void); int see=0; FILE * fileptr1; //need globe variable to tell pro3 to stop main()... (3 Replies)
Discussion started by: ddx08
3 Replies

10. Programming

fork problem

Hi, Consider the following piece of code: int main(void) { int i; pid_t pidp; for (i=0;i<4;i++) { switch (pidp=fork()) { case -1: fprintf(stdout, "Error during fork.\n"); exit (1); case 0: fprintf(stdout, "From child: I am... (4 Replies)
Discussion started by: qntmteleporter
4 Replies
Login or Register to Ask a Question