Mail Archives: cygwin/2002/03/22/05:50:45
Hello,
Because my problems with fork and DLL continue, I tried to remove
DLL and to test only fork.
And Cygwin had a really different behavior than unix has.
With the programm below I have 1000 times "Je suis le fils" and then
10000 times "Je suis le pere" or the reverse sometimes.
Under my solaris the sentence switch after about 800 outputs. (See the
output traces at the end of mail)
I tried sched_setsched function too, (for SCHED_OTHER) but they seems
not implemented.
Is there a way to set the priority of the fork processes ???
Stephane
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int main(void)
{
int probe_pid, i;
printf("before fork\n");
probe_pid = fork();
printf("after fork %d\n", probe_pid);
switch (probe_pid)
{
case 0 :
for (i=0; i<10000; i++)
{
printf("%d> Je suis le fils %d\n", probe_pid, i);
}
break;
case -1 :
printf ("Erreur fork\n");
exit(-1);
break;
default:
for (i=0; i<10000; i++)
{
printf("%d> Je suis le pere %d\n", probe_pid, i);
}
break;
}
return 0;
}
Output : (On Cygwin 1.3.10-1 NT4)
before fork
after fork 343
343> Je suis le pere 0
343> Je suis le pere 1
...
9999> Je suis le pere 9999
after fork 0 <----------- See where the child begins
0> Je suis le fils 0
0> Je suis le fils 1
...
9999> Je suis le fils 9999
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -