0% found this document useful (0 votes)
22 views

Concurrent Programming Algorithms Principles and Foundations 1st Edition Michel Raynal - The full ebook version is just one click away

The document is about the book 'Concurrent Programming: Algorithms, Principles, and Foundations' by Michel Raynal, which focuses on synchronization and the implementation of concurrent objects in computing. It covers various topics including lock-based synchronization, the mutual exclusion problem, and the foundations of concurrent programming, aimed at students and practitioners in computer science. The book is structured into six parts, detailing both theoretical and practical aspects of concurrent programming and synchronization mechanisms.

Uploaded by

goglikbendl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Concurrent Programming Algorithms Principles and Foundations 1st Edition Michel Raynal - The full ebook version is just one click away

The document is about the book 'Concurrent Programming: Algorithms, Principles, and Foundations' by Michel Raynal, which focuses on synchronization and the implementation of concurrent objects in computing. It covers various topics including lock-based synchronization, the mutual exclusion problem, and the foundations of concurrent programming, aimed at students and practitioners in computer science. The book is structured into six parts, detailing both theoretical and practical aspects of concurrent programming and synchronization mechanisms.

Uploaded by

goglikbendl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Read Anytime Anywhere Easy Ebook Downloads at ebookmeta.

com

Concurrent Programming Algorithms Principles and


Foundations 1st Edition Michel Raynal

https://ebookmeta.com/product/concurrent-programming-
algorithms-principles-and-foundations-1st-edition-michel-
raynal/

OR CLICK HERE

DOWLOAD EBOOK

Visit and Get More Ebook Downloads Instantly at https://ebookmeta.com


Concurrent Programming:

Algorithms, Principles, and Foundations

Michel Raynal

Concurrent Programming:

Algorithms, Principles,

and Foundations

123

Michel Raynal

Institut Universitaire de France

IRISA-ISTIC

Université de Rennes 1

Rennes Cedex

France

ISBN 978-3-642-32026-2

ISBN 978-3-642-32027-9

(eBook)

DOI 10.1007/978-3-642-32027-9

Springer Heidelberg New York Dordrecht London

Library of Congress Control Number: 2012944394


ACM Computing Classification (1998): F.1, D.1, B.3

Springer-Verlag Berlin Heidelberg 2013

This work is subject to copyright. All rights are reserved by the


Publisher, whether the whole or part of the material is concerned,
specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other
physical way, and transmission or information storage and retrieval,
electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed. Exempted from
this legal reservation are brief excerpts in connection with reviews or
scholarly analysis or material supplied specifically for the purpose of
being entered and executed on a computer system, for exclusive use
by the purchaser of the work. Duplication of this publication or parts
thereof is permitted only under the provisions of the Copyright Law
of the Publisher’s location, in its current version, and permission for
use must always be obtained from Springer. Permissions for use may
be obtained through RightsLink at the Copyright Clearance Center.
Violations are liable to prosecution under the respective Copyright
Law.

The use of general descriptive names, registered names,


trademarks, service marks, etc. in this publication does not imply,
even in the absence of a specific statement, that such names are
exempt from the relevant protective laws and regulations and
therefore free for general use.

While the advice and information in this book are believed to be true
and accurate at the date of publication, neither the authors nor the
editors nor the publisher can accept any legal responsibility for any
errors or omissions that may be made. The publisher makes no
warranty, express or implied, with respect to the material contained
herein.

Printed on acid-free paper


Springer is part of Springer Science+Business Media
(www.springer.com)

Preface

As long as the grass grows and the rivers flow….

From American Indians

Homo sum: humani nihil a me alienum puto.

In Heautontimoroumenos, Publius Terencius (194–129 BC)

… Ce jour-là j’ai bien cru tenir quelque chose et que ma vie s’en
trouverait changée.

Mais rien de cette nature n’est définitivement acquis.

Comme une eau, le monde vous traverse et pour un temps vous


prête ses couleurs.

Puis se retire et vous replace devant ce vide qu’on porte en soi,


devant cette espèce d’insuffisance centrale de l’âme qu’il faut bien
apprendre à co

ˆ toyer, à combattre,

et qui, paradoxalement, est peut-être notre moteur le plus sûr.

In L’usage du monde (1963), Nicolas Bouvier (1929–1998)

vi

Preface

What synchronization is
A concurrent program is a program made up of several entities
(processes, peers, sensors, nodes, etc.) that cooperate to a common
goal. This cooperation is made

possible thanks to objects shared by the entities. These objects are


called con-

current objects. Let us observe that a concurrent object can be seen


as abstracting a service shared by clients (namely, the cooperating
entities).

A fundamental issue of computing science and computing


engineering consists

in the design and the implementation of concurrent objects. In order


that concurrent objects remain always consistent, the entities have
to synchronize their accesses to these objects. Ensuring correct
synchronization among a set of cooperating entities is far from being
a trivial task. We are no longer in the world of sequential

programming, and the approaches and methods used in sequential


computing are of

little help when one has to design concurrent programs. Concurrent


programming

requires not only great care but also knowledge of its scientific
foundations.

Moreover, concurrent programming becomes particularly difficult


when one has to

cope with failures of cooperating entities or concurrent objects.

Why this book?


Since the early work of E.W. Dijkstra (1965), who introduced the
mutual exclu-

sion problem, the concept of a process, the semaphore object, the


notion of a

weakest precondition, and guarded commands (among many other


contributions),

synchronization is no longer a catalog of tricks but a domain of


computing science with its own concepts, mechanisms, and
techniques whose results can be applied in many domains. This
means that process synchronization has to be a major topic of any
computer science curriculum.

This book is on synchronization and the implementation of


concurrent objects.

It presents in a uniform and comprehensive way the major results


that have been

produced and investigated in the past 30 years and have proved to


be useful from both theoretical and practical points of view. The
book has been written first for people who are not familiar with the
topic and the concepts that are presented.

These include mainly:

• Senior-level undergraduate students and graduate students in


computer science

or computer engineering, and graduate students in mathematics


who are inter-

ested in the foundations of process synchronization.


• Practitioners and engineers who want to be aware of the state-of-
the-art concepts, basic principles, mechanisms, and techniques
encountered in concurrent

programming and in the design of concurrent objects suited to


shared memory

systems.

Preface

vii

Prerequisites for this book include undergraduate courses on


algorithms and

base knowledge on operating systems. Selections of chapters for


undergraduate

and graduate courses are suggested in the section titled ‘‘How to


Use This Book’’

in the Afterword.

Content

As stressed by its title, this book is on algorithms, base principles,


and foundations of concurrent objects and synchronization in shared
memory systems, i.e., systems where the entities communicate by
reading and writing a common memory. (Such

a corpus of knowledge is becoming more and more important with


the advent of

new technologies such as multicore architectures.)

The book is composed of six parts. Three parts are more focused on
base
synchronization mechanisms and the construction of concurrent
objects, while the other three parts are more focused on the
foundations of synchronization. (A

noteworthy feature of the book is that nearly all the algorithms that
are presented are proved.)

• Part I is on lock-based synchronization, i.e., on well-known


synchronization

concepts, techniques, and mechanisms. It defines the most


important synchro-

nization problem in reliable asynchronous systems, namely the


mutual exclusion

problem (Chap. 1). It then presents several base approaches which


have been proposed to solve it with machine-level instructions
(Chap. 2). It also presents traditional approaches which have been
proposed at a higher abstraction level to solve synchronization
problems and implement concurrent objects, namely the

concept of a semaphore and, at an even more abstract level, the


concepts of

monitor and path expression (Chap. 3).

• After the reader has become familiar with base concepts and
mechanisms suited

to classical synchronization in reliable systems, Part II, which is


made up of a single chapter, addresses a fundamental concept of
synchronization; namely, it

presents and investigates the concept of atomicity and its properties.


This allows for the formalization of the notion of a correct execution
of a concurrent program in which processes cooperate by accessing
shared objects (Chap. 4).

• Part I has implicitly assumed that the cooperating processes do not


fail. Hence, the question: What does happen when cooperating
entities fail? This is the main

issue addressed in Part III (and all the rest of the book); namely, it
considers that cooperating entities can halt prematurely (crash
failure). To face the net effect of asynchrony and failures, it
introduces the notions of mutex-freedom and associated progress
conditions such as obstruction-freedom, non-blocking, and wait-

freedom (Chap. 5).

viii

Preface

The rest of Part III focuses on hybrid concurrent objects (Chap. 6),
wait-free implementations of paradigmatic concurrent objects such
as counters and store-collect objects (Chap. 7), snapshot objects
(Chap. 8), and renaming objects

(Chap. 9).

