Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dudar del fork
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Spanish
View previous topic :: View next topic  
Author Message
silvered
n00b
n00b


Joined: 05 Aug 2012
Posts: 11

PostPosted: Tue Aug 07, 2012 11:12 pm    Post subject: dudar del fork Reply with quote

al momento de correr me sale que el fork no esta referenciado

alguien lo puede correguir???


#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <time.h>

#define N 10000

int process( int n )
{ pid_t pid;

pid = fork();

printf("%d.-proceso %d (hijo) <- %d (padre) \n", n, pid, getpid());

if (pid==0) printf("[%d, proceso hijo, %d]", n, pid);
if (pid!=-1)printf(" [%d, proceso padre %d] \n", n, getpid() );

if (n<N)
{
return process( n+1 );
}
else {
return N;
}
}

int main( void )
{ time_t ti, tf;
int Dt;

time(&ti);
process(1);
time(&tf);

Dt= difftime(tf,ti);
printf("Tiempo %0.2f\n",(float)Dt );
printf("Finalizado!!!\n");
return 0;
}
Back to top
View user's profile Send private message
edgar_uriel84
Guru
Guru


Joined: 21 Dec 2008
Posts: 442
Location: Tultitlan, México

PostPosted: Wed Aug 08, 2012 4:21 am    Post subject: Reply with quote

Si comentas que debe hacer el programa es posible que consigas ayuda.
_________________
Algún día habrá una persona mejor que yo, pero esa persona no eres tú ni ese momento es ahora.
Back to top
View user's profile Send private message
afb
n00b
n00b


Joined: 13 Oct 2007
Posts: 65

PostPosted: Wed Aug 08, 2012 10:21 pm    Post subject: Reply with quote

He ejecutado tu programa y funciona sin problemas.

Saludos
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Spanish All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum