Re: Thread safe malloc in Tru64?

From: Ioannis E. Venetis (iev_at_hpclab.ceid.upatras.gr)
Date: 11/25/03

  • Next message: Eduardo Lopez: "software development kit for compaq...."
    Date: Tue, 25 Nov 2003 18:16:14 +0200
    
    

    First of all, thank you for your very detailed answer.

    It seems that my choice to use the Mach interface on the Tru64 Unix
    system was unfortunate. Anyway, it is quite trivial to change the machine
    dependant part of the library to use POSIX threads for this architecture
    and I will do it. But there still remains a very important problem, at least
    for me :-)

    This library is also to be run on a simulator. The simulator is based on
    an Alpha processor and it has some extensions to support Simultaneous
    Multithreading (SMT). It executes static binaries created on Tru64
    Unix systems and it explicitly does NOT support POSIX Threads.
    Instead, the machine dependant part of the library HAS to use the
    primitives of the simulator to start and manage hardware threads, if
    parallel applications are to be run on the simulator (there is no OS, so
    hardware threads can be thought of as equivalent entities
    to kernel threads when an OS is present). The problem of course is
    that malloc() returns the same addresses for allocated regions when
    executed concurrently on more hardware threads, since the linked in
    C library is not thread safe. Moreover, the simulator does not provide
    mmap() (which would perhaps help me overcome the problem, as on
    the real Tru64 system). This means that I still need to find another way
    to link thread safe versions of libraries with my applications, in order to
    successfully run these applications on the simulator. It seems that it will
    not be possible for me to avoid some kind of hacks, at least to make
    the library run on the simulator.

    The very easy solution to use a lock around each malloc() in the
    library did not help. Of course I did not use POSIX primitives
    for the locks, but hand-written assembly code (which runs correctly,
    both on the Tru64 system and the simulator).

    Any other suggestion on this issue is greatly appreciated.

    Ioannis E. Venetis
    PhD Student - Research Assistant
    High Performance Information Systems Laboratory
    Computer Engineering and Informatics Department
    University of Patras, Greece
    URL: http://www.hpclab.ceid.upatras.gr/pgroup/members/iev


  • Next message: Eduardo Lopez: "software development kit for compaq...."