Atoms
Atoms are 32-bit integers representing strings. The protocol designers introduced atoms because they represent strings in a short and fixed size: while a string may be arbitrarily long, an atom is always a 32-bit integer. Atom brevity was exploited by mandating their use in the kinds of packets that are likely to be sent many times with the same strings; this results in a more efficient use of the network. The fixed size of atoms was exploited by specifying a fixed size for events, namely 32 bytes: fixed-size packets can contain atoms, while they cannot contain long strings.
Precisely, atoms are identifiers of strings stored in the server. They are similar to the identifiers of resources (Windows, Pixmaps, etc.) but differ from them in two ways. First, the identifiers of atoms are chosen by the server, not by the client. In other words, when a client requests the creation of a new atom, it only sends the server the string to be stored, not its identifier; this identifier is chosen by the server and sent back as a reply to the client. The second important difference between resources and atoms is that atoms are not associated with clients. Once created, an atom survives until the server quits or resets (this is not the default behavior of resources).
Atoms are identifiers and are therefore unique. However, an atom and a resource identifier can coincide. The string associated with an atom is called the atom name. The name of an atom cannot be changed after creation, and no two atoms can have the same name. As a result, the name of an atom is commonly used to indicate the atom: “the atom ABCD
” means, more precisely, “the atom whose associated string is ABCD
.” or “the atom whose name is ABCD
.” A client can request the creation of a new atom and can request for the atom (the identifier) of a given string. Some atoms are predefined (created by the server with given identifier and string).
Atoms are used for a number of purposes, mostly related to communication between different clients connected to the same server. In particular, they are used in association with the properties of windows, which are described below.
The list of all atoms residing in a server can be printed out using the program xlsatoms
. In particular, this program prints each atom (the identifier, that is, a number) with its name (its associated string).
Read more about this topic: X Window System Core Protocol
Famous quotes containing the word atoms:
“Scatter my ashes, strew them in the air:
Lord since thou knowst where all these atoms are,
Im hopeful thoult recover once my dust,
And confident thoult raise me with the just.”
—James Graham Marquess of Montrose (16121650)
“No imperfection in budded mountain,
Valleys breathe, heaven and earth move together,
daisies push inches of yellow air, vegetables tremble,
green atoms shimmer in grassy mandalas,
sheep speckle the mountainside, revolving their jaws with empty eyes,
horses dance in the warm rain,”
—Allen Ginsberg (b. 1926)
“The atoms of Democritus
And Newtons particles of light
Are sands upon the Red Sea shore,
Where Israels tents do shine so bright.”
—William Blake (17571827)