• Part IV, which is made up of a single chapter, is on software


transactional

memory systems. This is a relatively new approach whose aim is to


simplify the

job of programmers of concurrent applications. The idea is that


programmers

have to focus their efforts on which parts of their multiprocess


programs have to be executed atomically and not on the way
atomicity has to be realized (Chap. 10).

• Part V returns to the foundations side. It shows how reliable


atomic read/write registers (shared variables) can be built from non-
atomic bits. This part consists of three chapters. Chapter 11
introduces the notions of safe register, regular register, and atomic
register. Then, Chap. 12 shows how to build an atomic bit from a
safe bit. Finally, Chap. 13 shows how an atomic register of any size
can be built from safe and atomic bits.

This part shows that, while atomic read/write registers are easier to
use than safe read/write registers, they are not more powerful from
a computability point-of-view.

• Part VI, which concerns also the foundations side, is on the


computational

power of concurrent objects. It is made up of four chapters. It first


introduces the notion of a consensus object and shows that
consensus objects are universal

objects (Chap. 14). This means that, as soon as a system provides


us with atomic read/write registers and consensus objects, it is
possible to implement in a wait-free manner any object defined from
a sequential specification.

Part VI then introduces the notion of self-implementation and shows


how atomic

registers and consensus objects can be built from base objects of


the same type

which are not reliable (Chap. 15). Then, it presents the notion of a
consensus number and the associated consensus hierarchy which
allows the computability
power of concurrent objects to be ranked (Chap. 16). Finally, the last
chapter of the book focuses on the wait-free implementation of
consensus objects from

read/write registers and failure detectors (Chap. 17).

To have a more complete feeling of the spirit of this book, the reader
can also

consult the section ‘‘What Was the Aim of This Book’’ in the
Afterword) which

describes what it is hoped has been learned from this book. Each
chapter starts

with a short presentation of its content and a list of keywords; it


terminates with a summary of the main points that have explained
and developed. Each of the six

parts of the book is also introduced by a brief description of its aim


and its

technical content.

Preface

ix

Acknowledgments

This book originates from lecture notes for undergraduate and


graduate courses on process synchronization that I give at the
University of Rennes (France) and, as an invited professor, at several
universities all over the world. I would like to thank the students for
their questions that, in one way or another, have contributed to this
book.
I want to thank my colleagues Armando Castañeda (UNAM, MX),
Ajoy Datta

(UNLV, Nevada), Achour Mostéfaoui (Université de Nantes), and


François Taiani

(Lancaster University, UK) for their careful reading of chapters of this


book.

Thanks also to François Bonnet (JAIST, Kanazawa), Eli Gafni (UCLA),


Damien

Imbs (IRISA, Rennes), Segio Rajsbaum (UNAM, MX), Matthieu Roy


(LAAS,

Toulouse), and Corentin Travers (LABRI, Bordeaux) for long


discussions on wait-

freedom. Special thanks are due to Rachid Guerraoui (EPFL), with


whom I dis-

cussed numerous topics presented in this book (and many other


topics) during the past seven years. I would also like to thank Ph.
Louarn (IRISA, Rennes) who was

my Latex man when writing this book, and Ronan Nugent (Springer)
for his

support and his help in putting it all together.

Last but not least (and maybe most importantly), I also want to
thank all the

researchers whose results are presented in this book. Without their


work, this book would not exist (Since I typeset the entire text
myself (–

for the text and xfig


for figures–), any typesetting or technical errors that remain are my
responsibility.) Michel Raynal

Professeur des Universités

Institut Universitaire de France

IRISA-ISTIC, Université de Rennes 1

Campus de Beaulieu, 35042 Rennes, France

September–November 2005 and June–October 2011

Rennes, Mont-Louis (ARCHI’11), Gdanśk (SIROCCO’11), Saint-


Philibert,

Hong Kong (PolyU), Macau, Roma (DISC’11), Tirana (NBIS’11),

Grenoble (SSS’11), Saint-Grégoire, Douelle, Mexico City (UNAM).

Contents

Part I

Lock-Based Synchronization

The Mutual Exclusion Problem. . . . . . . . . . . . . . . . . . . . . . . . . .

1.1

Multiprocess Program . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.1.1
The Concept of a Sequential Process. . . . . . . . . . . .

1.1.2

The Concept of a Multiprocess Program . . . . . . . . .

1.2

Process Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . .

1.2.1

Processors and Processes . . . . . . . . . . . . . . . . . . . .

1.2.2

Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . .

1.2.3

Synchronization: Competition. . . . . . . . . . . . . . . . .

1.2.4

Synchronization: Cooperation . . . . . . . . . . . . . . . . .

7
1.2.5

The Aim of Synchronization

Is to Preserve Invariants . . . . . . . . . . . . . . . . . . . .

1.3

The Mutual Exclusion Problem . . . . . . . . . . . . . . . . . . . . .

1.3.1

The Mutual Exclusion Problem (Mutex) . . . . . . . . .

1.3.2

Lock Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

1.3.3

Three Families of Solutions . . . . . . . . . . . . . . . . . .

12

1.4

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

13

1.5
Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

13

Solving Mutual Exclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

2.1

Mutex Based on Atomic Read/Write Registers . . . . . . . . . . .

15

2.1.1

Atomic Register . . . . . . . . . . . . . . . . . . . . . . . . . .

15

2.1.2

Mutex for Two Processes:

An Incremental Construction . . . . . . . . . . . . . . . . .

17

2.1.3

A Two-Process Algorithm . . . . . . . . . . . . . . . . . . .

19

2.1.4

Mutex for n Processes:


Generalizing the Previous Two-Process Algorithm. . .

22

2.1.5

Mutex for n Processes:

A Tournament-Based Algorithm . . . . . . . . . . . . . . .

26

2.1.6

A Concurrency-Abortable Algorithm. . . . . . . . . . . .

29

xi

xii

Contents

2.1.7

A Fast Mutex Algorithm . . . . . . . . . . . . . . . . . . . .

33

2.1.8

Mutual Exclusion in a Synchronous System . . . . . . .

37

2.2

Mutex Based on Specialized Hardware Primitives . . . . . . . .


38

2.2.1

Test&Set, Swap and Compare&Swap . . . . . . . . . . .

39

2.2.2

From Deadlock-Freedom to Starvation-Freedom . . . .

40

2.2.3

Fetch&Add . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

44

2.3

Mutex Without Atomicity . . . . . . . . . . . . . . . . . . . . . . . . .

45

2.3.1

Safe, Regular and Atomic Registers . . . . . . . . . . . .

45

2.3.2

The Bakery Mutex Algorithm . . . . . . . . . . . . . . . .

48

2.3.3
A Bounded Mutex Algorithm . . . . . . . . . . . . . . . . .

53

2.4

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

58

2.5

Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

58

2.6

Exercises and Problems . . . . . . . . . . . . . . . . . . . . . . . . . . .

59

Lock-Based Concurrent Objects . . . . . . . . . . . . . . . . . . . . . . . . .

61

3.1

Concurrent Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

61

3.1.1

Concurrent Object. . . . . . . . . . . . . . . . . . . . . . . . .

61
3.1.2

Lock-Based Implementation . . . . . . . . . . . . . . . . . .

62

3.2

A Base Synchronization Object: the Semaphore . . . . . . . . . .

63

3.2.1

The Concept of a Semaphore . . . . . . . . . . . . . . . . .

63

3.2.2

Using Semaphores to Solve

the Producer-Consumer Problem. . . . . . . . . . . . . . .

65

3.2.3

Using Semaphores to Solve

a Priority Scheduling Problem . . . . . . . . . . . . . . . .

71

3.2.4

Using Semaphores to Solve

the Readers-Writers Problem . . . . . . . . . . . . . . . . .


74

3.2.5

Using a Buffer to Reduce Delays

for Readers and Writers. . . . . . . . . . . . . . . . . . . . .

78

3.3

A Construct for Imperative Languages: the Monitor . . . . . . .

81

3.3.1

The Concept of a Monitor . . . . . . . . . . . . . . . . . . .

82

3.3.2

A Rendezvous Monitor Object . . . . . . . . . . . . . . . .

83

3.3.3

Monitors and Predicates. . . . . . . . . . . . . . . . . . . . .

85

3.3.4

Implementing a Monitor from Semaphores . . . . . . .

87
3.3.5

Monitors for the Readers-Writers Problem . . . . . . . .

89

3.3.6

Scheduled Wait Operation . . . . . . . . . . . . . . . . . . .

94

3.4

Declarative Synchronization: Path Expressions . . . . . . . . . . .

95

3.4.1

Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

96

3.4.2

Using Path Expressions to Solve

