Re: netmcore: becoming a worker after fork+exec ?
Gerd Stolpmann <[email protected]> Sat, 07 Sep 2013 23:44:41 +0200
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <1378590281.10274.92.camel@zotac> |
--===============7706669063095216238== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-hPXd6i9LIRkHu1Ienno0" --=-hPXd6i9LIRkHu1Ienno0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Piotr, I don't think this is even possible. The point is that fork() ensures that master and worker have the mempool mapped at exactly the same address (because the mapping is just inherited). If you exec in between, the mempool is automatically unmapped in the child, and you would have to map it again. But the process is re-initialized because of the exec, and it is not sure that the address range is still free (and this is a real problem, as processes are nowadays initialized with some randomness to make addresses unpredictable), and so there is no good method to re-map the mempool at the same address. So that's the background why there isn't the option of passing file names or descriptors to Netmcore_mempool. I don't know what you have in mind, but maybe Netcamlbox is already sufficient? This module doesn't suffer from this problem, because every process can here map the shared memory block at different addresses. Gerd Am Samstag, den 07.09.2013, 00:16 -0400 schrieb Piotr Mardziel: > Hello ocamlnet developers, >=20 > Is it possible to establish the master/worker relationship with a process= that has been fork+exec'ed (or Netsys_posix.spawn'ed) but is of the same e= xecutable as the process doing Netmcore.startup ? >=20 > Let me explain. There is a problem on OSX in that forked child processes = cannot access some OS functionality (for example SDL will not work on a for= ked child process). One has to exec in order to get this functionality back= . I would like to be able to communicate with this process (of the same exe= cutable if need be) using the convenient netmcore modules but I don't see a= way for this process to get a handle on resources managed by the master pr= ocess. It seems like it is easy to get as far as the getting a handle to th= e shared memory from which a Netmcore_mempool is created (by simply passing= its name as a command argument to exec), but one cannot actually create th= e resource suitable for interacting with the master and other workers, as f= ar as I can tell. >=20 > Any info about this would be greatly appreciated. >=20 > Best, > Piotr (Peter) Mardziel <[email protected]> > http://www.cs.umd.edu/~piotrm >=20 >=20 >=20 >=20 > -------------------------------------------------------------------------= ----- > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologi= es > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=3D58041391&iu=3D/4140/ostg.= clktrk > _______________________________________________ > Ocamlnet-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel >=20 --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany [email protected] My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-hPXd6i9LIRkHu1Ienno0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAABAgAGBQJSK55JAAoJEAaM4b9ZLB5TtqUH/0oeAWSz20fnVPRwxZpi30Js GCDbevqu2RWBafzawjpHeQHgo8dnicA676UsHALlhASyJzjZmm4Sr+qw8CEdxeVC rlMfejfNXQTv89D/sIkMiQqET8v+K55MpoodVHpUyHZ0ZSSACmcswtAYJKPPr9lH vXz/zJnFNbAuBBEDUpjT1VgmZJlXHaVCY8KYzeqdKreXvGcTUjeYyDfx4gaGqrAQ movCcSwdjTf32I4zEzeq7vXhU9o+O4sX5doKrSNBvl59ehPFtr6VJM63vLnlDZ80 ZtErU0zflOAi7DPZbRqEyqGmDziMASkVINhLrUhtR3N90eoyJnpcgfOYZ4rq2Q0= =1P09 -----END PGP SIGNATURE----- --=-hPXd6i9LIRkHu1Ienno0-- --===============7706669063095216238== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk --===============7706669063095216238== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Ocamlnet-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ocamlnet-devel --===============7706669063095216238==--