Thread safe malloc in Tru64?
From: Ioannis E. Venetis (iev_at_hpclab.ceid.upatras.gr)
Date: 11/20/03
- Next message: Eduardo: "snmp subagents development"
- Previous message: vincent favrille: "tru64 5.1A kit 4 plantage reseau"
- Next in thread: Jerry Feldman: "Re: Thread safe malloc in Tru64?"
- Reply: Jerry Feldman: "Re: Thread safe malloc in Tru64?"
- Reply: David Butenhof: "Re: Thread safe malloc in Tru64?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 Nov 2003 16:11:01 +0200
Hello,
I am trying to create a library that will run, among other architectures, on
Tru64/Alpha systems.
Of course, this library has a machine independant (the same for all
architectures) and a machine
dependant part. For some reasons, I chose to use the
thread_create/thread_get_state/
thread_set_state/thread_resume/thread_terminate interface in the machine
dependant part of the
library to manage kernel-level threads on Tru64 Unix systems. I am
mentioning it in case this has
something to do with the problem I will describe.
Now, the problem is that all my applications that use this library crash on
Tru64 Unix systems
(but not on other systems the library compiles on). After spending hours on
debugging and
inserting printf's on several places I found what was going wrong. The
malloc() function, when
called by all threads of the application, returns most of the time the same
starting address of the
allocated memory for different threads. This seems to be an issue with
thread-safety of the
malloc() function. I searched the Internet and found that I had to link my
applications with a few
libraries, in order to make them thread-safe. Some of the possibilities I
found are:
-lpthreads -lmach -lc_r
-lpthread -lmach -lexc -lc
I also tried other combinations
(-lpthread -lmach -lc_r, -lpthread -lmach -lc, -lpthreads -lmach -lc,...)
but none of them solved the problem. I also tried to use -D_REENTRANT and/or
-D_THREAD_SAFE when compiling the library and the applications, but the
problem still remains.
Finally, I replaced malloc() with mmap(), and the applications run perfectly
in this case, so I doubt
that something else is wrong in the library.
I would appreciate it if someone could give me some directions on how to
link my libray and applications
with thread-safe versions of all necessary libraries, both for shared and
static versions.
Some system specific information:
OS: Compaq Tru64 UNIX V5.1 (Rev. 732)
Compiler: gcc -v
Reading specs from /usr/local/lib/gcc-lib/alphaev6-dec-osf4.0e/2.95.2/specs
gcc version 2.95.2 19991024 (release)
Thank you in advance,
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: "snmp subagents development"
- Previous message: vincent favrille: "tru64 5.1A kit 4 plantage reseau"
- Next in thread: Jerry Feldman: "Re: Thread safe malloc in Tru64?"
- Reply: Jerry Feldman: "Re: Thread safe malloc in Tru64?"
- Reply: David Butenhof: "Re: Thread safe malloc in Tru64?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|