## Overview of Sample Threads Program

The sample program is called thradd. The thradd program is a multithreaded XDS application that adds entries to a GDS directory. Each thread performs a ds_add_entry( ) call. The information for each entry to be added is read from an input file.

The thradd program can also be used to reset the directory to its original state. This is achieved by invoking thradd with a -d command-line argument. In this case, thradd uses the same input file and calls ds_remove_entry( ) for each entry. The ds_remove_entry( ) calls are also done in separate threads.

To keep the program short and clear, it works with a fixed tree for the upper nodes (/C=it/O=sni/OU=ap), to which the entries described in the input file are added. This fixed upper tree is added to the directory by thradd. The input file contains the common name, the surname, and the phone number of each Organizational-Person entry to be added.

For simplicity, only pthread_join( ) is used for synchronization purposes; mutexes are not used.

The thradd program could be enhanced to satisfy the following scenarios:

· As a server program for interactive directory actions from different users. The thradd program simulates a server program which gets requests from different users to add entries to a directory. In the case of thradd, the users' interactive input is simulated through the entries in the input file. Each line of input represents a different directory entry, and thradd uses a separate thread for each line.

· Initialization of the directory with data from file. The thradd program could be enhanced to read generic attribute information for a variety of directory object classes from a file, and to add the corresponding entries to the directory.

More:

User Interface

Input File Format

Program Output

Prerequisites

###