Solaris 2.6: 'Async safe' implies 'thread safe' ?

Solaris 2.6: 'Async safe' implies 'thread safe' ?

Post by ADF Herman » Wed, 23 May 2001 20:24:14



Hi

I'm currently involved in multithreaded development tasks on
Solaris 2.6 and trying to make sense of the MT attributes for
system/library calls.

Especially, I'm wondering wether 'time' can be called safely
in a multithreaded app.

On the manpage of 'time' I read
   ____________________________________
  | ATTRIBUTE TYPE|   ATTRIBUTE VALUE |
  |_______________|___________________|
  | MT-Level      |  Async-Signal-Safe|
  |_______________|___________________|

and for async-safety attributes(5) tells me

  Async-Signal-Safe refers to  particular  library
  routines that can be safely called from a signal
  handler.  A thread that is executing  an  Async-
  Signal-Safe   routine  will  not  deadlock  with
  itself if interrupted by a signal.  Signals  are
  only a problem for MT-Safe routines that acquire
  locks.

  Signals are disabled when locks are acquired  in
  Async-Signal-Safe  routines.   This  prevents  a
  signal handler that might acquire the same  lock
  from being called.

Now, this description tells me that a thread calling
'time' won't deadlock in the call when interrupted
and that signals are disabled in 'time' whenever it
acquires locks.

It doesn't tell me wether any data can be corrupted
on reentering the call (i.e. is it 'Safe' ?) or wether
concurrency is provided (i.e. is it 'MT-Safe' ?).

Can anybody shed some light on this topic ?

Thanks a lot
Gunther

 
 
 

1. Difference Between 'Safe' And 'MT-Safe' ML-Level

MT-Level: Libraries are classified into four categories which define their
ability to support multiple threads. Manual pages containing routines that
are of multiple or differing levels show this within their NOTES or USAGE
section.
( See attributes(5) )

I do not understand the difference between Safe and MT-Safe.

Safe: ...Often overlooked is the fact that the result of this Safe interface
or safe code segment can have global consequences that affect all threads.

MT-Safe: Note that a library can be safe to use, but not MT-Safe. For
example, surrounding an entire library with a monitor makes the library
Safe, but it supports no concurrency so it is not considered MT-Safe. An
MT-Safe library must permit a reasonable amount of concurrency. (This
definition's purpose is to give precision to what is meant when a library is
described as Safe. The definition of a Safe library does not specify if the
library supports concurrency. The MT-Safe definition makes it clear that the
library is Safe, and supports some concurrency. This clarifies the Safe
definition, which can mean anything from being single threaded to being any
degree of multithreaded.)
--

     Key fingerprint = EB65 70AA 55C0 33AA 2E5A  5B59 42E9 9326 B16C F7F3
PGP Public Key Server: http://www.keyserver.net

Chiou, Zi-Wei
Computer Graphics and Geometry Modeling Laboratory,
Computer Science and Information Engineering Department,
National Chiao-Tong University, Taiwan

<url:http://www.csie.nctu.edu.tw/~jwchiu>
ICQ Number: 86384491

InterVideo, Inc.

TEL: +886-3-5750828 ext.125
FAX: +886-3-5750829
Address: 13F-1, No.6, Lane 99, Rd. Puding, Hsinchu City, Taiwan.

2. 3 button mouse?

3. Solaris 8 threads: If a routine is Async-Signal-Safe is it also thread Safe?

4. oshadow has disappeared

5. 'malloc' and 'free' is MT-safe in linux ?

6. Running X with 4 MB Ram under Linux

7. Is 'select' thread safe?

8. Port Forwarding with IP tables.

9. anonymous ftp won't 'ls' in Solaris 2.6

10. NTFS R/W safe with mount 'ro' ?

11. Where is 'strip' safe to use?

12. : 'man'- error : No manual entry for safe.n

13. safe to use 'make -jXX buildworld'?