From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id D3CA67F72C for ; Wed, 17 Aug 2016 12:36:58 +0200 (CEST) IronPort-PHdr: 9a23:urbWuxJ0oxMBjz6Ej9mcpTZWNBhigK39O0sv0rFitYgUI/rxwZ3uMQTl6Ol3ixeRBMOAuqsC0bOd6vCoGTRZp83Q6DZaKN0EfiRGoP1epxYnDs+BBB+zB9/RRAt+Iv5/UkR49WqwK0lfFZW2TVTTpnqv8WxaQU2nZkJLL+j4UrTfk96wn7jrvcaCOkMS3XHkMfsydEzw9lSJ8JFOwMNLEeUY8lPxuHxGeuBblytDBGm4uFLC3Pq254Np6C9KuvgspIZqWKT+eLkkH/QDVGx1ezN92Mq+jRjOVxGCrl6dTn8fiVIcGwnI9gv3WZH/miT/v+t5niKdOJuyBbs9XDDn66ZwVDfpjj0GPng36jL5kMt12Y1Wuh7pnAB4x5bRaYeTfK5/eK3aVdwXX2YERdpWUzREC4W6KYcCWblSdd1EppXw8gNd5SC1AhOhUbvi Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=info@gerd-stolpmann.de; spf=None smtp.mailfrom=info@gerd-stolpmann.de; spf=None smtp.helo=postmaster@mout.kundenserver.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=217.72.192.74; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=217.72.192.74; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=217.72.192.74; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BgAAC0PbRXh0rASNlehBp8sUCHd4F9IIV9AoFkOBQCAQEBAQEBAQESAQEBCA0JCRkvgjIWghcBBVUYHAtGVwYBEgmILAEJvl0BAQEHAgEWDoUyhUWETIVPBYgqkRqBPwKEX4poTocZJ4VPjDmDeB6CWYFZbAGGYAEBAQ X-IPAS-Result: A0BgAAC0PbRXh0rASNlehBp8sUCHd4F9IIV9AoFkOBQCAQEBAQEBAQESAQEBCA0JCRkvgjIWghcBBVUYHAtGVwYBEgmILAEJvl0BAQEHAgEWDoUyhUWETIVPBYgqkRqBPwKEX4poTocZJ4VPjDmDeB6CWYFZbAGGYAEBAQ X-IronPort-AV: E=Sophos;i="5.28,529,1464645600"; d="asc'?scan'208";a="190208885" Received: from mout.kundenserver.de ([217.72.192.74]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Aug 2016 12:36:57 +0200 Received: from office1.lan.sumadev.de ([89.14.11.95]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0LyV78-1b4lrS0mgA-015tsH; Wed, 17 Aug 2016 12:36:56 +0200 Received: from e130 (e130.fritz.box [192.168.5.100]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 9EFB4DC05D; Wed, 17 Aug 2016 12:36:55 +0200 (CEST) Message-ID: <1471430208.14938.9.camel@gerd-stolpmann.de> From: Gerd Stolpmann To: Pierre =?ISO-8859-1?Q?M=E9tras?= , caml-list@inria.fr Date: Wed, 17 Aug 2016 12:36:48 +0200 In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-PhHoUo/AqbVS7zlCAVW8" X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 X-Provags-ID: V03:K0:9o+WnjVcnsqxWsWJIATaXufZy5GQL0Zu09MpUozxSZERjUpN3KK xqjMTJUGZmsNk15mJrp0p/4j2JsRotqdKTGhgOcgQz4Zwbti7cc9XxqvJyGwNWm/7sr63pv tJk+oYDhoKludOgOrLpJHF9TVniL07wmGUmKRNI55MFsZUXk9LWLqn1Q9LENUgV4IJYa4Rg 8BpILr5GYTt1woqkNb2fw== X-UI-Out-Filterresults: notjunk:1;V01:K0:NVTWbGlgmRw=:N/AcCJJ9XZ6KHcGy0ytndW PKjWDCNc9Y3sTYf/jldhUmj66yHi79xI3ChClogmRV6turX4yI95vkiMJoeisfO6oC+/skRpA TnKHnm8VB5MOq6ouX0cSXHygScnz3a2Q9ahGUFTL47vpvrrG4bzLh4w9EM5ldcVulDAGr0CYA 25QM1wdd8Fzk0pSw07JTzVXfjlX0/H2M46JnoqehW8pO1WaMxx/bEyc1vz7avxYwlXuyJcjOg eYknWBNy4RgMDN2xikgHuXxQnrEJAvIchgeHJ1Ls4SWTZOACHkeaGjxShKkGCGvSpCCw2jIUj mLp3AR7OBqfD91hhSmskCQioiJ9lL1pLJKTTvVWj3HOwY6wEMhxKoUVI5lkGVvL9hXGFSMbSg d2tgEthKI265EcmDfirseN3lYOE+YWonkehVLFEpfd2947vQAUmxpY7sqS3UJUpphGKkLQmRJ OxWoNRgMrIaOlmLU3M46xCNpMfOuaEmk1GAnPTItOeTJywrZeuEwg5uUdhYIwuX5LvHjA6n+C 827cSTv5JUXZ+21r/Q1unBk9FJgBl0dPfbOtpt6tulvcCLBm6n6Wzwei5BlTeRdQ+co8uR7G4 QzlIet+egJP7KkWsDgkDAAEzb9HtHPxcrRT+pdk2EUL5+53Lq1Y+upa9vY+psUzaqazUKjR45 7IypDorJAqI+q9HOslZ/1mzXl7Q5ONeBHWfSeDmlx+IuAGSPZflUSBlIpl2FuxjRJpcw= Subject: Re: [Caml-list] OCaml 4.03.0 on Minix3 fails threading tests --=-PhHoUo/AqbVS7zlCAVW8 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable When I remember correctly, the systhread implementation never worked for user-space pthread libraries like the one that comes with Minix3. That's simply because these libraries tend to be very buggy and full of unresolved race conditions. In particular, OCaml requires that pthreads and signals play well together, and this is one of those areas that are probably not correctly implementable at all in user space. Trying to fix that and find workarounds is very likely to be wasted time. It could be easier to help package authors making systhreads support an optional feature. Gerd Am Dienstag, den 16.08.2016, 23:09 -0400 schrieb Pierre M=E9tras: > Hello, >=20 > I'm trying to port an *almost* complete OCaml port on Minix3 while > learning this system at the same time, and I'm encountering a small > blocker with threads. Minix3 does not support native pre-emptive > threads. So threads code should be cooperative yielding the control > flow regularly. I've linked the OCaml binaries to the pthread library > available in /usr/pkg/lib. >=20 > When I run the testsuite, it blocks in deadlocks in a simple test > program like lib-thread/close.ml, where a reading thread is consuming > what a writing thread puts in a pipe. In fact, the reading thread > blocks on the Unix.read system call and the scheduler never gives > control back to the writing thread that should close the pipe. This > happens with systhreads only as the lightweight threads play nicely. >=20 > $ ocamlc =A0-g -vmthread -w a unix.cma threads.cma tests/lib- > threads/close.ml -o ./program > $ ./program > reading... > closing fd... > read returned >=20 > $ ocamlopt =A0-g -thread -w a unix.cmxa threads.cmxa tests/lib- > threads/close.ml -o ./program > 10.0.2.15$ ./program > reading... > ^C >=20 > How to deal with that? What would be the best option? >=20 > 1. I can try to have a minimal OCaml environment on Minix3 for the > moment and adapt the testsuite Makefiles not to run if threading is > not pre-emptive or to to skip the threading tests. One way to do that > is to have a new define HAVE_THREAD_COOPERATIVE added to OCaml > configuration. This would be useful only in rare situations like > Minix3... >=20 > 2. Because this OCaml version is linked to pthread and the system > thinks that systhreads are working, I could patch the Unix module to > make it more cooperative, adding sched_yield() calls only in the > cases of HAVE_THREAD_COOPERATIVE or __minix defines after blocking > system calls. This seems to me a bad workaround and a source of > vicious bugs... >=20 > 3. Or decide building OCaml environment without pthread on Minix > (./configure -no-pthread) but some modules that I tried to install > with opam, dependencies of utop or core I can't remember, required > systhread... >=20 > Any advice on how to have the best OCaml environment and the maximum > tests passed? >=20 > Thanks > -- > Pierre M=E9tras --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-PhHoUo/AqbVS7zlCAVW8 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 v2 iQEcBAABCAAGBQJXtD5AAAoJEAaM4b9ZLB5TPQIH/1ZrFr/PN6azEmaCPwb23f2A LMomlAFWcp/XsuqAJGJDGvnwEYRmU7pV2a+18bBSerj8G45w9FPSASCds3etVj1G A00iPlmFy5Sz6TPXDmJA25OQXgjwVfAFS4dB+ahQjTlYfNkXh/bnApMGOjQeWvY3 WrwRfQKXsGGaAbBIf8RAc7sTSW2pEBpOlrbsMDZTGv1jBr0xCfMqPQ+m/AT9aWQ9 o8Be5KAw6+0KEC/pA2YDDWIvzkDNpAZOfuD5i1IDXnh8LFCVpGQmotUbsYnCSsDa P0mBoGgNxTWrpnZ8W6t2yiDTfIg11ge8qJ3MtJML8WBr9OppIMwM3VOglfv8fuA= =kls5 -----END PGP SIGNATURE----- --=-PhHoUo/AqbVS7zlCAVW8--