Synchronization Problems . . . . . . . . . . . . . . . . . . .

97

3.4.3

A Semaphore-Based Implementation

of Path Expressions. . . . . . . . . . . . . . . . . . . . . . . .

98
3.5

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

101

3.6

Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

102

3.7

Exercises and Problems . . . . . . . . . . . . . . . . . . . . . . . . . . .

102

Contents

xiii

Part II

On the Foundations Side: The Atomicity Concept

Atomicity: Formal Definition and Properties . . . . . . . . . . . . . . . .

113

4.1

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

113

4.2
Computation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

115

4.2.1

Processes and Operations . . . . . . . . . . . . . . . . . . . .

115

4.2.2

Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

116

4.2.3

Histories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

117

4.2.4

Sequential History. . . . . . . . . . . . . . . . . . . . . . . . .

119

4.3

Atomicity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

120

4.3.1

Legal History . . . . . . . . . . . . . . . . . . . . . . . . . . . .

120
4.3.2

The Case of Complete Histories . . . . . . . . . . . . . . .

121

4.3.3

The Case of Partial Histories . . . . . . . . . . . . . . . . .

123

4.4

Object Composability and Guaranteed

Termination Property . . . . . . . . . . . . . . . . . . . . . . . . . . . .

125

4.4.1

Atomic Objects Compose for Free . . . . . . . . . . . . .

125

4.4.2

Guaranteed Termination . . . . . . . . . . . . . . . . . . . .

127

4.5

Alternatives to Atomicity. . . . . . . . . . . . . . . . . . . . . . . . . .

128

4.5.1
Sequential Consistency . . . . . . . . . . . . . . . . . . . . .

128

4.5.2

Serializability . . . . . . . . . . . . . . . . . . . . . . . . . . . .

130

4.6

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

131

4.7

Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

132

Part III

Mutex-Free Synchronization

Mutex-Free Concurrent Objects . . . . . . . . . . . . . . . . . . . . . . . . .

135

5.1

Mutex-Freedom and Progress Conditions . . . . . . . . . . . . . . .

135

5.1.1
The Mutex-Freedom Notion . . . . . . . . . . . . . . . . . .

135

5.1.2

Progress Conditions . . . . . . . . . . . . . . . . . . . . . . .

137

5.1.3

Non-blocking with Respect to Wait-Freedom . . . . . .

140

5.2

Mutex-Free Concurrent Objects . . . . . . . . . . . . . . . . . . . . .

140

5.2.1

The Splitter: A Simple Wait-Free Object from

Read/Write Registers. . . . . . . . . . . . . . . . . . . . . . .

140

5.2.2

A Simple Obstruction-Free Object from

Read/Write Registers. . . . . . . . . . . . . . . . . . . . . . .

143

5.2.3
A Remark on Compare&Swap: The ABA Problem. . .

145

5.2.4

A Non-blocking Queue Based on

Read/Write Registers and Compare&Swap . . . . . . .

146

5.2.5

A Non-blocking Stack Based on

Compare&Swap Registers . . . . . . . . . . . . . . . . . . .

150

5.2.6

A Wait-Free Stack Based on

Fetch&Add and Swap Registers . . . . . . . . . . . . . . .

152

xiv

Contents

5.3

Boosting Obstruction-Freedom to Stronger Progress

in the Read/Write Model . . . . . . . . . . . . . . . . . . . . . . . . . .

155
5.3.1

Failure Detectors . . . . . . . . . . . . . . . . . . . . . . . . .

155

5.3.2

Contention Managers for Obstruction-Free

Object Implementations . . . . . . . . . . . . . . . . . . . . .

157

5.3.3

Boosting Obstruction-Freedom to Non-blocking . . . .

158

5.3.4

Boosting Obstruction-Freedom to Wait-Freedom . . .

159

5.3.5

Mutex-Freedom Versus Loops Inside a Contention

Manager Operation . . . . . . . . . . . . . . . . . . . . . . . .

161

5.4

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

162
5.5

Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

162

5.6

Exercises and Problems . . . . . . . . . . . . . . . . . . . . . . . . . . .

163

Hybrid Concurrent Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . .

165

6.1

The Notion of a Hybrid Implementation . . . . . . . . . . . . . . .

165

6.1.1

Lock-Based Versus Mutex-Free Operation:

Static Hybrid Implementation. . . . . . . . . . . . . . . . .

166

6.1.2

Contention Sensitive (or Dynamic Hybrid)

Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . .

166
6.1.3

The Case of Process Crashes . . . . . . . . . . . . . . . . .

166

6.2

A Static Hybrid Implementation of a Concurrent Set Object . . .

167

6.2.1

Definition and Assumptions . . . . . . . . . . . . . . . . . .

167

6.2.2

Internal Representation and Operation

Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . .

167

6.2.3

Properties of the Implementation . . . . . . . . . . . . . .

171

6.3

Contention-Sensitive Implementations . . . . . . . . . . . . . . . . .

172

6.3.1
Contention-Sensitive Binary Consensus . . . . . . . . . .

172

6.3.2

A Contention Sensitive Non-blocking

Double-Ended Queue . . . . . . . . . . . . . . . . . . . . . .

176

6.4

The Notion of an Abortable Object . . . . . . . . . . . . . . . . . . .

181

6.4.1

Concurrency-Abortable Object . . . . . . . . . . . . . . . .

181

6.4.2

From a Non-blocking Abortable Object

to a Starvation-Free Object . . . . . . . . . . . . . . . . . .

183

6.5

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

186

6.6
Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

186

6.7

Exercises and Problems . . . . . . . . . . . . . . . . . . . . . . . . . . .

187

Wait-Free Objects from Read/Write Registers Only . . . . . . . . . .

189

7.1

A Wait-Free Weak Counter for Infinitely Many Processes. . .

189

7.1.1

A Simple Counter Object. . . . . . . . . . . . . . . . . . . .

190

7.1.2

Weak Counter Object for Infinitely Many Processes. . .

191

7.1.3

A One-Shot Weak Counter Wait-Free Algorithm . . .

193
7.1.4

Proof of the One-Shot Implementation . . . . . . . . . .

194

7.1.5

A Multi-Shot Weak Counter Wait-Free Algorithm . . .

199

Contents

xv

7.2

Store-Collect Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

201

7.2.1

Store-Collect Object: Definition . . . . . . . . . . . . . . .

201

7.2.2

An Adaptive Store-Collect Implementation . . . . . . .

204

7.2.3

Proof and Cost of the Adaptive Implementation . . . .

208
7.3

Fast Store-Collect Object . . . . . . . . . . . . . . . . . . . . . . . . . .

211

7.3.1

Fast Store-Collect Object: Definition. . . . . . . . . . . .

211

7.3.2

A Fast Algorithm for the store collectðÞ Operation . . .

212

7.3.3

Proof of the Fast Store-Collect Algorithm . . . . . . . .

215

7.4

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

217

7.5

Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

217

7.6

Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
218

Snapshot Objects from Read/Write Registers Only . . . . . . . . . . .

219

8.1

Snapshot Objects: Definition . . . . . . . . . . . . . . . . . . . . . . .

219

8.2

Single-Writer Snapshot Object . . . . . . . . . . . . . . . . . . . . . .

220

8.2.1

An Obstruction-Free Implementation. . . . . . . . . . . .

221

8.2.2

From Obstruction-Freedom to Bounded

Wait-Freedom . . . . . . . . . . . . . . . . . . . . . . . . . . .

223

8.2.3

One-Shot Single-Writer Snapshot Object:

Containment Property . . . . . . . . . . . . . . . . . . . . . .
227

8.3

Single-Writer Snapshot Object with Infinitely

Many Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

228

8.4

Multi-Writer Snapshot Object. . . . . . . . . . . . . . . . . . . . . . .

230

8.4.1

The Strong Freshness Property . . . . . . . . . . . . . . . .

231

8.4.2

An Implementation of a Multi-Writer

Snapshot Object . . . . . . . . . . . . . . . . . . . . . . . . . .

231

8.4.3

Proof of the Implementation. . . . . . . . . . . . . . . . . .

234

8.5

Immediate Snapshot Objects . . . . . . . . . . . . . . . . . . . . . . .


238

8.5.1

One-Shot Immediate Snapshot Object: Definition . . .

238

8.5.2

One-Shot Immediate Snapshot Versus

One-Shot Snapshot . . . . . . . . . . . . . . . . . . . . . . . .

238

8.5.3

An Implementation of One-Shot

Immediate Snapshot Objects . . . . . . . . . . . . . . . . .

240

8.5.4

A Recursive Implementation of a One-Shot

Immediate Snapshot Object . . . . . . . . . . . . . . . . . .

