# @(#)24 1.4 src/gos/2d/SMTEXT/README.SMT, x11r5smt, gos720 9/30/97 14:17:38 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # gos720 src/gos/2d/SMTEXT/README.SMT 1.4 # # # # OBJECT CODE ONLY SOURCE MATERIALS # # COPYRIGHT International Business Machines Corp. 1990,1997 # All Rights Reserved # # The source code for this program is not published or otherwise # divested of its trade secrets, irrespective of what has been # deposited with the U.S. Copyright Office. # # IBM_PROLOG_END_TAG # # COMPONENT_NAME: x11r5smt # # FUNCTIONS: README # # ORIGINS: 27 # # (C) COPYRIGHT International Business Machines Corp. 1990 # All Rights Reserved # Licensed Materials - Property of IBM # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # Shared Memory Transport (SMT) : The purpose of this file is to give a brief introduction to the Shared Memory Transport mechanism of transporting protocol packets to/from Xlib and the X Server. This file contains information about transport mechanisms in general, goals of the SMT design, usage of SMT, and differences between SMT and other shared memory mechanisms. A. Introduction to Transport Methods Communication from Xlib to the X server is handled in one of three ways: (1) Unix domain sockets (2) TCP domain sockets (3) Shared Memory Sockets Unix domain sockets is a mechanism that has been inherited from the MIT as the default transport mechanism. TCP sockets are used on the RISC System/6000 when the application (client) being run is on a remote machine. Shared Memory Sockets are a newly developed mechanism that was designed specifically for X server performance gains. The Shared Memory Sockets mechanism was developed to increase performance of the transfer of data from the client application (through Xlib) to the X server. The standard communication mechanism for local X clients is UNIX domain sockets. This design provides a set of services to facilitate the use of shared memory as a protocol transport mechanism for local clients. B. Goals of the Shared Memory Transport Design Eliminate Unnecessary Data Movement When UNIX domain sockets are used for communication, the data must be copied twice to move it between processes. It is copied into the kernel on "sends" and out of the kernel on "receives". By using a shared memory segment for the data, both the client and server processes can access the same data and at least one (possibly two) copies can be avoided. This can significantly improve performance when applications are in a mode of sending large packets of data to the X server for rendering. C. Using Shared Memory Transport (SMT) The X server uses SMT by default. Its use is invisible to the user (except for performance differences). The user can, however, make use of two environment variables that can change the way the transport layer works. These environment variables are: "DISPLAY" and "X_SHM_SIZE". The DISPLAY environment variable DISPLAY is an existing environment variable. It is commonly manipulated by X aficionados. This variable is used to specify the connection to a specific X server. It can specify any number of either a local or remote X servers. By default DISPLAY is set to ":disp.scr". This convention specifies that the user would like to connect to the X server specified by "disp.scr" and use the fastest available transport method (in our case, SMT). If the DISPLAY variable is set to "unix:disp.scr" then Unix domain sockets are used. If it is set to "hostname:disp.scr" then TCP sockets are used to transport the data to the X server. The X_SHM_SIZE environment variable X_SHM_SIZE is an environment variable to AIXwindows, and has been available since AIXwindows Release 1.2.3. This variable can be used to change the size of the client-to-server and server-to-client SMT buffer sizes. The default size is 64k bytes. The minimum size is 16k bytes and the maximum size is 252k bytes. Users may wish to change the size of the buffers dependent on their specific application needs. Larger buffers would perform better on larger data sets and vice-versa. D. Other Shared Memory Mechanisms It is important to note that the Shared Memory Transport mechanism is not the same as the Shared Memory Extension (MIT-SHM) shipped by X Consortium. The extension operates solely on pixmaps and images and requires that the client application have detailed knowledge of the transport mechanism. In this scenario, the client makes specific calls to the server-side extension to gain addressability to a shared memory segment that the server has addressability to. Shared Memory Transport, on the other hand, utilizes the shared memory segment to transport all of the data (not just pixmaps and images) to and from the X server. The client is not required to do any special processing. Xlib handles the transport mechanism for the client application. E. Installation of AIX Normal installation of AIX will provide the SMT mechanism upon initial boot of the system. The default transport mechanism is SMT. The use of this mechanism is transparent to applications. The only difference between SMT and any other transport mechanism is performance. F. Threaded Clients and SMT Shared Memory Transport in Version 4.3.0 of AIX does not support threaded clients. If a threaded client attempts to open a shared memory transport connection to the server, it will default to sockets instead. A future version of AIX will support threaded clients through Shared Memory Transport.