Question: how x window system works?
Answer: An X server program runs on a computer with a graphical display and communicates with various client programs. The server accepts requests for graphical output (windows) and sends back user input (keyboard, mouse). In X Window, the server runs on the user's computer, while the clients may run on a different machine.