Concurrent Programming



Similar documents
Operating Systems Principles

Mutual Exclusion using Monitors

OPERATING SYSTEMS Internais and Design Principles

PARALLEL PROGRAMMING

Real Time Programming: Concepts

ADVANCED COMPUTER ARCHITECTURE: Parallelism, Scalability, Programmability

Windows Sockets Network Programming

Chapter 18: Database System Architectures. Centralized Systems

Centralized Systems. A Centralized Computer System. Chapter 18: Database System Architectures

Genetic Algorithms in Search, Optimization, and Machine Learning

Principles and characteristics of distributed systems and environments

Lecture 6: Semaphores and Monitors

MultiMedia and Imaging Databases

Software Modeling and Verification

The Unified Software Development Process

How To Understand The Concept Of A Distributed System

A Systematic Approach. to Parallel Program Verication. Tadao TAKAOKA. Department of Computer Science. Ibaraki University. Hitachi, Ibaraki 316, JAPAN

Client/Server Computing Distributed Processing, Client/Server, and Clusters

Weighted Total Mark. Weighted Exam Mark

Formal Engineering for Industrial Software Development

Concurrent programming in Java

Synchronization. Todd C. Mowry CS 740 November 24, Topics. Locks Barriers

ML for the Working Programmer

Chapter 6, The Operating System Machine Level

Client/Server and Distributed Computing

Distributed Systems LEEC (2005/06 2º Sem.)

TCP/IP Illustrated, Volume 2 The Implementation

OPERATING SYSTEMS PROCESS SYNCHRONIZATION

C#5.0 IN A NUTSHELL. Joseph O'REILLY. Albahari and Ben Albahari. Fifth Edition. Tokyo. Sebastopol. Beijing. Cambridge. Koln.

Tools Page 1 of 13 ON PROGRAM TRANSLATION. A priori, we have two translation mechanisms available:

The Oracle Universal Server Buffer Manager

A Survey of Parallel Processing in Linux

NEURAL NETWORK FUNDAMENTALS WITH GRAPHS, ALGORITHMS, AND APPLICATIONS

Introduction. Part I: Finding Bottlenecks when Something s Wrong. Chapter 1: Performance Tuning 3

How To Make A Correct Multiprocess Program Execute Correctly On A Multiprocedor

Concepts of Concurrent Computation

CHAPTER 1: OPERATING SYSTEM FUNDAMENTALS

Programming Language Pragmatics

Parallel Computing for Data Science

Computer Organization

How To Make A Distributed System Transparent

INDUSTRIAL CONTROL TECHNOLOGY. A Handbook for Engineers and Researchers. Peng Zhang. Beijing Normal University, People's Republic of China

Completing the Big Data Ecosystem:

Distributed Systems [Fall 2012]

REAL TIME OPERATING SYSTEMS. Lesson-10:

Software Configuration Management Using Vesta

Operating Systems 4 th Class

SYSTEM ecos Embedded Configurable Operating System

Oracle Fusion Middleware

COMPUTER NETWORKS SECOND EDITION. ANDREW S.fjANENBAUM. Vrije Universiteit Amsterdam, The Netherlands. Nachrichtentechnische Bib'iothek THD Inv.

Windows8 Internals, Sixth Edition, Part 1

COMMMUNICATING COOPERATING PROCESSES

Why Computers Are Getting Slower (and what we can do about it) Rik van Riel Sr. Software Engineer, Red Hat

Introduction. What is an Operating System?

The Data Warehouse Challenge

independent systems in constant communication what they are, why we care, how they work

How To Understand The Power Of Zab In Zookeeper

Computing Concepts with Java Essentials

Microsoft Windows Internals, Fourth Edition: Microsoft Windows Server 2003, Windows XR and Windows 2000

Far-western University Central Office, Mahendranagar Operating System

Chapter 13 Embedded Operating Systems

Parallel Databases. Parallel Architectures. Parallelism Terminology 1/4/2015. Increase performance by performing operations in parallel

