Resource ID (XID)
The 29-bit number identifying every window, pixmap, font and cursor in an X server — chosen by the client itself, so that a window can be created without waiting for a reply.
Everything a client owns inside the X server — windows, pixmaps, graphics contexts, fonts, cursors, colormaps — is addressed by a resource ID, a 32-bit field in the protocol whose top three bits are always zero. The unusual part is who hands them out. At connection setup the client receives a resource_id_base and a resource_id_mask, and from then on allocates its own IDs by counting upward within the mask. XCreateWindow can therefore return an ID immediately while the request itself sits in the output buffer, and the next call can use the window before the server has even seen it. On 1980s networks that saved one round trip per object created. The cost is that IDs per client are finite, typically 221, and that X.Org long had a ceiling of 256 simultaneous clients for exactly that reason. When a client runs dry, Xlib asks the server for free ranges through the XC-MISC extension from X11R6.
The IDs turn up everywhere in debugging. xwininfo prints "Window id: 0x3400005", where the high bits reveal which client owns the window; xprop -id, xkill -id and xdotool take them as arguments, and xrestop shows which clients are hoarding the most resources. The error codes BadWindow, BadDrawable and BadPixmap mean an ID does not point at what the server expected, and BadIDChoice that the client picked one already in use. Resources vanish when the connection closes, unless the client asked for RetainPermanent — which is how xsetroot can exit and still leave the background image behind.