Você está na página 1de 6

Red Hat Academy https://academy.redhat.com/courses/rha130-5.0/rha130_xwindowing_x...

RHA130: Red Hat Enterprise Linux Core System Administration

Student: skapando Class: VA-O2010-1

Jump To: RHA Homepage Class Homepage Grades Curriculum

The X Windowing System


Prev Next

Chapter 1. The X Windowing System


Table of Contents
Discussion
The Linux Graphical Environment
The X Server
The X Process
X Client/Server Design
Display Numbers, and the DISPLAY Environment Variable
The xorg X Server
Window Managers
Desktop Environments
Online Exercises
Specification
Deliverables
Cleaning Up
Questions

Key Concepts

The Red Hat Enterprise Linux graphical environment is anchored by a userspace process called
an X server.

The X server provides low level access to input devices (such as a keyboard and mouse) and
output devices (such as a video card and monitor), but akin to a device driver, does not perform
high level activity.

X clients make requests of X servers using the X11 protocol, referring to the DISPLAY environment
variable for the X server's identity.

Window managers are a special class of X client which encapsulate other X clients and provide
uniform moving, resizing, and iconization behavior. The default window manager in Red Hat
Enterprise Linux is metacity.

A desktop environment is a suite of related applications which draw upon common libraries to
provide a unified "look and feel" and interapplication communication. The default desktop
environment in Red Hat Enterprise Linux is GNOME.

Discussion
The Linux Graphical Environment
This Workbook first introduces the various components which compose the graphical environment, and how the
conceptual layers interrelate. It then focuses on what is often the trickiest step: low level X server configuration. Next, two
techniques for starting an X server are introduced, and how to customize these two startup paths. Lastly, the X server's
relationship with the network is discussed, and how this relationship can be used to securely access graphical
applications on remote machines.

1 de 6 20/06/2010 23:03
Red Hat Academy https://academy.redhat.com/courses/rha130-5.0/rha130_xwindowing_x...

It's important to appreciate that in many situations, the graphical environment is considered only a feature, if not an
unwanted complication. Unix began as a terminal server, with simple terminals connected over serial cables (thus the
continued prominence of the concept of a terminal in Linux). Unix's next leap forward occurred in networking, where many
of the core protocols which today anchor the Internet were nurtured, such as TCP/IP, DNS, SMTP, and others. From its
initial design, and still today, the Unix (and Linux) operating system is considered full featured and robust as a file server
in the closet, or as a web server on a rack, without ever using a video card in anything but text mode.

Nevertheless, Unix had developed a sophisticated graphics environment, centered on the X server. Modern Linux systems
are being targeted as desktop system, and seeing rapid development towards the goal of a powerful yet manageable
graphical Workstation.

The X Server
The X server provides the graphical core of the Red Hat Enterprise Linux system. The X server embodies two non-obvious
design choices about how to implement graphics on Unix systems which have proved themselves over the test of time.

The X Process

First, support for graphics occurs in userspace, not in the kernel. By design, the Linux kernel generally only accesses
video cards in text mode, leaving support for graphics mode to the X server, which runs as a userspace process (usually
called simply "X"). Graphical environments are complicated, and bugs happen. If the graphics system "locks up" on a
Linux box, however, the administrator can still open up a shell (often from a remote machine over the network), track
down the X server process, and kill it with a lethal SIGKILL (signal number 9). [1] If the graphical environment were
implemented by the kernel directly, as in other some other notable modern Operating Systems, an administrator's only
recourse would be to reboot the machine. [2]

X Client/Server Design

Secondly, as the name of the X server implies, graphics has been strictly divided into the hardware dependent "device
driver" (the X server), and hardware independent applications (X clients). The X server provides access to traditional input
devices, such as the keyboard and mouse, and traditional output devices, such as the videocard and monitor. The X
server does nothing interesting with these devices, however.

Instead, other applications (known as X clients) make requests of the X server, such as "paint a white oval there", or
"write the text [root@station root] # in this particular font over here". X clients also ask the X server to relay
information about key presses on a keyboard, or clicks from a mouse (referred to generically as events).

X clients communicate with X servers using the well defined X11 protocol (pronounced "x-eleven"). Because both are
designed to the protocol, not each other, X clients can happily make requests of any of several X servers running on a
machine, X servers running on remote machines, or even X servers on other operating systems.

Display Numbers, and the DISPLAY Environment Variable

X clients can happily make requests of any of possibly multiple X servers running on a single machine, or even X servers
running on remote machines. A particular X client usually determines which X server it should contact by examining its
DISPLAY environment variable.

The DISPLAY environment variable conventionally uses the following syntax, with explanations for the various
components found in the following table.

DISPLAY=hostname:display_number.screen_number

Table 1-1. Components of the DISPLAY Environment Varaible

The host
on which
the X
server is
hostname
running
(localhost
by
default).
An
integer
which
serves as
display_number
the
identity of
a
particular

2 de 6 20/06/2010 23:03
Red Hat Academy https://academy.redhat.com/courses/rha130-5.0/rha130_xwindowing_x...