Cisco. A Beginner's Guide Fifth Edition ANTHONY T. VELTE TOBY J. VELTE. City Milan New Delhi Singapore Sydney Toronto. Mc Graw Hill Education

Principles of Distributed Database Systems

Verifying Semantic of System Composition for an Aspect-Oriented Approach

Cloud Computing. Theory and Practice. Dan C. Marinescu. Morgan Kaufmann is an imprint of Elsevier HEIDELBERG LONDON AMSTERDAM BOSTON

INF5140: Specification and Verification of Parallel Systems

Hagit Attiya and Eshcar Hillel. Computer Science Department Technion

Programma della seconda parte del corso

CHAPTER 2 MODELLING FOR DISTRIBUTED NETWORK SYSTEMS: THE CLIENT- SERVER MODEL

A Comparison of Distributed Systems: ChorusOS and Amoeba

Master Degree Program in Computer Science (CS)

Last Class: Semaphores

Operating Systems for Parallel Processing Assistent Lecturer Alecu Felician Economic Informatics Department Academy of Economic Studies Bucharest

Fundamentals of Mobile and Pervasive Computing

Fine-Grained Multiprocessor Real-Time Locking with Improved Blocking

Effective Computing with SMP Linux

Contents. 1 Introduction. 2 Feature List. 3 Feature Interaction Matrix. 4 Feature Interactions

How To Write A Program Verification And Programming Book

Dr Markus Hagenbuchner CSCI319. Distributed Systems

SWARM: A Parallel Programming Framework for Multicore Processors. David A. Bader, Varun N. Kanade and Kamesh Madduri

Computer Science 4302 Operating Systems. Student Learning Outcomes

Design Patterns in C++

Model Checking: An Introduction

Formal Verification of Software

Middleware and Distributed Systems. Introduction. Dr. Martin v. Löwis

Kernel Synchronization and Interrupt Handling

Unit 6: Conditions, Barriers, and RendezVous

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Lecture 4. Parallel Programming II. Homework & Reading. Page 1. Projects handout On Friday Form teams, groups of two

THE UNIVERSITY OF AUCKLAND

COS 318: Operating Systems. Virtual Machine Monitors

Hadoop: The Definitive Guide

Outline of this lecture G52CON: Concepts of Concurrency

SIMERO Software System Design and Implementation

Chapter 11 I/O Management and Disk Scheduling

Networking. Sixth Edition. A Beginner's Guide BRUCE HALLBERG

Processes and Non-Preemptive Scheduling. Otto J. Anshus

AIX 5L NFS Client Performance Improvements for Databases on NAS

Transcription:

Concurrent Programming Principles and Practice Gregory R. Andrews The University of Arizona Technische Hochschule Darmstadt FACHBEREICH INFCRMATIK BIBLIOTHEK Inventar-Nr.:..ZP.vAh... Sachgebiete:..?r.:..\). Standort: The Benjamin/Cummings Publishing Company, Inc. Redwood City, California Menlo Park, California Reading, Massachusetts New York Don Mills, Ontario Wokingham, U.K. Amsterdam Bonn Sydney Singapore Tokyo Madrid San Juan

Contents Part I Basic Concepts 1 Hardware and Applications; Synchronization; Program Properties Chapter 1 Sequential Programming 7 1.1 Language Notation 7 Declarations; Statements; Procedures 1.2 Logic, Propositions, and Predicates 14 Formal Logical Systems; Propositions; Predicates 1.3 A Programming Logic 23 Axioms; Inference Rules 1.4 Proofs in Programming Logic 31 Proof Outlines; Equivalence and Simulation 1.5 Program Derivation 36 Weakest Preconditions; Weakest Preconditions of Statements; Linear Search Revisited; Sorting Historical Notes and References 47 Exercises 49 Chapter 2 Concurrency and Synchronization 57 2.1 Specifying Concurrent Execution 57 2.2 Atomic Actions and Synchronization 59 Fine-Grained Atomicity; Specifying Synchronization 2.3 Semantics of Concurrent Execution 64 xi

