Friday, November 5, 2010

Thinking About X

X11 has been with us (the Linux/UNIX community) for quite some time. Well, quite some time depending upon your age; it was released in 1984. In computing terms, this is the equivalent of saying that you have been using the original black and white Mac OS for the past 26 years. When software reaches this kind of age, it becomes nearly impossible to maintain.

Software has a tendency to grow in a rather organic way. As developers leave a project and new developers join a project, coding styles within an application or software stack get mixed together. Quite often, documentation of all of these changes is not well done, and the code itself becomes obfuscated. The code itself may be of outstanding quality. The software may have more features than you can wave a stick at, but due to its age and complexity bugs that do arise may take a very long time to locate and fix. Further, the addition of new features is often a nightmare. This leads to those features either being entirely separate programs, or worse... dirty hacks. This is the point that X11 has reached.

X11 is unmaintainable. It's also quite large. Aside from both of those problems, it's not quite as advanced as Quartz or Windows' GUI layer (DWM). What this amounts to is a constantly growing size. People want to have the features and visuals of the two leading competitors, but they want to use Linux/UNIX. This means an increase in the number of modules, or dirty hacks to existing modules. While X has become modular over time, it hasn't really trimmed down at all. If you want a good looking interface to ship with your distribution or hardware product, you have quite a bit of overhead. More and more each year, people are talking about X11 alternatives. Several have been started. None have really come to fruition.

There is one major reason that no alternative has been successful: software. Too much software has been written for X11 to simply move to a new display server. Imagine having to rewrite KDE, GNOME, XFCE, EDE, Firefox, Chrome, SeaMonkey, LibreOffice, and everything else. The investment for such a migration would be astronomical. For this reason, nothing has been done.

Recently, there was a small change. One company, headed by one man, has announced ambitions to migrate their Linux distribution to Wayland (a new display server). This is Mark Shuttleworth and Canonical, with the distribution called Ubuntu. Maybe you have heard of it? Thought so. Canonical likely has the resources to port their entire graphical set of applications to Wayland. If this were to be done, the world's most popular Linux distribution would be relatively free of X. It is without doubt that Ubuntu would have a rootless X server on board for those "legacy" applications (much the same way that OSX does), and this would provide a grace period in which developers who wanted to support Ubuntu could migrate their products.

There has only been one other real contender. Ok, not a real contender, but an attractive one. That was the Y Windows project (http://www.y-windows.org/), which became abandonware as soon as it was released. I won't lie; I have contemplated further development of Y Windows. The main issue there is that Y Windows was written in C++, and I only know ASM, Ada, Java, and PHP. Learning C/C++ may be trivial considering my current skill set, but my interest in Y Windows never amounted to enough motivation. I feel that this is a problem for many. We may have the technical skill, we may have the interest, but the motivation... perhaps not. X11 works. It doesn't work particularly well, but it fills the need. In the open source world, this is perhaps our biggest challenge.

4 comments:

brumburak said...

I'd cheerfully wellcome simplicated x server on my pc.. It dont need much features at the beginning. Just allow me to run my wmii..

Ford said...

@brumburak,

I may yet begin work on a newer version of Y Windows that has a more robust feature set. The main issue for me will be the porting of applications (including the porting of GTK-Dialog and/or some other form of dialog). Especially, the porting of more complex application in which people have interest. XForms would also be of a high priority for me. This is all dependent upon me first learning C/C++ beyond the trivial knowledge I currently have.

Kevin Gillette said...

Porting Gnome (GTK2), KDE (Qt), and most of the other sub-distributions of X software (which almost always are based on GTK+ or GTK2) is actually fairly trivial for the same reason that those widgeting/display libraries are maintained across platforms including X and MS Windows.

Once a renderer is produced for X12 or Y-windows, or Wayland (or whatever the next big X will be called), none of the applications (at least the ones that are properly written) will need to make any code changes for the switchover.

As far as C++ goes, it's pretty much an exercise in pain these days. C is great, but anything that C++ does that C isn't good at, many other languages will be much better at than C++. In my honest opinion, C++ is utterly useless, and is better replaced by C with embedded Lua, or Python with embedded C modules, or just about any other combination of languages (I would even choose pure C for windowing over C++).

Nonetheless, X11 is, as you said, evolutionary, and a lot of old things will get phased out of it over time. Case-in-point: native X11 protocol compression. It turned out that SSH-tunneling of X was considerably more performant, and thus in the Unix fashion, the native compression project was effectively abandoned.

Things that it does give you for free that alternatives have no (trivial) transparency for:

* The ability to set up cheap, dumb X terminals. Think of a net-booted pentium 233 with a 32mb gfx card and 128 mb of ram that looks and feels like a 3 ghz machine -- imagine 20 of those, all hooked up to a real 3 ghz machine that acts as a file server/X client.

* Network transparency. You can just as easily run your clients over the internet (very effective when SSH-tunneled). For that matter, you can display clients simultaneously from any number of remote machines, which only need to be built against libX and friends. This lets you set up server-monitoring clients locally on those machines, and display them on the administrator's workstation. The ms window's minimal equivalent? Custom client/server protocol on both endpoints that is network aware (vs network transparent).

One of the biggest problems with X is not X, but GTK. GTK/GTK+/GTK2 is fine and well, and rather performant in its Windows port, but on X11 it's bloody slow for some reason. Open firefox, make sure your window manager supports and has enabled opaque resizing, and resize the window -- you'll notice that it has slow redraw, and even slower reflow of text. Try the same thing in konqueror -- not only is it fluid, but the html will reflow in realtime. Gnome alone could give X11 the impression of being slow and unwieldly.

Foo Bar said...

Well put, I'm looking forward to a way forward, I thought X was gone when I replaced my X-terminal with a PC, then came Linux ;)

Post a Comment