244

8.6

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

247

8.7
Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

247

8.8

Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

248

xvi

Contents

Renaming Objects from Read/Write Registers Only . . . . . . . . . .

249

9.1

Renaming Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

249

9.1.1

The Base Renaming Problem . . . . . . . . . . . . . . . . .

249

9.1.2

One-Shot Renaming Object . . . . . . . . . . . . . . . . . .

250

9.1.3
Adaptive Implementations . . . . . . . . . . . . . . . . . . .

250

9.1.4

A Fundamental Result . . . . . . . . . . . . . . . . . . . . . .

251

9.1.5

Long-Lived Renaming. . . . . . . . . . . . . . . . . . . . . .

252

9.2

Non-triviality of the Renaming Problem . . . . . . . . . . . . . . .

252

9.3

A Splitter-Based Optimal Time-Adaptive Implementation . . .

254

9.4

A Snapshot-Based Optimal Size-Adaptive Implementation. . .

256

9.4.1

A Snapshot-Based Implementation . . . . . . . . . . . . .

256
Other documents randomly have
different content
The expression is originally Virgil's:

Extra anni, solisque vias.

[57] See the Astræa Redux. Note VI.


[58] Reckoning from the death of his father, Charles had reigned thirty-six
years and eight days; and, counting from his restoration, twenty-four
years, eight months, and nine days.
[59] Ancus Martius, who succeeded the peaceful Numa Pompilius as king
of Rome.
[60] Note VII.
[61] Ralph, Vol. I. p. 834.
[62] Life of Lord Keeper Guilford, p. 253.
[63] Epistle to Mr Duke.
[64] Burnet's History of his own Times. End of Book III.
[65] Character of Charles II., Sheffield Duke of Buckingham's Works, Vol.
II. p. 65.
[66] One Dr Stokeham is said to have alleged, that the king's fit was
epileptic, not apoplectic, and that bleeding was ex diametro wrong.
[67] Nell Gwyn.
[68] Echard's History, p. 1046.
[69] Dalrymple's Memoirs, 8vo. vol. i. p. 66.
[70] In the years 1662 and 1674. See Vol. IX, p. 448.
[71] Our author was not the only poet who hailed this dawn of toleration;
for there is in Luttrell's Collection, "A Congratulatory Poem, dedicated to
his Majesty, on the late gracious Declaration (9th June, 1687); by a Person
of Quality."
[72] Turkish Spy, Vol. viii. p. 19.
[73] Perhaps the poet recollected the attributes ascribed to the panther by
one of the fathers: "Pantheræ, ut Divus Basilius ait, cum immani sint ac
crudeli odio in homines a natura incensæ, in hominum simulacra
furibundæ irruunt, nec aliter hominum effigiem, quam homines ipsos
dilacerant."—Granateus Concion. de Tempore, Tom. i. p. 492.
[74] "Only by the way, before we bring D. against D. to the stake, I would
fain know how Mr Bayes, that so well understood the nature of beasts,
came to pitch upon the Hind and the Panther, to signify the church of
Rome and the church of England? Doubtless his reply will be, because the
hind is a creature harmless and innocent; the panther mischievous and
inexorable. Let all this be granted; what is this to the author's absurdity in
the choice of his beasts? For the scene of the persecution is Europe, a part
of the world which never bred panthers since the creation of the universe.
On the other side, grant his allusion passable, and then he stigmatizes the
church of England to be the most cruel and most voracious creature that
ranges all the Lybian deserts;—a character, which shows him to have a
strange mist before his eyes when he reads ecclesiastical history. And
then, says he,

The panther, sure the noblest next the hind,


And fairest creature of the spotted kind.

Which is another blunder, cujus contrarium verum est: For if beauty,


strength, and courage, advance the value of the several parts of the
creation, without question the panther is far to be preferred before the
hind, a poor, silly, timorous, ill-shaped, bobtailed creature, of which a score
will hardly purchase the skin of a true panther. Had he looked a little
farther, Ludolphus would have furnished him with a zebra, the most
beautiful of all the four-footed creatures in the world, to have coped with
his panther for spots, and with his hind for gentleness and mildness; of
which one was sold singly to the Turkish governor of Suaquena for 2000
Venetian ducats. There had been a beast for him, as pat as a pudding for
a friar's mouth. But to couple the hind and the panther was just like sic
magna parvis componere; and, therefore, he had better have put his hind
in a good pasty, or reserved her for some more proper allusion; for this,
though his nimble beast have four feet, will by no means run quatuor
pedibus, though she had a whole kennel of hounds at her heels."—The
Revolter, a Tragi-comedy.
[75] The following justification of their plan is taken from the preface,
which is believed to have been entirely the composition of Montague.
"The favourers of 'The Hind and Panther' will be apt to say in its defence,
that the best things are capable of being turned to ridicule; that Homer
has been burlesqued, and Virgil travestied, without suffering any thing in
their reputation from that buffoonery; and that, in like manner,'The Hind
and the Panther' may be an exact poem, though it is the subject of our
raillery: But there is this difference, that those authors are wrested from
their true sense, and this naturally falls into ridicule; there is nothing
represented here as monstrous and unnatural, which is not equally so in
the original.—First, as to the general design; Is it not as easy to imagine
two mice bilking coachmen, and supping at the Devil, as to suppose a hind
entertaining the panther at a hermit's cell, discussing the greatest
mysteries of religion, and telling you her son Rodriguez writ very good
Spanish? What can be more improbable and contradictory to the rules and
examples of all fables, and to the very design and use of them? They were
first begun, and raised to the highest perfection, in the eastern countries,
where they wrote in signs, and spoke in parables, and delivered the most
useful precepts in delightful stories; which, for their aptness, were
entertaining to the most judicious, and led the vulgar into understanding
by surprizing them with their novelty, and fixing their attention. All their
fables carry a double meaning; the story is one and entire; the characters
the same throughout, not broken or changed, and always conformable to
the nature of the creatures they introduce. They never tell you, that the
dog, which snapt at a shadow, lost his troop of horse; that would be
unintelligible; a piece of flesh is proper for him to drop, and the reader will
apply it to mankind: They would not say, that the daw, who was so proud
of her borrowed plumes, looked very ridiculous, when Rodriguez came and
took away all the book but the 17th, 24th, and 25th chapters, which she
stole from him. But this is his new way of telling a story, and confounding
the moral and the fable together.

Before the word was written, said the hind,


Our Saviour preached the faith to all mankind.

What relation has the hind to our Saviour? or what notion have we of a
panther's bible? If you say he means the church, how does the church
feed on lawns, or range in the forest? Let it be always a church, or always
the cloven-footed beast, for we cannot bear his shifting the scene every
line. If it is absurd in comedies to make a peasant talk in the strain of a
hero, or a country wench use the language of the court, how monstrous is
it to make a priest of a hind, and a parson of a panther? To bring them in
disputing with all the formalities and terms of the school? Though as to the
arguments themselves, those we confess are suited to the capacity of the
beasts; and if we would suppose a hind expressing herself about these
matters, she would talk at that rate."
The reader may be curious to see a specimen of the manner in which
these two applauded wits encountered Dryden's controversial poem, with
such eminent success, that a contemporary author has said, "that 'The City
and Country Mouse' ruined the reputation of the divine, as the 'Rehearsal'
ruined the reputation of the poet."[76] The plan is a dialogue between
Bayes, and Smith, and Johnson, his old friends in the "Rehearsal;" the
poet recites to them a new work, in which the Popish and English churches
are represented as the city and country mouse, the former spotted, the
latter milk-white. The following is a specimen both of the poetry and
dialogue:

"Bayes. Reads. With these allurements, Spotted did invite,


From hermit's cell, the female proselyte.
Oh, with what ease we follow such a guide,
Where souls are starved, and senses gratified!

"Now, would not you think she's going? but, egad, you're mistaken; you
shall hear a long argument about infallibility before she stir yet:
But here the White, by observation wise,
Who long on heaven had fixed her prying eyes,
With thoughtful countenance, and grave remark,
Said, "Or my judgment fails me, or 'tis dark;
Lest, therefore, we should stray, and not go right,
Through the brown horror of the starless night,
Hast thou Infallibility, that wight?"
Sternly the savage grinned, and thus replied,
"That mice may err, was never yet denied."
"That I deny," said the immortal dame,
"There is a guide,—Gad, I've forgot his name,—
Who lives in Heaven or Rome, the Lord knows where;
Had we but him, sweet-heart, we could not err.—
But hark ye, sister, this is but a whim,
For still we want a guide to find out him."

