37"} Semaphore Solutions for General Mutual Exclusion

37"} Semaphore Solutions for General Mutual Exclusion

37"} M8/J. SEMAPHORE SOLUTIONS FOR GENERAL MUTUAL EXCLUSION PROBLEMS DISSERTATION Presented to the Graduate Council of the University of North Texas in Partial Fulfillment of the Requirements For the Degree of DOCTOR OF PHILOSOPHY By Kwok B. Yue, B.Sc., M.Phil., M.Sc., Denton, Texas August, 1988 Yue, Kwok B., Semaphore Solutions for General Mutual Exclusion Problems. Doctor of Philosophy (Computer Science), August, 1988, 181 pp., 40 illustrations, bibliography, 50 titles. Automatic generation of starvation-free semaphore solutions to general mutual exclusion problems is discussed. A reduction approach is introduced for recognizing edge-solvable problems, together with an 0(N2) algorithm for graph reduction, where N is the number of nodes. An algorithm for the automatic generation of starvation-free edge-solvable solutions is presented. The solutions are proved to be very efficient. For general problems, there are two ways to generate efficient solutions. One associates a semaphore with every node, the other with every edge. They are both better than the standard monitor—like solutions. Besides strong semaphores, solutions using weak semaphores, weaker semaphores and generalized semaphores are also considered. Basic properties of semaphore solutions are also discussed. Tools describing the dynamic behavior of parallel systems, as well as performance criteria for evaluating semaphore solutions are elaborated. TABLE OF CONTENTS Page LIST OF ILLUSTRATIONS Chapter 1. INTRODUCTION General Mutual Exclusion Problems Semaphores Assumptions and Requirements of Solutions System States Organization of the Dissertation 2. BASIC THEORY 27 Some Properties of Semaphore Solutions Severe Blocking and PV-Block Solutions Control Disciplines Critical Sets and Blocking Sets More on Blocking Sets Other Performance Criteria 3. EDGE-SOLVABLE PROBLEMS g7 Reduction Reducibility Optimal Graphs The PS and PPS Macros Starvation-Free Solutions Properties of Algorithm 3.1 4. AN INCREMENTAL ALGORITHM FOR GRAPH REDUCTION g7 Introduction The Incremental Algorithm Correctness of the Algorithm Properties and Discussion in Page 5. GENERAL MUTUAL EXCLUSION PROBLEMS 117 Edge-Associated Synchronizers Edge-Associated Solutions Properties of Edge-Associated Solutions Node-Associated Synchronizers Node-Associated Solutions Properties of Node-Associated Solutions 6. WEAK AND WEAKER SEMAPHORES 146 Edge-Associated Weak Semaphore Solutions Edge-Associated Weaker Semaphore Solutions An Extension of Morris's Algorithm 7. GENERALIZED SEMAPHORES 160 Node-Associated PVC Solution Node-Associated PV™ Solution Node-Associated PVc, Solution 8. CONCLUSION 174 BIBLIOGRAPHY . 178 IV LIST OF ILLUSTRATIONS Figure Page 1.1 The mutual exclusion graphs for problems of Examples 1.1 to 1.4 7 1.2 A deadlock-possible ME-synchronizer for the Dining Philosophers Problem 14 1.3 A starvation-possible synchronizer for the Readers and Writers Problem 17 2.1 A semaphore synchronizer implementing the first starvation-free discipline 40 2.2 A starvation-free solution for the Readers and Writers Problem 43 2.3 A graph G . 44 2.4 The starvation—free solution generated by Algorithm 2.1 for the graph G in Figure 2.3 45 2.5 A mutual exclusion graph G 49 2.6 A solution for the graph G in Figure 2.5 ... 50 2.7 Critical sets and blocking sets of the solution of Figure 2.6 51 2.8 A synchronizer for the graph G 53 2.9 The sure-blocking sets and possible-blocking sets of the solution S of Figure 2.6 54 2.10 A deadlock-free solution for the Dining Philosophers Problem 57 2.11 Sure-blocking sets of the deadlock-possible synchronizer of Figure 1.2 for the Dining Philosophers Problem 58 2.12 Another deadlock-free solution for the Dining Philosophers Problem 59 Figure Page 2.13 The sure-blocking sets of the solution of Figure 2.12 for the Dining Philosophers Problem gQ 2.14 Another deadlock-possible synchronizer for the Dining Philosophers Problem 6i 2.15 Sure-blocking sets of the synchronizer of Figure 2.14 g2 3.1 The descriptor trees of the three composite nodes of Example 3.1 74 3.2 A non-optimal descriptor tree and its equivalent optimal descriptor tree 80 3.3 A starvation-free solution for the Readers and Writers Problem 02 3.4 A starvation-free solution for the Generalized Readers and Writers Problem .... 83 3.5 A graph G g7 3.6 The descriptor tree and string of the graph G 3.7 Code generated for the nodes of the descriptor tree T by Algorithm 3.1 88 4.1 Different types of nodes as related to p ... 112 4.2 The connection of nodes in wA to p 113 5.1 A mutual exclusion graph G 119 5.2 A starvation-free edge-associated semaphore solution for the graph G of Figure 5.1 120 5.3 An edge-solvable solution for the Three Readers and Two Writers Problem 12 9 5.4 A node-associated synchronizer for the graph G of Figure 5.1 vi Figure Page 5.5 A synchronizer for the graph G of Figure 5.1 that does not satisfy the minimum exclusion constraint 136 5.6 A node-associated solution for the Three Readers and Two Writers Problem 142 5.7 An edge-solvable solution generated by Algorithm 3.1 for the graph of Example 5.10 . 144 6.1 An edge—associated weaker semaphore solution generated by Algorithm 6.1 for the graph G of Figure 5.1 6.2 Equivalent strong and weak semaphore macros . 155 7.1 pvc solutions generated by Algorithm 7 1 for the graph G of Figure 5.1 7.2 The blocking sets of the solution of Figure 7.1 166 7.3 PVm solutions generated by Algorithm 7.2 for the graph G of Figure 5.1 169 7.4 PVg- solutions generated by Algorithm 7.3 for the graph G of Figure 5.1 Vll CHAPTER 1 INTRODUCTION The mutual exclusion problem is a classical problem in the parallel programming paradigm. Among the many synchronization primitives designed to coordinate concurrent processes [3,4,8,9,15,17,18], the semaphore is one of the most common. Since its introduction by Dijkstra in the sixties, there have been a number of articles discussing it [13,14,25]. However, a thorough analysis of what mutual exclusion problems the semaphore can solve, and how to solve them, is unavailable. This dissertation tries to address them. There are several reasons for investigating semaphore solutions for mutual exclusion problems. (1) The semaphore is a well-known primitive which is treated in most operating system textbooks [5,7,11,22], so there is theoretical interest about which mutual exclusion problems can be solved by semaphores. (2) Most high level synchronization primitives, such as the monitor, the critical region and Ada's rendezvous, can be implemented by semaphores. (3) There are still many systems, such as the Cray X-MP [20] and the Sequent Balance Series [24], using semaphores as their main synchronization primitive. (4) As the technology of parallel processing becomes more mature, many sequential solutions will give way to faster, and sometimes more natural, parallel solutions. Many such problems can be modeled by general mutual exclusion problems. (5) There is, so far, no automatic way for generating solutions for mutual exclusion problems, with the exception of [12,26]. Each specific problem needs to be analyzed individually. (6) Although there are solutions for some specific problems, there is no analysis of their performance. It is difficult to compare the efficiency of different solutions. In the remainder of Chapter 1, general mutual exclusion problems and their graphical representations are discussed. This is followed by a description of the requirements and assumptions for semaphore solutions. A technique for describing the state of a parallel system, which will be used throughout the dissertation, is then elaborated. General Mutual Exclusion Problems There has been much discussion of some special mutual exclusion problems, but little of general problems [16,21]. A general mutual exclusion problem contains a number of concurrent processes, each containing a critical section, which may be mutually exclusive to one or more critical sections of other processes, but not necessarily to all. Many problems can be modeled by a collection of parallel processes and mutual exclusion constraints. Some examples are given below. The symbol [] is used to denote the end of each example, as well as other examples, definitions and proofs throughout the dissertation. Example 1.1 A Simple Bank Application Problem. Consider a simple bank account containing two pieces of information, an interest rate and a balance. Four possible functions on the account are (1) change the interest rate, (2) calculate the interest earned, (3) make a deposit, and (4) make a withdrawal. If we implement these functions in the critical sections of four concurrent processes a, b, c and d respectively, we arrive at a general mutual exclusion problem with the following mutual exclusion constraints. Note that whenever we say that processes p and q are mutually exclusive, we actually mean that their critical sections are mutually exclusive. (1) Process a is mutually exclusive to process b. (2) Process b is mutually exclusive to processes a, c and d. (3) Process c is mutually exclusive to processes b and d. (4) Process d is mutually exclusive to processes b and c. [] The following three problems are discussed in most operating system textbooks. Example 1.2 The Simple (Complete) Mutual Exclusion Problem. In the Simple Mutual Exclusion Problem (also known as the Complete Graph Problem), each process is mutually exclusive to all other processes. [] Example 1.3 The Readers and Writers Problem. In the Readers and Writers Problem, a Writer process is mutually exclusive to all other processes and a Reader process is mutually exclusive to all Writer processes, but not to other Reader processes.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    188 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us