[M3devel] the need for cooperative suspend

mika at async.caltech.edu mika at async.caltech.edu
Sat Jun 6 18:50:23 CEST 2015


Can the thread tester survive with the most paranoid options on OS X?
I don't believe it until I've seen it (based on what we went through for
Linux, I would say I'm just being prudent).

Run it with:

"-iters 100000 -n 20 -tests ALL"

I remember the thread tester died on FreeBSD last time I tried, and
there have been no relevant checkins since that I know of.

Here's what happens when I run it on my FreeBSD.  CM3 is not up to date,
in case someone fixed something I'm not aware of, so don't draw too
many conclusions until someone has tried it on a fresh install:

..........laziest thread is 1433608799/9/1 (tests: read 10/6/6 nxread 26/6/4 tryexcept 67/53/38 fork 1433608799/2/2 forktoomuch 1433608799/9/3 alloc 1433608799/37/1 creat 10/7/7 lock 1433608799/68/38)


***
*** runtime error:
***    Segmentation violation - possible attempt to dereference NIL
***    pc = 0x4387e8 = Move + 0x6a in ../src/runtime/common/RTCollector.m3
***

Abort
(79)pluto:/tmp>

Anyone who's interested in trying their own favorite Modula-3 installation,
this is easy to do:

cm3/m3-libs/m3core/tests/thread/AMD64_FREEBSD/threadtest -iters 100000 -n 20 -tests ALL

Ignore the warnings about "thread being starved or deadlocked".  Those should really
be an option and not on by default: as far as I know the threading library makes no
claim of fairness, so I don't think one should expect it by default.

     Mika

Antony Hosking writes:
>OS X is stable as well as Linux, as far as I know.
>Mika, what misbehaviors are you seeing?
>
>Sent from my iPad
>
>> On May 2, 2015, at 11:57 AM, mika at async.caltech.edu wrote:
>>=20
>> Jay,=20
>>=20
>> Can you explain precisely what you mean by "suspend"?
>>=20
>> A thread is suspended by ... a timer expiration?  Another thread at higher=
> priority needing resources?
>>=20
>> I'm thinking about a tight loop "for(;;) ;"... how do you stop a thread fr=
>om running that (it could have
>> been coded in assembly...)?
>>=20
>> Jay K writes:
>>> --_6bc62225-3263-437a-a88c-4b1ff9473d58_
>>> Content-Type: text/plain; charset=3D"iso-8859-1"
>>> Content-Transfer-Encoding: quoted-printable
>>>=20
>>> We really need to move away from preemptive suspend.
>>>=20
>>> 1) It is a large fraction of the target-dependent code in m3core.
>>> =3D20
>>>=20
>>> 2) It doesn't really work in "wow64"=3D2C the x86-on-amd64 Windows system=
>.
>>> The SuspendThread + GetThreadContext does not actually reliably give you
>>> current and coherent context.
>>> I'm not sure about x86-on-ia64.
>>> =3D20
>>>=20
>>> The context can be old.
>>> The context can be mid-update. Which might be ok=3D2C depending on what t=
>he =3D
>>> updates are.
>>> LIke if Eip and Esp are being updated=3D2C we don't care about Eip anyway=
>.
>>> =3D20
>>>=20
>>> You can find out if either is the case=3D2C and let the thread run longer=
>=3D2C
>>> but being in a long running syscall I believe is reported as possibly
>>> invalid even though it is valid.
>>> =3D20
>>> =3D20
>>> NT/native is ok.
>>> =3D20
>>>=20
>>> We should just use cooperative suspend and not worry about it.
>>> =3D20
>>> =3D20
>>> Thanks=3D2C
>>> - Jay
>>>=20
>>>=20
>>> =3D20
>>>                         =3D
>>>=20
>>> --_6bc62225-3263-437a-a88c-4b1ff9473d58_
>>> Content-Type: text/html; charset=3D"iso-8859-1"
>>> Content-Transfer-Encoding: quoted-printable
>>>=20
>>> <html>
>>> <head>
>>> <style><!--
>>> .hmmessage P
>>> {
>>> margin:0px=3D3B
>>> padding:0px
>>> }
>>> body.hmmessage
>>> {
>>> font-size: 12pt=3D3B
>>> font-family:Calibri
>>> }
>>> --></style></head>
>>> <body class=3D3D'hmmessage'><div dir=3D3D'ltr'>We really need to move awa=
>y from=3D
>>> preemptive suspend.<BR><br>1) It is a large fraction of the target-depend=
>e=3D
>>> nt code in m3core.<BR>&nbsp=3D3B<BR><br>2) It doesn't really work in "wow=
>64"=3D
>>> =3D2C the x86-on-amd64 Windows system.<BR>The SuspendThread + GetThreadCo=
>ntex=3D
>>> t does not actually reliably give you<br>current and coherent context.<BR=
>>I=3D
>>> 'm not sure about x86-on-ia64.<BR>&nbsp=3D3B<BR><br>&nbsp=3D3BThe context=
> can b=3D
>>> e old.<br>&nbsp=3D3BThe context can be mid-update. Which might be ok=3D2C=
> depen=3D
>>> ding on what the updates are.<br>&nbsp=3D3BLIke if Eip and Esp are being u=
>pda=3D
>>> ted=3D2C we don't care about Eip anyway.<BR>&nbsp=3D3B<BR><br>You can fin=
>d out =3D
>>> if either is the case=3D2C and let the thread run longer=3D2C<br>but bein=
>g in a=3D
>>> long running syscall I believe is reported as possibly<br>invalid even th=
>o=3D
>>> ugh it is valid.<BR>&nbsp=3D3B<BR>&nbsp=3D3B<BR>NT/native is ok.<BR>&nbsp=
>=3D3B<BR=3D
>>>> <br>We should just use cooperative suspend and not worry about it.<BR>&n=
>bs=3D
>>> p=3D3B<BR>&nbsp=3D3B<BR>Thanks=3D2C<br>&nbsp=3D3B- Jay<br><br><br>&nbsp=3D=
>3B<BR>             =3D
>>>            </div></body>
>>> </html>=3D
>>>=20
>>> --_6bc62225-3263-437a-a88c-4b1ff9473d58_--



More information about the M3devel mailing list