"Here, you see, I don't trouble myself to keep on the narration, but write
White speaks, or Dapple speaks, by the side. But when I get any noble
thought, which I envy a mouse should say, I clap it down in my own
person, with a poeta loquitur; which, take notice, is a surer sign of a fine
thing in my writings, than a hand in the margent anywhere else.—Well
now, says White,

What need we find him? we have certain proof


That he is somewhere, dame, and that's enough;
For if there is a guide that knows the way,
Although we know not him, we cannot stray.

"That's true, egad: Well said, White.—You see her adversary has nothing
to say for herself; and, therefore, to confirm the victory, she shall make a
simile.

Smith. Why, then, I find similes are as good after victory, as after a surprize.

Bayes. Every jot, egad; or rather better. Well, she can do it two ways;
either about emission or reception of light, or else about Epsom waters:
But I think the last is most familiar; therefore speak, my pretty one.
[Reads.]

As though 'tis controverted in the school,


If waters pass by urine, or by stool;
Shall we, who are philosophers, thence gather,
From this dissention, that they work by neither?

"And, egad, she's in the right on't; but, mind now, she comes upon her
scoop. [Reads.]
All this I did, your arguments to try.

"And, egad, if they had been never so good, this next line confutes 'em.
[Reads.]

Hear, and be dumb, thou wretch! that guide am I.

"There's a surprize for you now!—How sneakingly t'other looks?—Was not


that pretty now, to make her ask for a guide first, and tell her she was
one? Who could have thought that this little mouse had the Pope, and a
whole general council, in her belly?—Now Dapple had nothing to say to
this; and, therefore, you'll see she grows peevish. [Reads.]

Come leave your cracking tricks; and, as they say,


Use not that barber that trims time, delay;— }
Which, egad, is new, and my own.—
I've eyes as well as you to find the way."—
Then on they jogged; and, since an hour of talk
Might cut a banter on the tedious walk,
"As I remember," said the sober Mouse,
"I've heard much talk of the Wit's Coffee-house."
"Thither," says Brindle, "thou shalt go, and see
Priests sipping coffee, sparks and poets tea,
Here, rugged frieze; there, quality well drest;
These, baffling the Grand Seigneur; those, the Test;
And here shrewd guesses made, and reasons given,
That human laws were never made in heaven.
But, above all, what shall oblige thy sight,
And fill thy eye-balls with a vast delight,
Is the poetic Judge of sacred wit,[77]
Who does i'the darkness of glory sit.
And as the moon, who first receives the light
With which she makes these nether regions bright,
So does he shine, reflecting from afar
The rays he borrowed from a better star;
For rules, which from Corneille and Rapin flow,
Admired by all the scribbling herd below,
From French tradition while he does dispense,
Unerring truths, 'tis schism,—a damned offence,— }
To question his, or trust your private sense.

"Ha! is not that right, Mr Johnson?—Gad forgive me, he is fast asleep! Oh


the damned stupidity of this age! Asleep!—Well, sir, since you're so drowsy,
your humble servant.
John. Nay, pray, Mr Bayes! Faith, I heard you all the while.—The white
mouse——
Bayes. The white mouse! Ay, ay, I thought how you heard me. Your
servant, sir, your servant.
John. Nay, dear Bayes: Faith, I beg thy pardon, I was up late last night.
Prithee, lend me a little snuff, and go on.
Bayes. Go on! Pox, I don't know where I was.—Well, I'll begin. Here, mind,
now they are both come to town. [Reads.]

But now at Piccadilly they arrive,


And, taking coach, t'wards Temple-Bar they drive;
But, at St Clement's church, eat out the back,
And, slipping through the palsgrave, bilked poor hack.

"There's the utile which ought to be in all poetry. Many a young Templar
will save his shilling by this stratagem of my mice.
Smith. Why, will any young Templar eat out the back of a coach?
Bayes. No, egad! But you'll grant, it is mighty natural for a mouse."—Hind
and Panther Transversed.
Such was the wit, which, bolstered up by the applause of party, was
deemed an unanswerable ridicule of Dryden's favourite poem.
[76] Preface to the Second Part of "The Reasons of Mr Bayes changing his
Religion."
[77] i.e. Dryden himself.
[78] I know not, however, but a critic might here also point out an
example of that discrepancy, which is censured by Johnson, and ridiculed
by Prior. The cause of dissatisfaction in the pigeon-house is, that the
proprietor chuses rather to feed upon the flesh of his domestic poultry,
than upon theirs; no very rational cause of mutiny on the part of the
doves.
[79] Butler, however, assigns the Bear-Garden as a type of my Mother Kirk;
and the resemblance is thus proved by Ralpho:
Synods are mystical bear-gardens,
Where elders, deputies, church-wardens,
And other members of the court,
Manage the Babylonish sport;
For prolocutor, scribe, and bear-ward,
Do differ only in a mere word;
Both are but several synagogues
Of carnal men, and bears, and dogs;
Both antichristian assemblies,
To mischief bent as far's in them lies;
Both slave and toil with fierce contests,
The one with men, the other beasts:
The difference is, the one fights with
The tongue, the other with the teeth;
And that they bait but bears in this,
In t'other souls and consciences.

Hudibras denies the resemblance, and answers by an appeal to the


senses:

For bears and dogs on four legs go


As beasts, but synod-men have two;
'Tis true, they all have teeth and nails,
But prove that synod-men have tails;
Or that a rugged shaggy fur
Grows o'er the hide of presbyter;
Or that his snout and spacious ears
Do hold proportion with a bear's.
A bear's a savage beast, of all
Most ugly and unnatural;
Whelped without form, until the dam
Has licked it into shape and frame;
But all thy light can ne'er evict,
That ever synod-man was lickt,
Or brought to any other fashion,
Than his own will and inclination.
Hudibras, Part 1. Canto 3.

