From owner-freebsd-questions Sun Jul 8 8:37: 0 2001 Delivered-To: freebsd-questions@freebsd.org Received: from beta.root-servers.ch (gamma.root-servers.ch [195.49.62.126]) by hub.freebsd.org (Postfix) with SMTP id 7283837B41F for ; Sun, 8 Jul 2001 08:36:51 -0700 (PDT) (envelope-from gabriel_ambuehl@buz.ch) Received: (qmail 67686 invoked from network); 8 Jul 2001 15:36:50 -0000 Received: from dclient106-17.hispeed.ch (HELO athlon550) (62.2.106.17) by beta.root-servers.ch with SMTP; 8 Jul 2001 15:36:50 -0000 Date: Sun, 8 Jul 2001 17:37:49 +0200 From: Gabriel Ambuehl X-Mailer: The Bat! (v1.53bis) Educational Organization: BUZ Internet Services X-Priority: 3 (Normal) Message-ID: <84594262844.20010708173749@buz.ch> To: Arjan Knepper Cc: freebsd-questions@freebsd.org Subject: Re[2]: Passing data in C++ via stdin without waiting for the new process to complete In-Reply-To: <3B484403.1BA9A21D@jak.nl> References: <114577608557.20010708130014@buz.ch> <3B484403.1BA9A21D@jak.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG -----BEGIN PGP SIGNED MESSAGE----- Hello Arjan, Sunday, July 08, 2001, 1:29:07 PM, you wrote: > read : > man -a 2 fork > man -a 2 rfork > man -a 2 vfork > man -a 2 wait > man -a 2 _exit > man -a 3 exit > man -a 2 dup dup2 Oh I've read all of those (except the dup() stuff). It's just that I think that all of the fork derivatives won't do me any good as they are thought to fork another copy of the current process as does, for example, Apache 1.3 to achieve simultaneous handling of concurrent requests. But I need to spawn separate, distinct executables that perform their very own tasks, not just a copy of the calling process. The exec() family of calls looks more promising, but those still block the parent process. I need a solution, that allows the parent process to continue its work immediately after the child has been spawned, no matter how long it takes the child to complete. One somewhat crazy way to circumvent the blocking of the parent would be to use a separate thread to control each of the currently running childs but I fear that this would end up in a performance problem if each call to an external executable also involves creation of a thread in the parent. Another approach, which perhaps would even be the faster one (how compares fork() to the creation of a wholly new process from scratch?), is to simple create fork() based daemons out of the external programs which then accept their params by TCP or UDP... > P.S Buy the book : "Advanced Programming in teh UNIX environment" > by W.R.Stevens ISBN:0-201-56317-7 and maybe his other books about > "Unix Network Programming" as well. I've already got Volume 1 of Network Programming by Stevens right beside me and didn't want to don't like C and thus use C++ (would prefer Python but that is too slow and too separated from the System for my current project) which at least got stuff like dynamic arrays built into the STL so I don't have to come up with what I consider to be essential data types... Best regards, Gabriel -----BEGIN PGP SIGNATURE----- Version: PGP 6.5i iQEVAwUBO0hwQMZa2WpymlDxAQGhUwf/TGTbKLC8/htZ+duiD/gL6OYs38fK17U0 kHohMw3EQ5fM/bK+kD34cfaWJyyqjCUgSo5NaGh9Vi2thalrippIi1GIh0AO0Q6s hjj26+a0PT+qwHq6XglblFc6RB3VnW/0M4t2AHpoyNs8CHax/o/xsKbSWcfW/ODq bD4eUcYxhu+f5RA5gsyofLczBkYAssz5At9bZVWTKwYHAonSzuUb0OfrdBCRK/Eg IA1SAw8kI9TJJ/vz5C+ldKCG44u9Jm/ssTvHoJv5NOa1nNlkb2dGg6EwhB2eSsbx fezrOd8UatPYfVFhU0OWY23s4B/aHuDb38oSkbShIrj8FS5qlFUnog== =F3Lv -----END PGP SIGNATURE----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message