Is it possible for a X server to have multiple displays

displayx11

This is what I find in man X:

The phrase "display" is usually used to refer to a collection of monitors that share a common set of input devices (keyboard, mouse, tablet, etc.). Most workstations tend to only have one display. Larger, multi-user systems, however, frequently have several displays so that more than one person can be doing graphics work at once. To avoid confusion, each display on a machine is assigned a display number (beginning at 0) when the X server for that display is started. The display number must always be given in a display name.

My question is: Do we need to start multiple X servers if we want to use multiple displays, or all those displays can be handled by a single X server? Is it possible to share keyboards, mice and monitors across different displays?

Edit. The display here refers to the concept defined by the X window system, not a single monitor. I know there are Xinerama and XRandR technologies that support multi-head configurations.

Best Answer

Quoting X(7):

From the user's perspective, every X server has a display name of the form:

hostname:displaynumber.screennumber

Each X server has one display (which may include multiple monitors, or even no monitors at all). Using multiple displays (in the X sense) requires multiple X servers; that's how you get multiple seats too.

As far as sharing goes, I think each X server expects to "own" the devices it's using at any given time, so you can't have input from a single keyboard going to multiple X servers simultaneously, or the output of multiple X servers combined on a single monitor. X servers can hand hardware off, which allows you to run X servers on multiple VTs and switch between them (this is how simultaneous logins are handled e.g. in GNOME). You can also nest some X servers (Xephyr, xpra...), so input goes to your main current X server, and gets passed on to the nested X server in a window; and the output of the nested X server is displayed in a window by the main X server.

On Linux, you could write a multiplexing input driver in the input layer to share input devices, but that's a different layer altogether than the X server.

Related Question