[80] "In short, the whole poem, if it may deserve that name, is a piece of
deformed, arrogant nonsense, and self-contradiction, drest up in fine
language, like an ugly brazen-faced whore, peeping through the costly
trappings of a point de Venise cornet. I call it nonsense, because
unseasonable; and arrogant, because impertinent: For could Mr Bayes
have so little wit, to think himself a sufficient champion to decide the high
mysteries of faith and transubstantiation, and the nice disputes concerning
traditions and infallibility, in a discourse between "The Hind and the
Panther," which, undetermined hitherto, have exercised all the learning in
the world? Or, could he think the grand arcana of divinity a subject fit to
be handled in flourishing rhyme, by the author of "The Duke of Guise," or
"The Conquest of Peru," or "The Spanish Friar:" Doubts which Mr Bayes is
no more able to unfold, than Saffold to resolve a question in astrology. And
all this only as a tale to usher in his beloved character, and to shew the
excellency of his wit in abusing honest men. If these were his thoughts, as
we cannot rationally otherwise believe, seeing that no man of
understanding will undertake an enterprise, wherein he does not think
himself to have some advantage of his predecessors; then does this
romance, I say, of The Panther and the Hind, fall under the most fatal
censure of unseasonable folly and saucy impertinence. Nor can I think,
that the more solid, prudent, and learned persons of the Roman Church,
con him any thanks for laying the prophane fingers of a turn-coat upon the
altar of their sacred debates."—The Revolter, a tragi-comedy, acted
between The Hind and Panther and Religio Laici, &c. 1687.
[81] The following is the commencement of his "Reflections on the Hind
and Panther," in a letter to a friend, 1687:
"The present you have made me of "The Hind and Panther," is variously
talked of here in the country. Some wonder what kind of champion the
Roman Catholics have now gotten; for they have had divers ways of
representing themselves; but this of rhyming us to death, is altogether
new and unheard of, before Mr Bayes set about it; and, indeed, he hath
done it in the sparkishest poem that ever was seen. 'Tis true, he hath
written a great many things; but he never had such pure swiftness of
thought, as in this composition, nor such fiery flights of fancy. Such hath
always been his dramatical and scenical way of scribbling, that there was
no post nor pillar in the town exempt from the pasting up of the titles of
his plays; insomuch, that the footboys, for want of skill in reading, do now
(as we hear) often bring away, by mistake, the title of a new book against
the Church of England, instead of taking down the play for the afternoon.
Yet, if he did it well or handsomely, he might deserve some pardon; but,
alas! how ridiculously doth he appear in print for any religion, who hath
made it his business to laugh at all! How can he stand up for any mode of
worship, who hath been accustomed to bite, and spit his venom against
the very name thereof?
"Wherefore, I cannot but wish our adversaries joy on their new-converted
hero, Mr Bayes; whose principle it is to fight single with whole armies; and
this one quality he prefers before all the moral virtues put together. The
Roman Catholics may talk what they will, of their Bellarmine and Perrone,
their Hector and Achilles, and I know not who; but I desire them all, to
shew one such champion for the cause, as this Drawcansir: For he is the
man that kills whole nations at once; who, as he never wrote any thing,
that any one can imagine has ever been the practice of the world, so, in
his late endeavours to pen controversy, you shall hardly find one word to
the purpose. He is that accomplished person, who loves reasoning so
much in verse, and hath got a knack of writing it smoothly. The subject
(he treats of in this poem) did, in his opinion, require more than ordinary
spirit and flame; therefore, he supposed it to be too great for prose; for he
is too proud to creep servilely after sense; so that, in his verse, he soars
high above the reach of it. To do this, there is no need of brain, 'tis but
scanning right; the labour is in the finger, not in the head.
"However, if Mr Bayes would be pleased to abate a little of the exuberancy
of his fancy and wit; to dispense with his ornaments and superfluencies of
invention and satire, a man might consider, whether he should submit to
his argument; but take away the railing, and no argument remains; so that
one may beat the bush a whole day, and, after so much labour, only spring
a butterfly, or start a hedge-hog.
"For all this, is it not great pity to see a man, in the flower of his romantic
conceptions, in the full vigour of his studies on love and honour, to fall into
such a distraction, as to walk through the thorns and briars of controversy,
unless his confessor hath commanded it, as a penance for some past sins?
that a man, who hath read Don Quixote for the greatest part of his life,
should pretend to interpret the Bible, or trace the footsteps of tradition,
even in the darkest ages?"—Four Letters, &c.
[82] "To draw now to an end, Mr Bayes, I hear, has lately complained, at
Willis' Coffeehouse, of the ill usage he has met in the world; that whereas
he had the generosity and assurance to set his own name to his late piece
of polemic poetry, yet others, who have pretended to answer him, wanted
the breeding and civility to do the like: Now, because I would not willingly
disoblige a person of Mr Bayes's character, I do here fairly, and before all
the world, assure him that my name is Dudly Tomkinson, and that I live
within two miles of St Michael's Mount, in Cornwall, and have, in my time,
been both constable, church-warden, and overseer of the parish; by the
same token, that the little gallery next the belfry, the new motto about the
pulpit, the king's arms, the ten commandments, and the great sun-dial in
the church-yard, will transmit my name to all posterity. Furthermore, (if it
will do him any good at all) I can make a pretty shift to read without
spectacles; wear my own hair, which is somewhat inclining to red; have a
large mole on my left cheek; am mightily troubled with corns; and, what is
peculiar to my constitution, after half-a-dozen bottles of claret, which I
generally carry home every night from the tavern, I never fail of a stool or
two next morning; besides, use to smoke a pipe every day after dinner,
and afterwards steal a nap for an hour or two in the old wicker-chair near
the oven; take gentle purgatives spring and fall; and it has been my
custom, any time these sixteen years, (as all the parish can testify) to ride
in Gambadoes. Nay, to win the heart of him for ever, I invite him here,
before the courteous reader, to a country regale, (provided he will before
hand promise not to debauch my wife,) where he shall have sugar to his
roast beef, and vinegar to his butter; and lastly, to make him amends for
the tediousness of the journey, a parcel of relics to carry home with him,
which I believe can scarce be matched in the whole Christian world; but,
because I have no great fancy that way, I don't care if I part with them to
so worthy a person; they are as followeth:
"St Gregory's Ritual, bound up in the same calve's-skin that the old
gentleman, in St Luke, roasted at the return of his prodigal son.
"The quadrant that a Philistine tailor took the height of Goliah by, when he
made him his last suit of clothes; for the giant being a man of
extraordinary dimensions, it was impossible to do this in any other way
than your designers use when they take the height of a country-steeple,"
&c &c..—Reasons for Mr Bayes changing his Religion. See Preface.
[83] THE LAUREAT.
Jack Squab's history, in a little drawn,
Down to his evening from his morning dawn.

(Bought by Mr Luttrel, 24th October, 1687.)

Appear, thou mighty bard, to open view;


Which yet, we must confess, you need not do.
The labour to expose thee we may save;
Thou standst upon thy own records a knave,
Condemned to live in thy apostate rhymes,
The curse of ours, and scoff of future times.
Still tacking round with every turn of state,
Reverse to Shaftesbury, thy cursed fate }
Is always, at a change, to come too late.
To keep his plots from coxcombs, was his care;
His villainy was masked, and thine is bare.
Wise men alone could guess at his design,
And could but guess, the threads were spun so fine; }
But every purblind fool may see through thine.
Had Dick still kept the regal diadem,
Thou hadst been poet laureat still to him,
And, long ere now, in lofty verse proclaimed
His high extraction, among princes famed;
Diffused his glorious deed from pole to pole,
Where winds can carry, or where waves can roll:
Nay, had our Charles, by heaven's severe decree,
Been found and murdered in the royal tree,
Even thou hadst praised the fact; his father slain,
Thou callest but gently breathing of a vein.
Impious and villainous, to bless the blow
That laid at once three lofty nations low, }
And gave the royal cause a fatal overthrow!
Scandal to all religions, new and old;
Scandal to them, where pardon's bought and sold, }
And mortgaged happiness redeemed for gold.
Tell me, for 'tis a truth you must allow,
Who ever changed more in one moon than thou?
Even thy own Zimri was more stedfast known,
He had but one religion, or had none.
What sect of Christians is't thou hast not known,
And at one time or other made thy own?
A bristled baptist bred, and then thy strain
Immaculate was far from sinful stain;
No songs, in those blest times, thou didst produce,
To brand and shame good manners out of use;
The ladies had not then one b—— bob,
Nor thou the courtly name of Poet Squab.
Next, thy dull muse, an independant jade,
On sacred tyranny fine stanzas made;
On sacred tyranny fine stanzas made;
Praised Noll, who even to both extremes did run,
To kill the father and dethrone the son.
When Charles came in, thou didst a convert grow,
More by thy interest, than thy nature so;
Under his 'livening beams thy laurels spread;
He first did place that wreath about thy head, }
Kindly relieved thy wants, and gave thee bread.
Here 'twas thou mad'st thy bells of fancy chime,
And choked the town with suffocating rhyme;
Till heroes, formed by thy creating pen,
Were grown as cheap and dull as other men.
Flushed with success, full gallery and pit,
Thou bravest all mankind with want of wit;
Nay, in short time wer't grown so proud a ninny,
As scarce to allow that Ben himself had any;
But when the men of sense thy error saw,
They checked thy muse, and kept the termagant in awe.
To satire next thy talent was addrest,
Fell foul on all, thy friends among the rest:
Those who the oft'nest did thy wants supply,
Abused, traduced, without a reason why;
Nay, even thy royal patron was not spared,
But an obscene, a santring wretch declared.
Thy loyal libel we can still produce;
Beyond example, and beyond excuse.
O strange return to a forgiving king!
But the warmed viper wears the greatest sting.
Thy pension lost, and justly without doubt;
When servants snarl, we ought to kick 'em out;
They that disdain their benefactor's bread,
No longer ought by bounty to be fed.
That lost, the visor changed, you turn about,
And straight a true blue Protestant crept out.
The "Friar" now was writ; and some will say,
They smell a mal-content through all the play.
The Papist too was damned, unfit for trust,
Called treacherous, shameless, profligate, unjust; }
And kingly power thought arbitrary lust.
This lasted till thou didst thy pension gain,
And that changed both thy morals and thy strain.
If to write contradictions nonsense be,
Who has more nonsense in their works than thee?
We'll mention but thy Layman's Faith and Hind:
Who'll think both these, such clashing do we find,
Could be the product of one single mind!
Here thou wouldst charitable fain appear,
Find fault that Athanasius was severe;
Thy pity straight to cruelty is raised,
A d th i i i iti i d
And even the pious inquisition praised,
And recommended to the present reign,
"O happy countries, Italy and Spain!"
Have we not cause, in thine own words, to say,
Let none believe what varies every day, }
That never was, nor will be, at a stay?
Once heathens might be saved, you did allow,
But not, it seems, we greater heathens now.
The loyal church, that buoys the kingly line,
Damned with a breath, but 'tis such a breath as thine.
What credit to thy party can it be,
To have gained so lewd a profligate as he,
Strayed from our fold, makes us to laugh, not weep;
We have but lost what was disgrace to keep.
By them mistrusted, and to us a scorn;
For 'tis but weakness at the best to turn.
True, hadst thou left us in the former reign,
Y'had proved it was not wholly done for gain; }
Now the meridian sun is not so plain.
Gold is thy god; for a substantial sum,
Thou to the Turk wouldst run away from Rome, }
And sing his holy expedition against Christendom.
But, to conclude; blush with a lasting red,
If thou'rt not moved by what's already said,
To see thy boars, bears, buzzards, wolves, and owls,
And all thy other beasts and other fowls,
Routed by two poor mice (unequal fight!);
But easy 'tis to conquer in the right.
See, there a youth, (a shame to thy gray hairs)
Make a mere dunce of all thy threescore years.
What in that tedious poem hast thou done,
But crammed all Esop's fables into one?
But why do I the precious minutes spend
On him, that would much rather hang than mend?
No, wretch, continue still just as thou art,
Thou'rt now in this last scene that crowns thy part.
To purchase favour veer with every gale,
And against interest never cease to rail,
Though thou'rt the only proof how interest can prevail.

