[M3devel] Thread testing program

Jay K jay.krell at cornell.edu
Tue Jan 11 22:53:48 CET 2011


>Did you stress test any older versions of M3?

 
I recently tried to do anything with some older releases and didn't get far.
 
 
The "most recent older" releases are somewhat lost (i.e. broken links on elegosoft due to crashed machine/disk; probably people should scrounge around and we might restore some of them, if they work much).
 
 
Yet older releases largely don't work.
  Older cminstalls are statically linked (even to libc) and have invalid syscalls in them, and don't get anywhere.
  Older m3core doesn't build, and if you skip that, well, cm3 output doesn't work. I forget what the symptons were.
 
 
I'm sure they worked on the OS'es of the day, but they were much to version-unportable imho.
Granted, the level of incompatibilities in the newer versions of underlying systems is also quite surprising. Free/Open Unix systems don't seem to take binary compatibility seriously.
 
 
 
 - Jay


----------------------------------------
> To: hosking at cs.purdue.edu
> Date: Tue, 11 Jan 2011 13:09:28 -0800
> From: mika at async.caltech.edu
> CC: jkrell at elego.de; m3devel at elegosoft.com
> Subject: Re: [M3devel] Thread testing program
>
>
> AMD64_FREEBSD of some time ago (about a year) also doesn't seem to
> make any progress. But no, I haven't gone through any old versions
> systematically. The old PM3 is what I use in "production" systems,
> and it works... but unfortunately my next "production" system is slated
> to be a new Debian system.
>
> Mika
>
> Tony Hosking writes:
> >Did you stress test any older versions of M3?
> >I believe we have had a number of regressions lately.
> >
> >On Jan 11, 2011, at 5:29 AM, Mika Nystrom wrote:
> >
> >>
> >> Hello everyone,
> >>
> >> After studying failure modes and implementation of the current
> >> threading implementation in CM3, I've developed a little stress-testing
> >> program, attached. Currently it crashes in various ways.
> >>
> >> It takes one command-line argument, the approximate number of threads
> >> to create (e.g., 100). It creates threads of three types:
> >> reader (reads a file), forker (forks a process), allocator (allocates
> >> memory that constantly goes out of scope).
> >>
> >> Files attached below. Happy 1/11/11.
> >>
> >> Mika
> >>
> >> My m3makefile:
> >>
> >> import ("libm3")
> >>
> >> implementation ("Main")
> >>
> >> program ("threadtest")
> >>
> >> My m3overrides (optional):
> >>
> >> if defined("CM3_VERSION")
> >> /* Critical Mass Modula-3 */
> >> % see http://www.elegosoft.com/cm3/doc/help/cm3/cm3.html
> >>
> >> % not sure about this:
> >> build_standalone()
> >>
> >> m3_optimize("")
> >> end
> >>
> >> My Main.m3:
> >>
> >>
> >> (* $Id: Main.m3,v 1.1 2011/01/11 10:06:21 mika Exp $ *)
> >>
> >> MODULE Main;
> >>
> >> (* threading stress-test *)
> >>
> >> IMPORT Params, Scan, Thread, Rd, FileRd, Wr, FileWr, Process;
> >>
> >> VAR n := Scan.Int(Params.Get(1));
> >>
> >> PROCEDURE MakeReaderThread() =
> >> BEGIN
> >> EVAL Thread.Fork(NEW(Thread.Closure, apply := RApply))
> >> END MakeReaderThread;
> >>
> >> PROCEDURE MakeForkerThread() =
> >> BEGIN
> >> EVAL Thread.Fork(NEW(Thread.Closure, apply := FApply))
> >> END MakeForkerThread;
> >>
> >> PROCEDURE MakeAllocatorThread() =
> >> BEGIN
> >> EVAL Thread.Fork(NEW(Thread.Closure, apply := AApply))
> >> END MakeAllocatorThread;
> >>
> >> (**********************************************************************)
> >>
> >> PROCEDURE RApply(cl : Thread.Closure) : REFANY =
> >> BEGIN
> >> LOOP
> >> WITH rd = FileRd.Open(Filename) DO
> >> TRY
> >> LOOP
> >> VAR c := Rd.GetChar(rd); BEGIN END
> >> END
> >> EXCEPT
> >> Rd.EndOfFile => Rd.Close(rd)
> >> END
> >> END
> >> END
> >> END RApply;
> >>
> >> PROCEDURE FApply(cl : Thread.Closure) : REFANY =
> >> BEGIN
> >> LOOP
> >> WITH proc = Process.Create("sleep",
> >> ARRAY OF TEXT { "1" }) DO
> >> EVAL Process.Wait(proc)
> >> END
> >> END
> >> END FApply;
> >>
> >> PROCEDURE AApply(cl : Thread.Closure) : REFANY =
> >> BEGIN
> > LOOP
> >> VAR
> >> arr := NEW(REF ARRAY OF INTEGER, 1025);
> >> BEGIN
> >> FOR i := FIRST(arr^)+1 TO LAST(arr^) DO
> >> arr[i] := arr[i] - arr[i-1]
> >> END
> >> END
> >> END
> >> END AApply;
> >>
> >>
> >> CONST Filename = "hohum";
> >>
> >> PROCEDURE WriteAFile() =
> >> BEGIN
> >> WITH wr = FileWr.Open(Filename) DO
> >> FOR i := 1 TO 256 DO
> >> FOR j := 1 TO i DO
> >> Wr.PutChar(wr, VAL(ORD('A') + i MOD 25, CHAR))
> >> END;
> >> Wr.PutChar(wr, '\n')
> >> END
> >> END
> >> END WriteAFile;
> >>
> >> BEGIN
> >> WriteAFile();
> >> FOR i := 1 TO n DIV 3 DO
> >> MakeReaderThread()
> >> END;
> >> FOR i := 1 TO n DIV 3 DO
> >> MakeForkerThread()
> >> END;
> >> FOR i := 1 TO n DIV 3 DO
> >> MakeAllocatorThread()
> >> END;
> >>
> >> LOOP
> >> Thread.Pause(1.0d0)
> >> END
> >> END Main.
> >> 		 	   		  


More information about the M3devel mailing list