The X stack is set of layers from which a GUI (graphical user interface) is constructed on Linux and other Unix-like operating system. It contrasts sharply with the non-layered, or integral, approach used to construct GUIs on other types of operating systems (such as the Microsoft Windows systems).
The second layer is the X server. An X server is a program in the X Window System that runs on local machines (i.e., the computers used directly by users) and handles all access to the graphics cards, display screens and input devices (typically a keyboard and mouse) on those computers. It manages windows and draws basic graphics primitives such as lines and bitmaps.
The X Window System, often referred to merely as X, is a complete, cross-platform and free client-server system for managing GUIs on single computers and on networks of computers. The client-server model is an architecture (i.e., network design) that divides the work between two separate but linked applications, referred to as clients and servers (or X clients and X servers in the case of the X Window System).
The third layer is Xlib. This is a standard library for interfacing with the X server, and it is used by application programs only to handle the low level details of the X protocol. A library is a collection of routines (also called subprograms, procedures or functions) that perform operations that are commonly required by programs. Xlib is notoriously complex and does not provide higher level abstractions such as buttons and text boxes.
The fourth layer consists of toolkits, which are used by most application programs instead of using Xlib directly. Toolkits provide a higher level of abstraction, and thus make programming easier and provide a consistency among applications. Commonly used toolkits include GTK, Motif, Qt and Tk.
The fifth, and top, layer consists of application programs that run in the GUI, i.e., the X clients. Whereas the X server runs on the user's local machine, X clients can run on either the local machine or remote machines (i.e., computers elsewhere on the network), rather than just being restricted to the local machine, as is generally the case with non-layered GUI systems. This is one of the major advantages of the layered approach of the X stack.
Another big advantage of this approach is that it makes it relatively easy to replace each layer with alternatives for the purpose of customization or upgrading, thereby adding greatly to system flexibility and robustness (i.e., the ability to operate satisfactorily under unusual conditions). For example, it facilitates changing the look and feel (i.e., how it appears to the user) of GUIs without adversely affecting their stability or performance.
Moreover, the use of a layered structure is consistent with the Unix philosophy, a main tenet of which is to use small, modular programs that do one thing well rather than large programs that attempt to do multiple things.
Created December 22, 2005.