128 The X-Windows Disaster the mouse happens to be. Some programs need to update meters or widgets on the screen every second. Other programs just want to display clocks the server could just as well do the updating, provided that there was some way to tell it to do so. The right graphical client/server model is to have an extensible server. Application programs on remote machines can download their own special extensions on demand and share libraries in the server. Downloaded code can draw windows, track input events, provide fast interactive feedback, and minimize network traffic by communicating with the application using a dynamic, high-level protocol. As an example, imagine a CAD application built on top of such an extensi- ble server. The application could download a program to draw an IC and associate it with a name. From then on, the client could draw the IC any- where on the screen simply by sending the name and a pair of coordinates. Better yet, the client can download programs and data structures to draw the whole schematic, which are called automatically to refresh and scroll the window, without bothering the server. The user can drag an IC around smoothly, without any network traffic or context switching, and the client sends a single message to the server when the interaction is complete. This makes it possible to run interactive clients over low-speed (that is, low- bandwidth) communication lines. Sounds like science fiction? An extensible window server was precisely the strategy taken by the NeWS (Network extensible Window System) window system written by James Gosling at Sun. With such an extensible system, the user interface toolkit becomes an extensible server library of classes that clients download directly into the server (the approach taken by Sun’s TNT Toolkit). Toolkit objects in different applications share common objects in the server, saving both time and memory, and creating a look-and-feel that is both consistent across applications and customizable. With NeWS, the window manager itself was implemented inside the server, eliminating network overhead for window manipulation operations—and along with it the race conditions, context switching overhead, and interaction problems that plague X toolkits and window managers. Ultimately, NeWS was not economically or politically viable because it solved the very problems that X was designed to create.
X Myths 129 Myth: X Makes Unix “Easy to Use” Graphical interfaces can only paper over misdesigns and kludges in the underlying operating system they can’t eliminate them. The “drag-and-drop” metaphor tries to cover up the Unix file system, but so little of Unix is designed for the desktop metaphor that it’s just one kludge on top of another, with little holes and sharp edges popping up everywhere. Maybe the “sag-and-drop” metaphor is more appropriate for such ineffective and unreliable performance. A shining example is Sun’s Open Windows File Manager, which goes out of its way to display core dump files as cute little red bomb icons. When you double-click on the bomb, it runs a text editor on the core dump. Harmless, but not very useful. But if you intuitively drag and drop the bomb on the DBX Debugger Tool, it does exactly what you’d expect if you were a terrorist: it ties the entire system up, as the core dump (including a huge unmapped gap of zeros) is pumped through the server and into the debugger text window, which inflates to the maximum capacity of swap space, then violently explodes, dumping an even bigger core file in place of your original one, filling up the file system, overwhelming the file server, and taking out the File Manager with shrapnel. (This bug has since been fixed.) But that’s not all: the File Manager puts even more power at your fingertips if you run it as root! When you drag and drop a directory onto itself, it beeps and prints “rename: invalid argument” at the bottom of the window, then instantly deletes the entire directory tree without bothering to update the graphical directory browser. The following message illustrates the X approach to “security through obscurity”: Date: Wed, 30 Jan 91 15:35:46 -0800 From: David Chapman zvona@gang-of-four.stanford.edu To: UNIX-HATERS Subject: MIT-MAGIC-COOKIE-1 For the first time today I tried to use X for the purpose for which it was intended, namely cross-network display. So I got a telnet win- dow from boris, where I was logged in and running X, to akbar, where my program runs. Ran the program and it dumped core. Oh. No doubt there’s some magic I have to do to turn cross-network X on. That’s stupid. OK, ask the unix wizard. You say setenv DIS-