Xll 2.4 Techniques for Avoiding Interference 67 Disjoint Variables; Weakened Assertions; Global Invariants; Synchronization 2.5 Auxiliary Variables 78 2.6 Safety and Liveness Properties 81 Proving Safety Properties; Scheduling Policies and Fairness Historical Notes and References 86 Exercises 89 Part II Shared Variables 95 Chapter 3 Fine-Grained Synchronization 97 3.1 The Critical Section Problem 98 A Coarse-Grained Solution; Spin Locks: A Fine-Grained Solution; Implementing Await Statements 3.2 Critical Sections: Tie-Breaker Algorithm 107 A Coarse-Grained Solution; A Fine-Grained Solution; An iv-process Solution 3.3 Critical Sections: Ticket Algorithm 112 Coarse-Grained Solution; Fine-Grained Solutions 3.4 Critical Sections: Bakery Algorithm 115 Coarse-Grained Solution; A Fine-Grained Solution 3.5 Barrier Synchronization 120 Shared Counter; Flags and Coordinators; Symmetric Barriers 3.6 Data Parallel Algorithms 127 Parallel Prefix Computations; Operations on Linked Lists; Grid Computations; Synchronous Multiprocessors 3.7 On-The-Fly Garbage Collection 134 Problem Specification; Solution Outline; A Coarse-Grained Solution; A Fine-Grained Solution 3.8 Implementing Processes 146 A Single-Processor Kernel; A Multiprocessor Kernel Historical Notes and References 155 Exercises 159

Contents xiii Chapter 4 Semaphores 171 4.1 Notation and Semantics 172 4.2 Basic Uses and Programming Techniques 175 Critical Sections: Changing Variables; Barriers: Signaling Events; Producers and Consumers: Split Binary Semaphores; Bounded Buffers: Resource Counting 4.3 Selective Mutual Exclusion 189 Dining Philosophers; Readers and Writers 4.4 General Condition Synchronization 197 Readers and Writers Revisited; The Technique of Passing the Baton; Readers and Writers Solution; Alternative Scheduling Policies 4.5 Resource Allocation 204 Problem Definition and General Solution Pattern; Shortest-Job-Next Allocation 4.6 Implementation 210 Historical Notes and References 212 Exercises 214 Chapter 5 Conditional Critical Regions 225 5.1 Notation and Semantics 226 Examples; Inference Rules; Safety and Liveness Properties 5.2 Dining Philosophers Revisited 232 5.3 Readers/Writers Revisited 235 Readers' Preference Solution; Writers' Preference Solution 5.4 Interprocess Communication 238 Bounded Buffer With Exclusive Access; Bounded Buffer With Concurrent Access 5.5 Scheduling and Resource Allocation 242 5.6 Implementations 245 Using Busy Waiting; Using Semaphores with Passing the Baton; Using Semaphores with Rem's Algorithm; Using a Kernel Historical Notes and References 254 Exercises 255

XIV Chapter 6 Monitors 263 6.1 Programming Notation 264 Synchronization in Monitors; Additional Operations on Condition Variables 6.2 Formal Semantics and Program Proofs 271 Axioms and Proof Obligations; A Procedure Call Inference Rule; Safety and Liveness Properties; An Example: Readers and Writers 6.3 Synchronization Techniques 283 Interval Timer: Covering Conditions and Priority Wait; A Fair Semaphore: Passing the Condition; The Sleeping Barber Problem: Rendezvous 6.4 Disk Scheduling: Program Structures 295 Scheduler as a Separate Monitor; Scheduler as an Intermediary 6.5 Alternative Approaches to Synchronization 305 Alternative Signaling Disciplines; Equivalence of the Signaling Disciplines; Differences Between the Signaling Disciplines; Alternatives to Mutual Exclusion; Path Expressions 6.6 Implementations 319 Using Semaphores; Using a Kernel Historical Notes and References 325 Exercises 329 Part III Message Passing 339 Chapter 7 Asynchronous Message Passing 343 7.1 Programming Notation 344 7.2 Formal Semantics 346 Axioms and Satisfaction Proofs; Auxiliary Variables and Non-interference; An Example; Safety and Liveness Properties 7.3 Filters: A Sorting Network 355

