This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cygwin implementation of fork() eating all resourses?


After 5 minutes running this script  i got a windwows XP 
error: not enough system resourses.

<----------------------
#!/bin/bash
while (( 1 )); do
  ls > /dev/null;
done;
---------------------->

This program leads to the same result:

<------------------------- 
#include <sys/types.h>
#include <unistd.h>

int main() {
    bool fl = true;
    while ( fl ) {
	pid_t child_pid = fork();
	if ( child_pid != 0 ) {
	    //parent process, continue loop ...
	    fl = true;	    
	} else {
	    //child process, exit loop ...
	    fl = false;   
	};//end if
    };//end while
}
----------------------------->

At normal linux systems this code works well ... Is it a 
bug?

P.S. Sorry for my bad english.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]