Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com d ata b a s e systems Both Thomas Connolly and Carolyn Begg have experience of database design in industry, and now apply this in their teaching and research at the University of Paisley in Scotland A Practical Approach to Design, Implementation, and Management • Begg A clear introduction to design, implementation and management issues, as well as an extensive treatment of database languages and standards, make this book an indispensable complete reference for database students and professionals alike Features Complex subjects are clearly explained using running case studies throughout the book Database design methodology is explicitly divided into three phases: conceptual, logical, and physical Each phase is described with an example of how it works in practice SQL is comprehensively covered in three tutorial-style chapters Distributed, object-oriented, and object-relational DBMSs are fully discussed Check out the Web site at www.booksites.net/connbegg, for full implementations of the case studies, lab guides for Access and Oracle, and additional student support New! For the fourth edition • • • Extended treatment of XML, OLAP and data mining Coverage of updated standards including SQL:2003, W3C (XPath andXQuery), and OMG Now covers Oracle9i and Microsoft Office Access 2003 This book comes with a free six-month subscription to Database Place, an online tutorial that helps readers master the key concepts of database systems Log on at www.aw.com/databaseplace FOURTH EDITION d ata b a s e systems Over 200,000 people have been grounded in good database design practice by reading Database Systems The new edition of this best-seller brings it up to date with the latest developments in database technology and builds on the clear, accessible approach that has contributed to the success of previous editions an imprint of www.booksites.net/connbegg Connolly FOURTH EDITION • • • • • • Thomas Connolly Carolyn Begg d ata b a s e systems A Practical Approach to Design, Implementation, and Management www.booksites.net/connbegg www.booksites.net/connbegg www.pearson-books.com Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Databa se Systems A Companion Web site accompanies Database Systems, Fourth edition by Thomas Connolly and Carolyn Begg Visit the Database Systems Companion Web site at www.booksites.net/connbegg to find valuable learning material including: For Students: n n n n n n Tutorials on selected chapters Sample StayHome database Solutions to review questions DreamHome web implementation Extended version of File Organizations and Indexes Access and Oracle Lab Manuals Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com INTERNATIONAL COMPUTER SCIENCE SERIES Consulting Editor A D McGettrick University of Strathclyde SELECTED TITLES IN THE SERIES Operating Systems J Bacon and T Harris Programming Language Essentials H E Bal and D Grune Programming in Ada 95 (2nd edn) J G P Barnes Java Gently (3rd edn) J Bishop Software Design (2nd edn) D Budgen Concurrent Programming A Burns and G Davies Real-Time Systems and Programming Languages: Ada 95, Real-Time Java and RealTime POSIX (3rd edn) A Burns and A Wellings Comparative Programming Languages (3rd edn) L B Wilson and R G Clark, updated by R G Clark Distributed Systems: Concepts and Design (3rd edn) G Coulouris, J Dollimore and T Kindberg Principles of Object-Oriented Software Development (2nd edn) A Eliëns Fortran 90 Programming T M R Ellis, I R Philips and T M Lahey Program Verification N Francez Introduction to Programming using SML M Hansen and H Rischel Functional C P Hartel and H Muller Algorithms and Data Structures: Design, Correctness, Analysis (2nd edn) J Kingston Introductory Logic and Sets for Computer Scientists N Nissanke Human–Computer Interaction J Preece et al Algorithms: A Functional Programming Approach F Rabhi and G Lapalme Ada 95 From the Beginning (3rd edn) J Skansholm C++ From the Beginning J Skansholm Java From the Beginning (2nd edn) J Skansholm Software Engineering (6th edn) I Sommerville Object-Oriented Programming in Eiffel (2nd edn) P Thomas and R Weedon Miranda: The Craft of Functional Programming S Thompson Haskell: The Craft of Functional Programming (2nd edn) S Thompson Discrete Mathematics for Computer Scientists (2nd edn) J K Truss Compiler Design R Wilhelm and D Maurer Discover Delphi: Programming Principles Explained S Williams and S Walmsley Software Engineering with B J B Wordsworth Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com THOMAS M CONNOLLY • CAROLYN E BEGG UNIVERSITY OF PAISLEY Databa se Systems A Practical Approach to Design, Implementation, and Management Fourth Edition Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Pearson Education Limited Edinburgh Gate Harlow Essex CM20 2JE England and Associated Companies throughout the world Visit us on the World Wide Web at: www.pearsoned.co.uk First published 1995 Second edition 1998 Third edition 2002 Fourth edition published 2005 © Pearson Education Limited 1995, 2005 The rights of Thomas M Connolly and Carolyn E Begg to be identified as authors of this work have been asserted by the authors in accordance with the Copyright, Designs and Patents Act 1988 All rights reserved No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without either the prior written permission of the publisher or a licence permitting restricted copying in the United Kingdom issued by the Copyright Licensing Agency Ltd, 90 Tottenham Court Road, London W1T 4LP The programs in this book have been included for their instructional value They have been tested with care but are not guaranteed for any particular purpose The publisher does not offer any warranties or representations nor does it accept any liabilities with respect to the programs All trademarks used herein are the property of their respective owners The use of any trademark in this text does not vest in the author or publisher any trademark ownership rights in such trademarks, nor does the use of such trademarks imply any affiliation with or endorsement of this book by such owners ISBN 321 21025 British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library Library of Congress Cataloguing-in-Publication Data A catalog record for this book is available from the Library of Congress 10 09 08 07 06 05 Typeset in 10/12pt Times by 35 Printed and bound in the United States of America 628 | Chapter 20 z Transaction Management Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Exercises 20.17 Analyze the DBMSs that you are currently using What concurrency control protocol does each DBMS use? What type of recovery mechanism is used? What support is provided for the advanced transaction models discussed in Section 20.4? 20.18 For each of the following schedules, state whether the schedule is serializable, conflict serializable, view serializable, recoverable, and whether it avoids cascading aborts: (a) read(T1, balx ), read(T2, balx ), write(T1, balx ), write(T2, balx ), commit(T1), commit(T2) (b) read(T1, balx ), read(T2, baly), write(T3, balx ), read(T2, balx ), read(T1, baly), commit(T1), commit(T2), commit(T3) (c) read(T1, balx ), write(T2, balx ), write(T1, balx ), abort(T2), commit(T1) (d) write(T1, balx ), read(T2, balx ), write(T1, balx ), commit(T2), abort(T1) (e) read(T1, balx ), write(T2, balx ), write(T1, balx ), read(T3, balx ), commit(T1), commit(T2), commit(T3) 20.19 Draw a precedence graph for each of the schedules (a) to (e) in the previous exercise 20.20 (a) Explain what is meant by the constrained write rule and explain how to test whether a schedule is conflict serializable under the constrained write rule Using the above method, determine whether the following schedule is serializable: S = [R1(Z), R2(Y), W2(Y), R3(Y), R1(X), W1(X), W1(Z), W3(Y), R2(X), R1(Y), W1(Y), W2(X), R3(W), W3(W)] where Ri (Z)/Wi (Z) indicates a read/write by transaction i on data item Z (b) Would it be sensible to produce a concurrency control algorithm based on serializability? Justify your answer How is serializability used in standard concurrency control algorithms? 20.21 (a) Discuss how you would test for view serializability using a labeled precedence graph (b) Using the above method, determine whether the following schedules are conflict serializable: (i) (ii) (iii) S1 = [R1( X ), W2( X ), W1( X )] S2 = [W1( X ), R2( X ), W3( X ), W2( X )] S3 = [W1( X ), R2( X ), R3( X ), W3( X ), W4( X ), W2( X )] 20.22 Produce a wait-for graph for the following transaction scenario, and determine whether deadlock exists: Transaction Data items locked by transaction Data items transaction is waiting for T1 T2 T3 T4 T5 T6 T7 x2 x3, x10 x8 x7 x1, x5 x4, x9 x6 x1, x3 x7, x8 x4, x5 x1 x3 x6 x5 20.23 Write an algorithm for shared and exclusive locking How does granularity affect this algorithm? 20.24 Write an algorithm that checks whether the concurrently executing transactions are in deadlock Exercises | 629 Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 20.25 Using the sample transactions given in Examples 20.1, 20.2, and 20.3, show how timestamping could be used to produce serializable schedules 20.26 Figure 20.22 gives a Venn diagram showing the relationships between conflict serializability, view serializability, two-phase locking, and timestamping Extend the diagram to include optimistic and multiversion concurrency control Further extend the diagram to differentiate between 2PL and strict 2PL, timestamping without Thomas’s write rule, and timestamping with Thomas’s write rule 20.27 Explain why stable storage cannot really be implemented How would you simulate stable storage? 20.28 Would it be realistic for a DBMS to dynamically maintain a wait-for graph rather than create it each time the deadlock detection algorithm runs? Explain your answer ... write(T2, balx ), write(T1, balx ), abort(T2), commit(T1) (d) write(T1, balx ), read(T2, balx ), write(T1, balx ), commit(T2), abort(T1) (e) read(T1, balx ), write(T2, balx ), write(T1, balx ), read(T3,... write(T1, balx ), write(T2, balx ), commit(T1), commit(T2) (b) read(T1, balx ), read(T2, baly), write(T3, balx ), read(T2, balx ), read(T1, baly), commit(T1), commit(T2), commit(T3) (c) read(T1,... determine whether the following schedule is serializable: S = [R1(Z), R2(Y), W2(Y), R3(Y), R1(X), W1(X), W1(Z), W3(Y), R2(X), R1(Y), W1(Y), W2(X), R3(W), W3(W)] where Ri (Z)/Wi (Z) indicates a read/write