There's plenty of book you can find by searching on Google with the subject "X11 architecture" or something similar.