[84] "Tale of a Tub," first part. "Tommy Potts" is a silly popular ballad, for
which see Ritson's "Ancient Songs."
[85] The tumultuary joy of the sectaries, upon their first view of this
triumph over the church of England, led them into all the extravagancies of
loyalty, which used to be practised by their ancient enemies the Tories.
Addresses teeming with affection, and foaming with bombast, were poured
in upon King James from all corners of his dominions; Presbyterians,
Anabaptists, Quakers, Sectaries of all sorts and persuasions, strove to be
foremost in the race of gratitude. And when similar addresses came in
from corporations, who had been formerly anxious to shew their loyalty on
the subject of the Rye-house plot, the king's accession, and other
occasions of triumph to the Tories, the tone of these bodies also was
wonderfully changed; and, instead of raving against excluders, rebels,
regicides, republicans, and fanatics, whose hellish contrivances
endeavoured to destroy the safety of the kingdom, and the life of the king,
these same gentlemen mention the Sectaries as their brethren and fellow-
subjects, to whom the king, their common father, had been justly, liberally,
royally pleased to grant freedom of conscience, for which the addressers
offer their hearty and unfeigned thanks. These were the two classes of
persons, whom Dryden, as they had closed with the measures of
government, declares to be exempted from his satire. Those, therefore,
against whom it is avowedly directed, are first, the Church of England,
whose adherents saw her destruction aimed at through the pretence of
toleration. 2dly, Those Sectaries, who distrusted the boon which the king
presented, and feared that the consequences of this immediate indulgence
at the hands of an ancient enemy, would be purchased by future
persecution. These formed a body, small at first, but whose numbers daily
increased.
Among the numerous addresses which were presented to the court on this
occasion, there are two somewhat remarkable from the quality and
condition of the persons in whose name they are offered. The one is from
the persons engaged in the schemes of Shaftesbury and Monmouth, and
who set out by acknowledging their lives and fortunes forfeited to King
James; a singular instance of convicts offering their sentiments upon state
affairs. The other is from no less a corporation than the company of
London Cooks, which respectable persons declare their approbation of the
indulgence, upon a principle recognized in their profession, "the difference
of men's gusto, in religion, as in eatables;" and assure his majesty, that his
declaration "somewhat resembles the Almighty's manna, which suited
every man's palate." History of Addresses, pp. 106, 132.
[86] Most readers will, I think, acknowledge with me, the extreme
awkwardness with which Dryden apologizes, for hoping well of those
Sectaries, against whom he had so often discharged the utmost severity of
his pen. Yet there is much real truth in the observation, though the
compliment to the new allies of the Catholics is but a cold one. Many sects
have distinguished themselves by faction, fanaticism, and furious excess at
their rise, which, when their spirits have ceased to be agitated by novelty,
and exasperated by persecution, have subsided into quiet orderly classes
of citizens, only remarkable for some peculiarities of speculative doctrine.
[87] Alluding to the persecution of the Huguenots in France, after the
recall of the edict of Nantes.
[88] This phrase occurs in the address of the Ministers of the Gospel in
and about the city of London, commonly called Presbyterians: "Your
majesty's princely wisdom," say these reverend sycophants, "now rescues
us from our long sufferings, and by the same royal act restores God to the
empire over conscience." This it is to be too eloquent; when people set no
bounds to their rhetoric, it betrays them often into nonsense, and not
seldom into blasphemy.—History of Addresses, p. 107.
[89] A gentle insinuation, that, if the sectaries could renounce the
ordination by presbyteries or classes, in favour of the church of England, it
would require but a step or two farther to bring them to a conformity with
that of Rome.
[90] Who freed the Jews from their bondage, and gave them permission to
rebuild their city and temple.—See the Book of Esdras.
[91] In his ardour for extending the Catholic religion, James II. had
directed copies of the papers found in his brother's strongbox in favour of
that communion, with the copy of a paper by his first duchess, giving the
reasons for her conversion to that faith, to be printed, and circulated
through the kingdom. These papers were answered by the learned
Stillingfleet, then Dean of St Paul's. A Defence of the Papers was published
"by command," of which it appears, from the passage in the text, that our
author wrote the third part, which applies to the Duchess of York's paper.
Stillingfleet published a vindication of his answer, in which he attacks our
author with some severity. A full account of the controversy will be found
attached to Dryden's part of the Defence, among his prose works.
[92] In the controversy between Dryden and Stillingfleet, the former had
concluded his Defence of the Duchess of York's paper, by alleging, that
"among all the volumes of divinity written by the Protestants, there is not
one original treatise, at least that I have seen or heard of, which has
handled distinctly, and by itself, the Christian virtue of humility." This
Stillingfleet, in his reply, calls a "bare-faced assertion of a thing known to
be false;" for, "with-in a few years, besides what has been printed
formerly, such a book hath been published in London." Dryden, in the text,
replies to this allegation, that Duncombe's treatise, which he supposes to
be meant, is a translation from the Spanish of Rodriguez, therefore, not
originally a Protestant work. Montague, in the preface to "The Hind and
Panther Transversed" alleges, that Dryden has mistaken the name of the
author of the treatise alluded to; which was not, he asserts, Duncombe,
but Allen. See the matter more fully canvassed in a note on the original
passage, in "The Duchess of York's Paper Defended."
[93] Dryden is not quite candid in his statement. In Stillingfleet's answer to
the Duchess's paper, it is indeed called, the "paper said to be written by a
great lady;" but there is not another word upon the authority, which,
indeed, considering it was published under the king's immediate
inspection, could not be very decorously disputed. Dryden seizes upon this
phrase in his defence, and, coupling with it some expressions of the Bishop
of Winchester, he argues that it was the intention of these sons of the
church of England, to give the lie to their sovereign. In this vindication of
the answer, Stillingfleet thus expresses himself: "As to the main design of
the third paper, I declared, that I considered it, as it was supposed to
contain the reasons and motives of the conversion of so great a lady to the
church of Rome.
"But this gentleman has now eased me of the necessity of farther
considering it on that account. For he declares, that none of those motives
or reasons are to be found in the paper of her highness. Which he repeats
several times. 'She writ this paper, not as to the reasons she had herself
for changing, &c.' 'As for her reasons, they were only betwixt God and her
own soul, and the priest with whom she spoke at last.'
"And so my work is at an end as to her paper. For I never intended to
ransack the private papers or secret narratives of great persons; and I do
not in the least question the relation now given from so great authority, as
that he mentions of the passages concerning her; and therefore I have
nothing more to say as to what relates to the person of the duchess."
It is obvious that Dryden, probably finding the divine too hard for him on
the controversial part of the subject, affects to consider the dispute as
entirely limited to the authenticity of the paper, which it cannot be
supposed Stillingfleet ever seriously intended to impeach.
[94] Eleanor James, a lady who was at this period pleased to stand up as
a champion for the test, against the repeal which James had so deeply at
heart. This female theologian is mentioned in the "Remarks from the
country, upon the two Letters, relating to the convocation, and alterations
in the liturgy." "It is a thousand pities, so instructive and so eloquent
papers should ever fall under such an imputation, (of being too forward,
and solemn impertinence,) and be ranked among the scribblings of Eleanor
James, with this only advantage of having better language, whereas the
woman counsellor is judged to have the better meaning." Although Mrs
James's lucubrations were thus vilipended by the male disputants, one of
her own sex thought it necessary to enter the lists in opposition to her. See
Elizabeth Rone's short Answer to Eleanor James's Long Preamble, or
Vindication of the New Test:

The book called Mistress James's Vindication,


Does seem to me but her great indignation;
Against the Romans and dissenters too,
She for the church of England makes adoe;
Calling her Christ's spouse, but she's mistaken,
Christ's spouse is she that is by her forsaken.

