Problems with a multi-threaded program

From: Arjen Markus (arjen.markus_at_wldelft.nl)
Date: 11/18/04


Date: Thu, 18 Nov 2004 10:09:22 +0100

Hello all,

I have severe trouble making an as yet simple multi-threaded program
to work reliably.

The program does the following:
- It starts four threads
- Though ultimately they will have to work together, right now,
  they simply run through a few loops, allocating and deallocating
  local data, getting a random number and calling a sleep function
  (to make sure the threads run simultaneously)
- No global or saved data are used

I have three (four) different platforms at my disposal:

- Sun/Solaris, using an old version of the Sun f90 compiler.
  With the option -mt, the program runs smoothly and "correctly"
  all the time (at least I have not seen any strange problems
  after adding -mt to the compile and link statements)

- RH 7.2 and RH Enterprise Edition, both with Intel Fortran 8.0.
  I use the option -reentrancy threaded (otherwise the program
  immediately aborts because of recursive I/O).
  This version works most of the time, but sometimes a thread
  crashes, often in an internal write or a deallocate statement.

- Windows XP with Compaq Visual Fortran 6.6C.
  I use a Windows version of the pthreads library that works
  well in other contexts.
  In this case, the program is very persistent in crashing,
  even though I use the multithreaded runtim libraries.
  Moreover the random numbers that I get have a tendency to
  converge to 1.0

This all leads me to be very wary of multithreading.

Does anyone have suggestions to improve the reliability of
my program? (I could post the source code, but it is some
400 lines of code).

Regards,

Arjen



Relevant Pages

  • Re: Problems with a multi-threaded program
    ... | I have severe trouble making an as yet simple multi-threaded program ... | - Windows XP with Compaq Visual Fortran 6.6C. ... | even though I use the multithreaded runtim libraries. ...
    (comp.lang.fortran)
  • Re: Programmers unpaid overtime.
    ... So now you claim your C source code is deliberately obfuscated? ... > As I do hope you are aware, a Turing machine can run Windows 2000 as ... > quintuples, the Turing machine is given enough time and the privilege, ... I didn't show you a four-line struct. ...
    (comp.programming)
  • Re: Video editing in Linux?
    ... whatever you would want, i would have to first get linux installed, ... It is totally viable that you could modify the source code out there ... in the same way that Windows security gets ... i doubt your cpu even hits 10% of its potential ...
    (alt.linux)
  • Re: whats a callback?
    ... That's because you get all the source code and about 3000 other ... > for instance PocketPC Windows doesn't take up that much space either. ... What about the fact that Excel ... will be available after the install of the next MS Office Service Pack. ...
    (sci.electronics.design)
  • Re: Is DNSSEC supported by Windows?
    ... The fact is that my Windows XP ... computers in such a mess because they were angry at APS for firing them from ... is external because it is based on the NT source code. ... Second Edition but hopefully Microsoft can fix it well. ...
    (microsoft.public.security)