
The Fresh Breeze Model of Thread Execution Jack B. Dennis MIT Computer Science and Artificial Intelligence Laboratory Cambridge, MA 617-253-6956 [email protected] ABSTRACT The Fresh Breeze architecture explores a set of ideas that depart We present the program execution model developed for the Fresh from conventional computer architecture: Breeze Project, which has the goal of developing a multi-core chip Simultaneous multithreading can improve the uti- architecture that supports a better programming model for parallel lization of function units and allow more effective latency computing. The model combines the spawn/sync ideas of Cilk tolerance of memory transactions[22]. with a restricted memory model based on chunks of memory that A global shared address space permits abolition of can be written only while not shared. The result is a multi-thread the conventional distinction between “memory” and program execution model in which determinate behavior may be the file system, and supports a superior execution guaranteed while general forms of parallel computation are environment meeting requirements of program supported. modularity and software reuse[3][5] No memory update of shared data in a Fresh Breeze Categories and Subject Descriptors computer system eliminates the multiprocessor cache C.0 [Computer Systems Organization]: Hardware/software coherence problem: any object retrieved from the memory interfaces; D.1.1 [Programming Languages]: Applicative system is immutable. (Functional) Programming; D.1.3 [Programming Languages]: Cycle-free heap. The no-update rule In a Fresh Breeze Concurrent Programming; D.3.3 [Programming Languages]: computer system makes it easy to prevent the formation Language Constructs and Features; E.1 [Data]: Data Structures. of pointer cycles[7]. Efficient reference-count garbage collection can be implemented in the hardware. General Terms We will show how a program execution model based on these Design, Languages. ideas can provide a platform for robust, general-purpose, parallel computation. In particular, much of the difficulty of writing correct parallel programs stems from problems in getting Keywords synchronization correct. The commonly used methods of thread Program execution model, concurrency, multithreading, coordination are prone to exhibiting nondeterminate behavior, determinacy, streams, transactions. making errors difficult to track down. Moreover, getting control synchronization correct is no guarantee that accesses to data will 1. INTRODUCTION be effected without hazard, especially when memory access has With multiprocessing becoming the usual mode of computing, it is significant latency and memory is shared among concurrently more pressing than ever to adopt a model of program execution executing threads. that supports general parallel programming while avoiding the Our hypothesis is that handling control and data coordination programing difficulties attending the coordination of concurrent separately is a bad idea. Here we explore an approach in which computations in contemporary systems. data and control synchronization are always performed together, This presentation concerns the program execution model as a single atomic operation. This is offered as an alternative to developed for the Fresh Breeze Project[8][6], which has the goal transactional memory approaches that add complexity, often of developing a multi-core chip architecture that supports a better including redundant computation and retry mechanisms. programming model for parallel computing, achieving high Principle: Combine control and data synchronization in performance through parallelism rather than increased clock speed. the design of mechanisms for coordinating concurrent activities. We begin with an introduction to the Fresh Breeze memory model. Permission to make digital or hard copies of all or part of this work The program execution structure of threads of control and method for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial activations is described. Then we present the basic concurrent advantage and that copies bear this notice and the full citation on programming structure of this paper, an adaptation of the classic the first page. To copy otherwise, or republish, to post on servers fork/join control primitives for concurrent processes. We argue or to redistribute to lists, requires prior specific permission and/or a that use of this program structure yields multi-thread programs fee. that are guaranteed to be determinate. Subsequent sections deal concurrently with other subexpressions. with generalization and extension of the basic concept to programs Functions. Function applications may be evaluated that operate on data structures and data streams. How a Fresh concurrently if none uses the results of others. Breeze system can be used to run inherently nondeterminate Data Parallel. The general expression for an array computations such as general transaction processing is discussed element may be evaluated concurrently over all elements in the final section. of the array. Producer/Consumer. If one program module passes a 2. FRESH BREEZE MEMORY MODEL series of values to a second module, then both modules The Fresh Breeze architecture views memory as a collection of may run concurrently. fixed-size chunks, each holding 1024 bits of code or data. A chunk Cascaded Data Structure Construction. This is a kind may hold 32 words of 32 bits each, 16 double length words, or 32 of generalization of producer/consumer concurrency and instructions of a program method. Each chunk has a unique 64-bit will be treated in a later section. identifier (UID) that serves as a pointer for accessing the chunk. A We will show how our thread coordination model supports chunk may also hold up to 16 UIDs to represent structured each of these forms of parallelism. information. For example, a three-level tree of chunks could represent an array of 16 * 16 * 32 elements. 5. THE BASIC SCHEME The collection of chunks containing pointers to other chunks Our basic program structure for concurrency is an adaptation of forms a heap which may be regarded as a graph. The Fresh Breeze the fork/join model and is similar to the concurrency scheme of program execution model is designed so that cycles in the heap Cilk[14]. A master thread spawns a slave thread (executing a new cannot be constructed. This is ensured by the rule that updates to function activation) that performs an independent computation the contents of chunks are disallowed once they are shared, and and terminates by joining with the master thread. The problem to marking pointers to chunks in process of definition (creation) so be solved is that of performing the join in a safe manner -- in a that a thread may not store them in any chunk that is under way that does not introduce the possibility of hazards. For the construction. present we assume that the slave computation is contributing a In a Fresh Breeze system all on-line data, including files and single value (one computer word) to the computation being databases, are held in the chunk memory as data structures in the performed by the master thread. heap. Because, in our model, there is no shared data between the master In the following, we will show how this memory model can and slave threads, updating shared data cannot be used to support a variety of program constructions for parallel communicate the slave result to the master. (This is good because computation. a shared data mechanism would likely introduce possible hazards.) Our scheme is the following: When the master spawns the slave 3. PROGRAM EXECUTION thread, it initializes a join point and provides the slave thread with Computation in a Fresh Breeze system is carried out by method a join ticket that permits it to exercise (use) the join point. The join activations on behalf of a system user. Computation in a method point is a special entry in the local data segment of the master activation is performed by exactly one thread of instruction thread that has (1) space for a record of master thread status; and execution. The thread has access to the code segment of the (2) space for the result value that will be computed by the slave method, a local data segment, and a set of registers that hold thread. The join point includes a flag that indicates whether a intermediate results. The code segment is read-only and may be value has been entered by the slave thread, and a flag that indicates shared by many threads for different method activations. The that a join ticket has been issued. registers and local data segment are private data of the thread and A join ticket is similar to the return address of a method, and is are only accessible to it. held at a protected location in the local data segment of the slave Note that in this model of computation, a thread (method method activation. It consists of (1) the unique identifier (pointer) activation) can only access information in the heap that it creates of the local data segment of the master thread; and (2) the index of or that is given to it when it begins execution. the join point within the master thread local data segment. Special instructions are provided to access a join point. The 4. FORMS OF PARALLELISM instruction. The Spawn instruction sets a flag in the join point and Functional programming languages are known to offer better starts execution by the slave thread after storing a joint ticket in its programmer productivity due to their
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages6 Page
-
File Size-