Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Marshaling of custom blocks and threads
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Mattias Waldau <mattias.waldau@a...>
Subject: RE: Marshaling of custom blocks and threads
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.


-----Original Message-----
From: []On Behalf Of
Gerd Stolpmann
Sent: Wednesday, November 29, 2000 2:22 AM
To: Ken Wakita;
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
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
demonstrates the bug (normally it is sufficient to repeat the errorneous
of code often enough (e.g. 10000 times) to reproduce the incorrect

Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 100
64293 Darmstadt     EMail: