From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,e0cdd9a132483603 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-11-25 08:16:20 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!irazu.switch.ch!switch.ch!news.grnet.gr!news.ntua.gr!not-for-mail From: "Ioannis E. Venetis" Newsgroups: comp.unix.tru64 Subject: Re: Thread safe malloc in Tru64? Date: Tue, 25 Nov 2003 18:16:14 +0200 Organization: National Technical University of Athens, Greece Message-ID: References: <3fbe10c5@usenet01.boi.hp.com> NNTP-Posting-Host: patroclos.hpclab.ceid.upatras.gr X-Trace: ulysses.noc.ntua.gr 1069776979 30722 150.140.142.225 (25 Nov 2003 16:16:19 GMT) X-Complaints-To: usenet@ulysses.noc.ntua.gr NNTP-Posting-Date: Tue, 25 Nov 2003 16:16:19 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Xref: archiver1.google.com comp.unix.tru64:10967 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