[M3devel] Downsides of Modula-3 ?
Mika Nystrom
mika at async.caltech.edu
Fri Apr 27 19:49:48 CEST 2012
=?utf-8?Q?Dragi=C5=A1a_Duri=C4=87?= writes:
>I do not doubt they are created. Probably not an issue with 3 threads =
>here, 3 threads there, but it can be if one relies on "must be created =
>after some arbitrary time" in any synchronization. I did, and SRC people =
>did, at least in two places. I just don't see it as a good practice.
Yes I have had that bug in my programs a few times.
But to be really fair it's not that you're assuming that another
thread is created by a certain time but you're assuming that it has
done something by the time the first thread needs to do something else.
In the examples of the sort you describe it is usually that the newly
created thread has "had time to initialize" (in some way). My bug with
this was of this nature:
thread A:
... Thread.Fork(b)... wait... LOCK(b.mu)
Thread B:
... self.mu := NEW(MUTEX) ...
Oops! works on some threading implementations (user threads).
Instant segfault on others!
Have fun with the thread tester. It doesn't find any problems with
user threads.
I should probably have dug into the pthreads myself long ago but it's
always so far down the todo list, and all my CM3 installations use user
threads by necessity. If you can improve the pthreads I think it would
make me much happier about CM3 in general. I still use PM3 as much as
possible...
Mika
>
>BTW, your test is excellent stress machine. My laptops hate it, =
>probably, till now :). Right now I am focused on an allocation race =
>issue and I hope to fix it in few hours/a day.
>
>On Apr 27, 2012, at 7:13 PM, Mika Nystrom wrote:
>
>> =3D?utf-8?Q?Dragi=3DC5=3DA1a_Duri=3DC4=3D87?=3D writes:
>> ...
>>> I am reading your source code just now. And one thing caught my eye: =
>=3D
>>> "Each type of thread starts by sleeping for a while, to give the =
>other =3D
>>> threads a chance to be created." Does not look like any guarantee to =
>me, =3D
>>> not in threaded application.=3D20=3D
>>=20
>> If the program prints "running" then all threads have been created.
>>=20
>> It eventually prints "running".
>>=20
>> Therefore all threads are created.
>>=20
>> ---
>>=20
>> The things wrong with CM3's pthreads threading are NOT subtle.
>> The runtime completely freezes up, ctrl-C stops working, and other
>> such things.
>>=20
>> Mika
More information about the M3devel
mailing list