[M3devel] problem using -DPTHREAD

Daniel Alejandro Benavides D. dabenavidesd at yahoo.es
Thu Feb 1 21:34:23 CET 2007


Hi:

Some things besides what found with mentor:

danielb at sl11:~$ mentor @M3stackdump


***
*** runtime error:
***    Thread client error: attempt to release an unlocked mutex
***    file "ThreadPThread.m3", line 168
***

------------------ EXCEPTION HANDLER STACK ---------------------
0xa22bab80 LOCK  mutex = 0xb241b164
0xa22babd0 LOCK  mutex = 0xb2416c78
0xa22bac30 LOCK  mutex = 0xb2416d54
0xa22bac80 LOCK  mutex = 0xb2416cd8
0xa22bacd0 LOCK  mutex = 0xb2410378
0xa22bad20 LOCK  mutex = 0xb23fa104
0xa22bad70 LOCK  mutex = 0xb23fa370
0xa22badc0 LOCK  mutex = 0xb23fa1f4
0xa22bae20 LOCK  mutex = 0xb23fa288
0xa22bae58 RAISES {}
0xa22bb170 TRY-EXCEPT  {0x718ac4e9}
0xa22bb250 TRY-EXCEPT  {0x718ac4e9}
----------------------------------------------------------------
Cancelado
danielb at sl11:~$
   
I didn't debugged mentor, but I tried another program, cvsup, 
and with GUI problems after a seconds the process finishes
but no advise of runtime error, however with no-gui It simply works well. 

Also Im trying the examples of the parallel chapter of the book
"Programming in Modula-3" by Laszlo Boszormenyi & Carsten Weich,  
with the NThreads example (which you can download on the url
http://web.archive.org/web/19970814162826/www.ifi.uni-klu.ac.at/Modula-3/m3book/examples.html )
You will need the m3local library shipped and a m3makefile like this below:
import ("m3local")
implementation("NThreads")
program("NThreads")
 
I get this on the console with the Pthread version:
the program will call Nl new line after a 10 is printed.
  9 10
  4  7  8  1  2  3  5  6  9 10
  4 10
  4  7  9  1  2  3  5  6  5  6  8  9 10
  1  2  3  4  7  3  4  5  6  8  6  8  9  3  4  5  7 10
  1 10
  1  2  3  4  5  6  7  8  9  7  8  9 10
  1  2  1  2  3  7  8  9 10
  4  5  4  5  6  7  8  9 10
  1  2  3  1  2  3  4  5  6  5  6  7  1  2  3  4  8  9 10
  5  6  7  1  2  3  4  3  4  8  1  2  5  6  7  9 10
  3  4  8  4  8  1  3  5  6  7  9 10
  9 10
  2  3  4  5  6  7  8  1  7  8  9 10
  2 10
  2  3  7  8  9  1  4  5  6 10
  2  3  7  8  9  1  9  1  4  7  8 10
  2  3  5  6  9  1  4  1  4  7  9 10
  2  3  5  6  5  6  8  9 10
  1  2  3  4  7  3  4  5  6  8  6  8  9  3  4  5  7 10
  1 10
  1  2  3  4  5  6  7  8  9  7  8  9 10
  1  2  1  2  3  7  8  9 10
  4  5  6  1  2  3  7  8  9 10
  9 10
  4  7  8  1  2  3  5  6  9 10
  4 10
  4  7  9  1  2  3  5  6  5  6  8  9 10
  1  2  3  4  7  3  4  5  6  8  6  8  9  3  4  5  7 10
  1 10
  1  2  3  4  5  6  7  8  9  7  8  9 10
  1  2  1  2  3  7  8  9 10
  4  5  6  1  2  3  7  8  9 10
  9 10 

But with the POSIX implementation, this is a extract of the out:
It ends according to the example until Return is pressed.

9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
  9  8  7  6  5  4  3  2  1 10
Certainly, and according to the book, the first one is more expectable.
I would like to know your opinions about this issue.
Besides with import("libsio") in place of import ("m3local") on the m3makefile
you get the numbers in a  distribution similar to the above but the number of digits 
in each line is more uniform (ten by line) on the pthread version this time.

Besides I know the Upthread.i3 interface on 
m3-libs/m3core/src/unix/linux-libc6 has a the procedure

PROCEDURE attr_setschedparam (VAR attr: pthread_attr_t;
                              READONLY param: struct_sched_param): int; 
that could be useful to change the scheduling policy, but certainly 
I didn't find with grep in all the cm3 distro where it is used.
The Round Robin policy according to the documentation
of pthreads, is only available on process running with superuser privileges.
 
Thanks,
Daniel Benavides

> Tony Hosking hosking at cs.purdue.edu wrote: 
> 
> A stack trace would be useful.  Perhaps you can run again with  
> @M3stackdump specified on the command line.  Alternatively, if you  
> run inside gdb you can show the stack dump at the point of the 
> error  
> by setting a breakpoint at line 168 in ThreadPThread.m3.
> 
> I notice that you are using priority scheduling -- not sure what 
> that  
> will do to things.  Can you try it with round robin scheduling?
> 
> On Jan 31, 2007, at 12:05 PM, Daniel Alejandro Benavides D. wrote:
> 
> > Hello:
> >
> > I have compiled the cm3 cvs updated with the Pthread support 
> under  
> > kubuntu 6.06 Linux. I have done this adding the value "PTHREAD" 
> on  
> > the array SYSTEM_LIBORDER
> >
> > SYSTEM_LIBORDER = [ "OPENGL", "DECPEX", "MOTIF", "X11", "TCP", 
> "ODBC",>                     "POSTGRES95", "FLEX-BISON", "LEX-
> YACC", "LIBC",  
> > "PTHREAD" ]
> >
> > and   the variable "PTHREAD"    : [ "-L/usr/lib", "-lpthread" ],
> > on the array SYSTEM_LIBS
> >
> > But when running a mentor animation I get this runtime error  
> > consistently about a seconds later after began an animation, then 
> 
> > this is the out:
> >
> > root at sl11:/home/danielb/cm3-5.4-Rc2/cm3/scripts# mentor showthread
> >
> >
> > ***
> > *** runtime error:
> > ***    Thread client error: attempt to release an unlocked mutex
> > ***    file "ThreadPThread.m3", line 168
> > ***
> >
> > Cancelado
> > root at sl11:/home/danielb/cm3-5.4-Rc2/cm3/scripts#
> >
> > This system has
> > "POSIX version set to 200112,
> > including support for priority scheduling"
> >
> > Thanks,
> > Daniel Benavides
> >
>

 		
---------------------------------

LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20070201/61eebc09/attachment-0001.html>


More information about the M3devel mailing list