Mrs James's work was entitled, "A Vindication of the Church of England, in
answer to a pamphlet, entitled, a New Test of the Church of England's
Loyalty." She was herself the wife of a printer, who left many books to the
library of Sion college. Mrs James's picture is preserved in the library, in
the full dress of a citizen's wife of that period. She survived her husband
many years, and carried on the printing business on her own account.—
Malone, Vol. III. p. 539.
[95] The Roman Catholic church.
[96] Note I.
[97] The Roman Catholic priests executed in England, at different times
since the Reformation, and regarded as martyrs and saints by those of
their communion.
[98] The Independents. See Note II.
[99] The Quakers. See Note III.
[100] Free-thinkers. See Note IV.
[101] Anabaptists. See Note V.
[102] Unitarians. See Note VI.
[103] See Introductory remarks.
[104] Note VII.
[105] Quasi By-land-er, an old word for a boat, used in coast navigation.
[106] Note VIII.
[107] Alluding to the classical ordination, which the Presbyterian church
has adopted, instead of that by Bishops.
[108] Geneva, the cradle of Calvinism. The territories of the little republic,
dum Troja fuit, were bounded by its ramparts and lake.
[109] Alluding to the recall of the Edict of Nantz, and persecution of the
Huguenots. See Note IX.
[110] Which is usually distinguished by an act of grace, or general pardon.
[111] Nimrod.
[112] Jesus Christ.
[113] King James II.
[114] Note X.
[115] Our author recollected his own Philidel in "King Arthur:"

An airy shape, the tenderest of my kind,


The last seduced and least deformed of hell;
Half-white, and shuffled in the crowd I fell,
Desirous to repent and loath to sin,
Awkward in mischief, piteous of mankind;
My name is Philidel, my lot in air,
Where, next beneath the moon, and nearest heaven,
I soar, I have a glimpse to be received.
Vol. VIII. p. 135.

[116] Henry the Eighth's passion for Anna Bullen led the way to the
Reformation.
[117] The marriage of the clergy, licensed by the Reformation.
[118] Worn out, or become hagard.
[119] A Popish advocate, in the controversy with Tennison, tells us
exultingly, "That Martin Luther himself, Dr T's excellent instrument, after
he had eat a feasting supper, and drank lutheranice, as the German
proverb has it, was called into another world at two o'clock in the night,
February 18, 1546." This was one of the reasons why his adversaries
alleged, that Martin Luther set sail for hell in the manner described by
Sterne, in his tale from Slawkenbergius.
[120] The king being owned the head of the church of England, contrary
to the doctrine of the other reformed churches.
[121] Phylacteries are little scrolls of parchment worn by the Jews on their
foreheads and wrists, inscribed with sentences from the law. They are
supposed, as is expressed by the phrase in the original, to have the virtue
of preserving the wearer from danger and evil.
[122] The Lutherans adopt the doctrine of consubstantiation; that is to
say, they believe, that, though the elements are not changed into the body
and blood of Christ by consecration, which is the Roman faith, yet the
participants, at the moment of communicating, do actually receive the real
body and blood. The Calvinists utterly deny the real presence in the
eucharist, and affirm, that the words of Christ were only symbolical. The
church of England announces a doctrine somewhat between these. See
Note XI.
[123] Note XI.
[124] Note XII.
[125] Alluding to the fate of the church and monarchy of England, which
fell together in the great rebellion. See Note XI.
[126] Resolved, i.e. dissolved.
[127] The Wolf, or Presbytery.—See note XIII.
[128] Note XIV.
[129] That is, if the church of England would be reconciled to Rome, she
should be gratified with a delegated portion of innate authority over the
rival sectaries; instead of being obliged to depend upon the civil power for
protection.
[130] Alluding to the exercise of the dispensing power, and the Declaration
of Indulgence.
[131] The ten-horned monster, in the Revelations, was usually explained
by the reformers as typical of the church of Rome.
[132] There was a classical superstition, that, if a wolf saw a man before
he saw the wolf, the person lost his voice:

——voxque Mærin
Jam fugit ipsa: lupi Mærin videre priores.
Dryden has adopted, in the text, the converse of this superstitious belief.
[133] Although the Roman Catholic plot was made the pretence of
persecuting the Papists in the first instance, yet the high-flying party of the
Church of England were also levelled at, and accused of being Tantivies,
Papists in masquerade, &c. &c.
[134] Hind and Panther Transversed.
[135] This office was usually held by the executioner, who, to this extent,
was a pluralist; and the change was chiefly made, to prevent the necessity
of producing that person in court, to the aggravation of the criminal's
terrors.
[136] "But separating this obliquity from the main intendment, the work
was vigorously carried on by the king and his counsellors, as appears
clearly by the doctrinals in the Book of Homilies, and by the practical part
of Christian piety, in the first public Liturgy, confirmed by act of parliament,
in the second and third year of the king; and in that act (and, which is
more, by Fox himself) affirmed to have been done by the especial aid of
the Holy Ghost. And here the business might have rested, if Catin's
pragmatical spirit had not interposed. He first began to quarrel at some
passages in this sacred liturgy, and afterwards never left soliciting the Lord
Protector, and practising by his agents on the court, the country, and the
universities, till he had laid the first foundation of the Zuinglian faction;
who laboured nothing more, than innovation both in doctrine and
discipline; to which they were encouraged by nothing more than some
improvident indulgence granted unto John A-Lasco; who, bringing with him
a mixt multitude of Poles and Germans, obtained the privilege of a church
for himself and his, distinct in government and forms of worship from the
church of England.
"This gave powerful animation to the Zuinglian gospellers, (as they are
called by Bishop Hooper, and some other writers) to practise first upon the
church; who being countenanced, if not headed, by the Earl of Warwick,
(who then began to undermine the Lord Protector,) first quarrelled the
episcopal habit, and afterwards inveighed against caps and surplices,
against gowns and tippets, but fell at last upon the altars, which were left
standing in all churches by the rules of liturgy. The touching on this string
made excellent music to most of the grandees of the court, who had
before cast many an envious eye on those costly hangings, that massy
plate, and other rich and precious utensils, which adorned those altars.
And what need all this waste? said Judas, when one poor chalice only, and
perhaps not that, might have served the turn. Besides, there was no small
spoil to be made of copes, in which the priest officiated at the holy
sacrament; some of them being made of cloth of tissue, of cloth of gold
and silver, or embroidered velvet; the meanest being made of silk, or satin,
with some decent trimming. And might not these be handsomely
converted into private use, to serve as carpets for their tables, coverlids to
their beds, or cushions to their chairs or windows. Thereupon some rude
people are encouraged under-hand to beat down some altars, which
makes way for an order of the council-table, to take down the rest, and set
up tables in their places; followed by a commission, to be executed in all
parts of the kingdom, for seizing on the premises to the use of the king."
[137] "Quo animo ipsum quoque Paulum dicere existimo, si potes liber fieri
utere potius, 1. Cor. 7. Quod eternum Dei concilium, patres nostri,
fortissimi viri, infracto animo secuti, miris victoriarum successibus ut
Sempachii," &c. And again, "Ipse Dominus libertatis author exstitit, et
honestam libertatem querentibus adest."—Pia et Amica Paranæsis ad
Suitensium rempublicam.
[138] Dalrymple's Memoirs, Vol. II. p. 108.
[139] The Hind and the Panther Transversed, p. 14.
[140] Alluding to the Popish Plot. See Note I.
[141] James II. then Duke of York, whom Shaftesbury and his party
involved in the odium of the plot.
[142] Plunket, the titular primate of Ireland, Whitebread, provincial of the
Jesuits, and several other Catholic priests, suffered for the alleged plot.
Derrick most absurdly supposes the passage to refer to the period of the
Civil War.
[143] Quarry signifies, properly, "dead game ready to be cut up by the
huntsman," which the French still call faire la curée. But it is often taken,
as in this passage, for the game in general. Vermin comprehends such wild
animals as are not game, foxes, polecats, and the like.
[144] Note II.
[145] The test-oath, against popery, in which transubstantiation is formally
disavowed. See Note III.
[146] There was a dispute among naturalists, whether sight was
accomplished per emissionem vel per receptionem specierum.
[147] Dolus versatur in generalibus, was an axiom of the schools.
[148] Note IV.
[149] The Catholics interpret our Saviour's promise, "that he would be with
the disciples to the end of the world," as applicable to their own church
exclusively.
[150] Note V.
[151] By the doctrine of consubstantiation.
[152] Alluding to Lucan's description of the Roman civil war.
[153] Note VI.
[154] See Note XIV. Part I. page 156.
[155] The gallows.
[156] By the Blatant Beast, we are generally to understand slander; see
Spenser's Legend of Courtesy. But it is here taken for the Wolf, or

You might also like