They handle pretty much everything (that isn't displaying graphics on hardware) for X. Logins, greeters, pass X the configuration for external connections, session choice.
You don't need a heavy DM but I would argue that GDM isn't that heavy. LightDM certainly isn't. But if you're really trying to hypermile things, take a look at NoDM. It's very raw and it's only intended for single-user systems. It won't provide you with any security and it might undermine what is already there.
I use NoDM on our media-centre, which just starts up X and then launches Boxee.
An X Windows server provides a very basic graphical environment, usually connected to a monitor, a mouse and a keyboard.
A display manager (DM) is just the login screen, which runs in its own X windows server session. When you log in, the DM will usually start an entirely fresh X session and will also start the window manager (or desktop environment) that you have chosen.
There are many window managers (WM) available for X. These provide the basics of handling switching and focusing windows, positioning, resizing and decorations (or no decorations in the case of twm/ratpoison/awesome).
A desktop environment (DE) usually provides a window manager but a bunch of other stuff too: panels, start button, applets for volume, network etc. They provide an environment in which everything looks similar and easily recognisable, and provide GUI tools that allow you to do many admin tasks without having to type in a terminal. They often provide a display manager too, for a consistent end-to-end experience. And in the case of Gnome and KDE, a full suite of applications too!
So hackers can survive with just a window manager, but general computer users prefer a desktop environment where everything is integrated in a familiar style.
The fun thing is, thanks to Unix's philosophy of decoupling components, and since the only common required component is X windows, you can mix and match the rest if you want to. You could use Trinity KDE's display manager but ask it to run the Fluxbox window manager when you log in, and then startup LXDE's panel (lxpanel) to provide some icons, applets and a workspace pager. You could even run bbkeys
to perform window management actions using your favourite keybindings, and keep using it if you switch to a different WM later! :)
(A setup like that can be achieved with configuration in .fluxbox/startup
or in .xinitrc
if you skip the DM and just run startx
from the console.)
Finally, many window managers will let you switch to a different window manager via their menu (sometimes found by right-clicking the desktop), without restarting the X session or losing any of your windows! This is great when you want to try out some WMs to see which one you like most. Sadly modern Desktop Environments don't seem to bother with this cool feature.
Some distributions will offer you a failsafe login, which may provide an x-terminal with no window manager. From there you can boot a window manager, kill it, start a DE, kill that, start a new window manager etc. The X session itself will not close until that x-terminal does.
Best Answer
As far as I know this is all just tradition. "tty" is just a historical hangover from mainframes. 1-6 exist as login prompts because that's how they're defined in
/etc/default/console-setup
(and executed by/etc/init/console-setup.conf
). This is how those TTYs get their login prompts and by extension, why tty7 does not have one.But why 6 text ttys? And why tty7 for graphics? I have no idea.