Contents XV 7.4 Clients and Servers 359 Active Monitors; A Self-Scheduling Disk Driver; File Servers: Conversational Continuity 7.5 Heartbeat Algorithms 370 Network Topology: Shared-Variable Solution; Network Topology: Distributed Solution 7.6 Probe/Echo Algorithms 376 Broadcast in a Network; Network Topology Revisited 7.7 Broadcast Algorithms 383 Logical Clocks and Event Ordering; Distributed Semaphores 7.8 Token-Passing Algorithms 388 Distributed Mutual Exclusion; Termination Detection in a Ring; Termination Detection in a Graph 7.9 Replicated Servers 396 Replicated Files; Replicated Workers: Adaptive Quadrature 7.10 Implementations 402 Shared-Memory Kernel; Distributed Kernel Historical Notes and References 410 Exercises 415 Chapter 8 Synchronous Message Passing 423 8.1 Programming Notation 424 Communication Statements; Guarded Communication 8.2 Formal Semantics 429 Axioms, Inference Rules, and Satisfaction Proofs; Auxiliary Variables and Non-interference; An Example; Safety and Liveness Properties 8.3 Networks of Filters 439 Prime Number Generation: The Sieve of Eratosthenes; Matrix/Vector Multiplication 8.4 Interacting Parallel Processes 443 Parallel Sorting: A Heartbeat Algorithm; Parallel Prefix Computations; Matrix Multiplication: Broadcast Algorithm; Matrix Multiplication: Heartbeat Algorithm

XVI 8.5 Clients and Servers 453 Resource Allocation; File Servers and Conversational Continuity; Centralized Dining Philosophers; Decentralized Dining Philosophers 8.6 Implementations 460 Centralized Clearing House; Decentralized Implementations Historical Notes and References 472 Exercises 474 Chapter 9 RPC and Rendezvous 483 9.1 Remote Procedure Call 484 Synchronization in Modules; A Time Server; Caches in a Distributed File System; A Sorting Network of Merge Filters; Formal Semantics 9.2 Rendezvous 494 Client/Server Examples; A Sorting Network of Merge Filters; Formal Semantics; An Example Proof; Safety and Liveness Properties 9.3 A Multiple Primitives Notation 509 Invoking and Servicing Operations; Examples; Formal Semantics 9.4 Clients and Servers 515 Readers/Writers Revisited: Encapsulated Access; Replicated Files; Network Topology Using Probe/Echo Algorithms 9.5 Parallel Algorithms 522 Region Labeling: A Heartbeat Algorithm; The Traveling Salesman Problem: Replicated Workers 9.6 Implementations 529 RPC in a Kernel; Rendezvous Using Asynchronous Message Passing; Multiple Primitives in a Kernel Historical Notes and References 540 Exercises 543

Contents xvii Part IV Practice 551 Chapter 10 Language Overviews 553 10.1 Turing Plus: Monitors 555 Program Structure; Process Interaction; Example: File Difference Checker 10.2 Occam: Synchronous Message Passing 561 Program Structure; Sequential and Parallel Constructors; Communication and Synchronization; Example: Prime Number Sieve 10.3 Ada: Rendezvous 567 Program Components; Communication and Synchronization; Example: The Dining Philosophers 10.4 SR: Multiple Primitives 575 Program Components; Communication and Synchronization; "- Example: The Traveling Salesman Problem 10.5 Linda: Distributed Data Structures 581 Tuple Space and Process Interaction; Example: Prime Numbers with Replicated Workers 10.6 Comparison and Performance 588 Performance Experiments; Interpretation of Results Historical Notes and References 593 Exercises 598 Glossary 603 Bibliography 607 Index 627