From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id IAA32692 for caml-red; Thu, 30 Nov 2000 08:54:33 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA11657 for ; Wed, 29 Nov 2000 22:38:01 +0100 (MET) Received: from tor.abc.se (ns.abc.se [195.17.72.11]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id eATLc0513730 for ; Wed, 29 Nov 2000 22:38:00 +0100 (MET) Received: from gateway (dialup-7 [195.17.73.7]) by tor.abc.se (8.9.3+Sun/8.9.3) with SMTP id WAA05099; Wed, 29 Nov 2000 22:37:46 +0100 (MET) From: "Mattias Waldau" To: , "Ken Wakita" , Cc: Subject: RE: Marshaling of custom blocks and threads Date: Wed, 29 Nov 2000 22:37:42 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <00112902354700.00625@ice> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal Sender: weis@pauillac.inria.fr The easiest way to find threading bugs are to use a multiprocessor machine. Threading errors occurs a million times more often on a two-processor machine than on an ordinary. Why? Modern OS:s actually abort a thread rather seldom, and each thread is allowed to run thousands of operations until task-switch. The chance that this task-switch will occur at the wrong location is very small. /mattias -----Original Message----- From: Pierre.Weis@inria.fr [mailto:Pierre.Weis@inria.fr]On Behalf Of Gerd Stolpmann Sent: Wednesday, November 29, 2000 2:22 AM To: Ken Wakita; jserot@lasmea.univ-bpclermont.fr Cc: caml-list@inria.fr Subject: Re: Marshaling of custom blocks and threads On Tue, 28 Nov 2000, Ken Wakita wrote: >I think the Marshal module is thread unsafe because it uses a shared >buffer to produce the external image of the ML objects. In 2.04, this was definitely true (see http://caml.inria.fr/bin/caml-bugs/fixed?id=24;page=1;user=guest and http://caml.inria.fr/bin/caml-bugs/fixed?id=25page=1;user=guest). However, the bug was still subtle; the shared buffers were relatively well protected by the so-called "master lock". Until now, I thought that 3.00 fixed the bug finally; i.e. the master lock really locked the shared buffer. (I checked the code.) Jocelyn Serot reports that Marshal is not thread-safe for custom blocks. These did not exist in 2.04, so I suppose that only the new parts of the marshalling system do not work properly enough. However, multi-threading programming is error-prone, so it would be helpful to have a small program that demonstrates the bug (normally it is sufficient to repeat the errorneous piece of code often enough (e.g. 10000 times) to reproduce the incorrect behaviour). Gerd -- ---------------------------------------------------------------------------- Gerd Stolpmann Telefon: +49 6151 997705 (privat) Viktoriastr. 100 64293 Darmstadt EMail: gerd@gerd-stolpmann.de Germany ----------------------------------------------------------------------------