Solaris 8 threads attributes
Solaris 8 adds several new features to its already powerful set of thread APIs. Key features include:
- Alternate one-level libthread library
- Priority inheritance for user threads
- Priority ceilings for mutex locks
- Robust mutex locks
Let's have a look.
Alternate one-level threads library
Solaris implements a two-level threads architecture (see August 1998's column as well as subsequent columns covering the process model).
The two-level model is implemented by abstracting the user thread as something separate and distinct from the kernel thread and lightweight process (LWP). Hopefully, our previous discussion on bound and unbound threads clarified the distinction between the two types of threads. Experience has shown that a number of threaded applications can benefit from using bound over unbound threads. However, changing the source or recompiling the application may not be possible or practical. For such situations, the alternate libthread library was shipped with Solaris 8.
By linking a multithreaded application to the alternate library, all threads are created as bound threads. That is, every thread is created with an LWP and linked to the LWP for the thread's lifetime. The alternate thread's library is maintained in the /usr/lib/lwp directory (32-bit) and /usr/lib/lwp/64 for 64-bit programs. You can link to the alternate libthread either through a compilation flag or by setting the runtime linker's LD_LIBRARY_PATH variable.
Here's a simple compile of a thread's program using POSIX threads, followed by a run of the ldd(1) command on the resulting binary (ldd(1) lists the dependencies of dynamically-linked objects).
sunsys> cc -o ptdemo ptdemo.c -lpthread
sunsys> ldd ptdemo
libpthread.so.1 => /usr/lib/libpthread.so.1
libthread.so.1 => /usr/lib/libthread.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1
As you can see from the ldd(1) output, libpthread.so.1 and libthread.so.1 are resolved from the /usr/lib directory. Note that the sample program, ptdemo, uses POSIX threads and doesn't have a direct dependency on libthread.so.1. The dependency on libthread.so.1 is in libpthread.so.1, the POSIX threads library. That is an important point in understanding the procedure for linking to the alternate thread's library for programs that use POSIX threads.
Now we recompile, using the -R flag, which specifies a path for the runtime linker to search.
sunsys> cc -o ptdemo ptdemo.c -lpthread -lthread -R/usr/lib/lwp
sunsys> ldd ptdemo
libpthread.so.1 => /usr/lib/libpthread.so.1
libthread.so.1 => /usr/lib/lwp/libthread.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1
sunsys> Symantec Backup Exec 12 and Backup Exec System Recovery 8 deliver industry leading Windows data protection and system recovery. Download this whitepaper to find out the top reasons to upgrade and how to get continuous data protection and complete system recovery.
Data and system loss — from a hard drive failure, malicious attack, natural disaster, or simple human error — can happen anytime. Don’t leave your business vulnerable. Make sure you have a secure recovery strategy in place. Symantec's latest backup and system recovery technology can efficiently restore critical applications, individual emails and documents and even restore your entire system in minutes in the event of a loss.
Businesses face a growing challenge to ensure that the IT environment is properly protected. Backup Exec 12 integrates with other applications in the Symantec family of products, to complement your current data protection strategy, keep your data securely backed up and make it recoverable when you need it most.







