Good Programming Practices

Marc Horowitz

Section 4: Prof. Peter Elias Luis Rodriguez March 5, 1991

One of Lampson’s design suggestion is reliability (“safety first”). She suggests that error recovery be as complete as possible, so that a small failure does not cause the entire system to stop. Grapevine achieves a high reliability by making all important parts of the system redundant. For example, each step of delivery of a message is replicated in some way. When a client wants to send a message, it must locate an appropriate registration server in order to find the destination user’s mailbox. If one registration server is down, rather than failing to deliver the message, the Grapevine system provides for redundant registration servers with the same information. The client then sends the message to the recipient’s message server for delivery. If the primary message server is down, the message can be sent to any other message server for eventual delivery. A user can have multiple mailboxes, so if one goes down, mail will be delivered to an alternate mailbox. The Grapevine system also keeps the interface to all this complexity simple, so the end-user does not need to know exactly what is going on. He merely sends mail, and receives mail, and can usually remain unaware of hardware problems, maintenance cycles, etc, which cause disruption of service in systems which are not as fault tolerant as Grapevine.

The X Window System achieves a number of speedups through clever use of caching. As much information as possible is replicated on the client and server, so that less data needs to be passed when an operation is to take place. For instance, rather than forcing the client and server to pass large structures describing windows, bitmaps, fonts, and other resources, these are described by an ID, which is only a 32 bit number. When the client wants to change some of its information, it tells the server. When the server changes a client’s state, it asynchronously informs the client so that it can change its internal state. Under newer versions of X, the server can cache the contents of windows, or the parts of the screen obscured by temporary popups, such as menus, so that the server can redraw without having to contact the client. The X protocol also lets clients give hints to the server on what the client is going to use, so that the server can cache intelligently, and not waste resources caching informatin the client is never going to use. If the client makes many, similar requests (such as many DrawLine calls), the client library will cache them, and send them out all at once, taking advantage of the communication channel’s greater efficiency for larger packets. In general, the X Window System uses both client and server caching to optimize for the smallest amount of communications possible between the server and the client.