Multithreading is a powerful programming paradigm that has become very popular. The authors have developed a set of course materials and software tools for effectively teaching multithreaded programming (MTP). One important component of the authors' system is a very simple user-level kernel for instructors to teach MTP without getting into system details, and for the students to add extensions. This paper presents the design and implementation of this kernel as well as its use in the classroom. This minimal user-level kernel employs a first-come-first-served scheduling policy, and permits a user to create and join threads, and use mutex locks. With this kernel, students are able to implement semaphores, barriers, reader-writer locks, mail-boxes and condition variables. This approach has two advantages: (1) students can easily learn the basics and internals of a kernel that supports MTP, and (2) conventional debuggers can be used for debugging purposes, because the kernel is a user-level program.
This paper focuseson the design and features of our class library.In what follows, Section 2 reviews our and relatedwork; Section 3 discusses system design issues; Section4 presents the Thread class; Section 5 through Section8 cover various supported synchronization primitives;and, finally, Section 9 has our conclusions