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?
10 More Discussions You Might Find Interesting
1. Programming
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
2. Programming
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
3. Filesystems, Disks and Memory
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
4. Shell Programming and Scripting
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
5. Programming
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
6. SCO
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
7. IP Networking
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
8. Programming
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
9. Programming
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
10. UNIX for Dummies Questions & Answers
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