instance
of an X
server. If
multiple
X servers
are
running
on a
single
machine,
each
must
have a
unique
display
number.
By
default,
the first X
server
started
has a
display
number
of 0. All
other X
servers
must
have a
unique
display
number
assigned
on
startup.
The
integer
screen
number
is only
relevent
on dual
headed
systems.
On a
system
with two
video
cards
and two
monitors,
each
screen_number monitor
could be
a
separate
display
with
distinct
display
numbers
(and
have no
relation to
one
another),
or the two
monitors
could be
two

3 de 6 20/06/2010 23:03
Red Hat Academy https://academy.redhat.com/courses/rha130-5.0/rha130_xwindowing_x...

screens
of the
same
display
(left half
and right
half).
Obviously,
the
screen
number
is seldom
relevent,
and
defaults
to 0 (the
first
screen).

The only required element is the display number. For example, the most common case is for a client to make requests of
the only X server running on the local machine, in which case DISPLAY could resolve to simply :0 (or equivalently :0.0
as is the case for the gnome-terminal which is running the following shell).

[root@station root]# echo $DISPLAY


:0.0

While the DISPLAY environment variable is usually set as part of the X server's startup process and subsequently
inherited from client to client unnoticed, but occasionally there is need to manage it explicitly.

The xorg X Server

Different implementations of X servers exist, some proprietory and some open sourced. The version of the X server which
ships with Red Hat Enterprise Linux is the "xorg" X server. The xorg project was started at MIT with goals similar to the
Free Software Foundation: the development of high quality software licensed so that the source code would be available
to all who use it. The focus of the xorg project has been the X server, however, as the name implies.

The xorg project maintains their own website at http://www.xorg.org, a good resource for technical documentation related
to the X server.

Window Managers
X clients are any application which make requests of an X server. Usually, an X client is responsible for a particular
rectangle of real estate on an X server's display, in which it will write text (if it's gnome-terminal), or draw a clock face
with two hands (if it's xclock).

Window Managers are a special class of X clients, which do not claim much real estate of their own, but instead
encapsulate other X clients with all of the border features that make the client look like a window, such as a title bar, scroll
bar, and "go away" boxes. In the following figures, note that both gnome-terminal and xclock have similar borders,
which allow them to be resized, iconified, or closed.

Figure 1-1. The xclock X Client

Figure 1-2. The gnome-terminal X Client

4 de 6 20/06/2010 23:03
Red Hat Academy https://academy.redhat.com/courses/rha130-5.0/rha130_xwindowing_x...

Everything "inside" the window is controlled by a particular X client. Everything that makes it a "window", however, and
not just a box, is controlled by the window manager.

Traditionally, Linux has supported a large variety of window managers, from the graphically sophisticated to the quick and
simple. Red Hat Enterprise Linux has stabilized on a single suggested window manager (within the GNOME
environment), metacity, which is run by default.

Desktop Environments
A fairly recent development within Unix in general, and Linux in particular, has been the movement towards a common
"look and feel" shared by multiple applications. The applications draw infrastructure from common libraries which
compose a Desktop Environment. Applications which use the same desktop environment generally share many features
which are apparent to users, such as common menu layout, common icons, and common dialogs (such as file selection
dialogs). The similarities are evident in the following two applications from the same Desktop Environment.

Figure 1-3. The GNOME gedit Application

Figure 1-4. The GNOME gnome-sound-recorder Application

5 de 6 20/06/2010 23:03
Red Hat Academy https://academy.redhat.com/courses/rha130-5.0/rha130_xwindowing_x...

Desktop environments also provide common infrastructure which as not as obvious to users, such as interapplication
communication like "Drag n' Drop", common user option handling, and coordinated features such as the "Open Recent"
entry in the Applications menu shared by many applications.

Linux has seen two parallel developments of Desktop Environments, KDE, based on the Qt libraries, and GNOME, based
upon the GTK libraries. Red Hat Enterprise Linux tends to show a preference for the GNOME desktop environment,
though both are fully supported. In Red Hat Enterprise Linux, both desktop environments have been configured with a
common look and feel, making it often hard to distinguish which underlying desktop environment is a particular
application is using.

Notes

[1] Linux, like Unix, has gained a reputation for stability not because things don't go wrong; they do. Systems are
isolated enough by design, however, so that when something goes wrong, it doesn't take the whole machine
with it.

[2] Modern Linux kernels are starting to buck this trend, with support for the graphics mode of many modern video
cards provided by the kernel directly. This capability, popular for embedded systems, is referred to as
framebuffer support, and is disabled by default in Red Hat Enterprise Linux. Framebuffer support can be
enabled by passing the vga=mode kernel boottime parameter. See /usr/src/linux-2.4/Documentation
/fb/vesafb.txt for more information (found in the kernel-source package).

Prev Home Next


The X Windowing System Online Exercises

rha130-5.0-1-en-2008-01-14T16:23:55-0500

Copyright © 2003-2007 Red Hat, Inc. All rights reserved. For use only by a student enrolled in a Red Hat Academy course taught at a Red Hat Academy. Any other use is a violation of U.S. and
international copyrights. No part of this publication may be photocopied, duplicated, stored in a retrieval system, or otherwise duplicated whether in electronic or print format without prior written
consent of Red Hat, Inc. If you believe Red Hat course materials are being used, copied, or otherwise improperly distributed please email training@redhat.com or phone toll-free (USA) +1 866 626
2994 or +1 (919) 754 3700.

6 de 6 20/06/2010 23:03

Você também pode gostar