Since data resources are owned by a process, rather than by threads within the process, multiple threads may have addressability to the same static data storage areas, and potential problems arise with regard to serialization of data access and maintenance of data integrity. Similarly when multiple processes have access to a shared memory object, it is the responsibility of the application to ensure the integrity of shared resources; neither OS/2 nor Presentation Manager provide any automatic methods of avoiding such problems. However, mechanisms are provided whereby the application developer may prevent problems from occurring. Some suggested techniques for private data are as follows:
Static allocation of such data areas is permissible where the accessing routines reside and execute solely under the control of a single application. However, where such routines are placed in a library and accessed by multiple applications, the potential for data corruption through application error increases significantly, and dynamic data allocation prior to invoking a secondary thread or passing a request to another process should be considered to ensure the integrity of data areas.
Note that the above techniques apply to data shared between threads within a process; OS/2 provides a variety of mechanisms for dealing with data and memory areas that are shared between processes. These techniques are described in the IBM OS/2 Version 2.0 Control Program Reference.