Multithreaded Design in the Athena Environment

Greg Hudson

March 9, 1995

I will be doing a thesis with Distributed Computing and Network Services. My thesis has two purposes: first, to provide DCNS will modifications to some of their basic system libraries such that they will work with multithreaded programs, and second, to explore the impact of issues that arise in multithreaded programming as they apply to the Athena environment, so that DCNS can better decide on whether and when to apply multithreaded design to their development projects. The primary focus of this thesis is on concurrenecy as a design tool, not for marginal performance gains or to take advantage of multiple processors.

My thesis work will occur during the spring, summer, and fall of 1995. I hope to complete several of the implementation projects by the beginning of the summer, and use that experience gained from those projects to help answer some of the questions about multithreaded programming.

1 Goals

The thesis will involve some number of the following implementation projects, roughly in order from first to last. The results of some of these projects may be integrated into the Athena source tree if they are not likely to increase maintenance costs; others will remain experimental.

• A thread-safe version of the hesiod service-name resolution library. hesiod is a simple wrapper library around the Domain Name Service resolution routines in the standard C library, which have already been rewritten to be thread safe during past work, so most of the work here is designing interface changes to avoid returning data in static storage.

• A thread-safe version of the com err error-reporting library and associated tools. com err is a simple library which may not require any changes for thread safety.

• A multithreaded version of attach, the program which maps Athena lockers onto the filesystems of local workstations. The multithreaded version will do service-name resolution requests and other remote requests in parallel.

• A thread-safe version of the Zephyr messaging system libraries. The zephyr libraries are significantly larger and more complicated than either hesiod or com err, but are not intrinsically difficult to make thread-safe.

• A multithreaded version of zhm, the Zephyr host manager. zhm is a small program, currently structured using an event loop and timer signals. Its operation is somewhat complicated, and it has known problems which no one knows how to fix.

• A multithreaded version of zwgc, the Zephyr windowgram client. This is intentionally mentioned last, as it is an ambitious project: in addition to being a large program, zwgc uses the Xwindows library, a large non-thread-safe outside library which will complicate the development of a multithreaded version of zwgc.

The thesis also seeks to answer the following questions, in no particular order:

• What are viable multithreaded programming environments? Is it feasible to write multithreaded programs for several environments, or must DCNS pick one environment for all applications to minimize maintenance costs?

• What kind of tools are available for debugging multithreaded programs? How can they be used to examine the states of threads during a deadlock situation? What conventional debugging tools fail to work for multithreaded programs?

• What is the best way to design a library interface so that it will work with multithreaded applications? Is it feasible to place some responsibility for locking on the library, or must the library interface be designed so that all responsibility for locking falls on the calling routines?

• What new debugging issues arise because of multithreaded programming for the kinds of programs used in the Athena environment? Is greater skill usually required to debug multithreaded programs because of race conditions? Does multithreaded design help avoid any classes of bugs?

• How can threads simplify the design of programs in the Athena environment or help them achieve better behavior more easily than they could otherwise?

• Are there any classes of programs which are significantly better or worse for multithreaded programming than others?

Finally, I hope to furnish DCNS with a reference document containing factual information about existing threads environments, for use in modifying or debugging threaded programs, the pitfalls of using certain libraries which may not be thread-safe in multithreaded programs, and other useful material.

2 Why This Thesis is Interesting

The projects described in this proposal are interesting from a technical perspective for several reasons. First, while a wide body of literature is available from the systems community about programming with concurrency, very little of it deals with issues relating to library interfaces and modularity. Second, several programs in the Athena environment contain complicated state machines which I believe can be simplified (with possible attendant costs) through the use of concurrency. Third, some of the tools which could benefit from performing requests in parallel directly affect the speed of logging into the Athena environment, so there is some possibility of direct benefits for Athena users.

This thesis is also interesting because of differing views of staff members in the DCNS group. In the past, some staff members have objected when other staff members have proposed designs involving threads, and the ensuing arguments have been largely anecdotal and not backed up by evidence. One of the purposes of this thesis is to gather real information to help settle these disagreements in a more informed manner.

References

[1] Birrell, Andrew D. An Introduction to Programming with Threads. SRC Document 35.

ftp://gatekeeper.dec.com/pub/DEC/SRC/research-reports/SRC-035.ps.Z

[2] Cooper, E. and Draves, R. C Threads. Technical report CMU-CS-88-154, Carnegie Mellon University. Computer Science Department, Pittsburg, PA (June 1988).

ftp://ftp.cs.cmu.edu/project/mach/doc/techreports/threads.ps

[3] DellaFera et al. “Zephyr Notification Service”. In J. H. Saltzer (editor), Project Athena Technical Plan,” Section E.4.1. M.I.T. Project Athena, 1987.

ftp://athena-dist.mit.edu/pub/ATHENA/zephyr/techplan.PS

[4] Dyer, S.P., and F. S. Hsu. “Hesiod Name Service.” In J. H. Saltzer (editor), Project Athena Technical Plan, Section E.2.3. M.I.T. Project Athena, 1987.

ftp://athena-dist.mit.edu/pub/ATHENA/hesiod.tar.Z

[5] IEEE Draft Standard P1003.1c. Draft Standard for Information Technology Portable Operating System Interface (POSIX) Part 1: System Application Program Interface (API)-Amendement 2: Threads Extension [C Language], Draft 10. September 1994.