Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Jul 2001 15:43:17 -0300 (ART)
From:      Fernando Gleiser <fgleiser@cactus.fi.uba.ar>
To:        Gabriel Ambuehl <gabriel_ambuehl@buz.ch>
Cc:        <freebsd-questions@FreeBSD.ORG>
Subject:   Re[2]: Passing data in C++ via stdin without waiting for the new process to  complete
Message-ID:  <20010708152330.A48298-100000@cactus.fi.uba.ar>
In-Reply-To: <186598221416.20010708184347@buz.ch>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 8 Jul 2001, Gabriel Ambuehl wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
>
> Hello David,
>
> Sunday, July 08, 2001, 5:43:56 PM, you wrote:
>
> > fork and execl!!!
>
> > execl replaces the current process.  So fork then execl.
>
> Sounds pretty expensive. I think I'll go for a bunch of daemons that
> communicate via TCP/IP with the master one and then do whatever they
> need to. Forking forking the master daemon doesn't seem to be a very
> good idea as it sometimes gets pretty large and thus this would be
> pretty expensive...

How many processes per second are you going to spawn? This is the standard
way of building servers. In fact, this is how most of the system daemons
work (SMTP daemon, inetd, sshd, ftpd, lpd, etc). The shell forks itself
and the execs the command you typed. getty(8) execs login(1) which execs
you login shell.

The only exceptions are web servers and other bests where you expect to get
1000s of connections per second.

Besides, are you sure that the added overhead involved in the message passing
isn't bigger than the fork and exec?

again: go and read stevens books. "Unix Network Programming" has a chapter
about server architectures.


				Fer


>
> Best regards,
>  Gabriel
> R
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 6.5i
>
> iQEVAwUBO0h/ucZa2WpymlDxAQEz6AgAlC83VUf47HfI51fWyHC3vuiVbX/bmMJT
> 2ZaR5UGFaUxXj8GOMUVVcQp1Def172/R04IukmO7XdscbsQft6cv2ISDPKWsL7Iz
> ghX5o17WBXXjRCOpK5aAvB52BDmtKqK475U7pUaihyUMRPCmhWxe+qBf9+Relog6
> yjmi+jD7M1Q0ehBsQqEsrUIAOGvfiXhzSTwZCtB81YT9/KF3jUA6Epflj4q97RkU
> 9imY1DCo2QEK3rGkmBKh7r+7bLgb9Qj1/16AVcGlLV1gEO+8L3sZKcBgvEEy+cEi
> /2pDcY/k/tCa0R2I7hz0fNiCpzzNi08Y4Sn24m4vmSMq+NayCZbKPw==
> =CAHy
> -----END PGP SIGNATURE-----
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010708152330.A48298-100000>