Tài liệu The Art of Concurrency pdf

303 1.1K 4
Tài liệu The Art of Concurrency pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... consider the case where Process 1 (P1) requires a vector of values from Process 0 (P0) The program running as P0 must include logic to package the vector into a buffer and call the function that will send the contents of that buffer from the memory of the node on which P0 is running across the network connection between the nodes and deposit the buffer contents into the memory of the node running P1 On the. .. already designed and written, the functionality of the application is known You should also know which outputs are generated for given inputs Now you need to find the parts of the code that can be threaded; that is, those parts of the application that contain independent computations If you know the application well, you should be able to home in on these parts of the code rather quickly If you are less... the same location, the order of the updates to the memory location will determine the value that is ultimately stored there and the value that will be read out of the location by another thread (recall the airline reservation system that put two passengers in the same seat) When you have one thread reading and one thread writing to the same memory location, the value that is being read can be one of. .. of these have focused on message-passing as the method of parallelization Some of the earlier texts detail algorithms where the network configuration (e.g., mesh or hypercube) is an integral part of the algorithm design; later texts tend not to focus so much on developing algorithms for specific network configurations, but rather, think of the execution platform as a cluster of processor nodes In the. .. to another, while static allocation will always assign the same work to the same threads (if the number of threads is the same) each and every time 16 CHAPTER 1: WANT TO GO FASTER? RAISE YOUR HANDS IF YOU WANT TO GO FASTER! Typically, if the work can be broken up into a number of parts that is equal to the number of threads/processes, and the execution time is roughly the same for each of those parts,... writes a value into a memory location and the other thread reads the value out of that memory location Of course, to ensure that the data is transferred correctly, the writing thread must deposit the value to be shared into memory before the reading thread examines the location Thus, the threads must synchronize the order of writing and reading between the threads The send-receive exchange is an implicit... able to find these kinds of errors with any tool that looks for threading errors, but you may be able to home in on the problem with the use of some sort of debugging tool One of the minor themes of this book is the typical logic errors that can be introduced around threaded code and how to avoid these errors in the first place With a good solid design, you should be able to keep the number of threading... serially When the results of those serial computations must be shared, you can perform the computation in one process and broadcast the results out to the other processes that require the data Sending this information will add overhead to the execution time On the other hand, if the data used in the computation is already available to other processes, you can have each process perform the computation... users of the software to find out what functionality is desired, what the input and output specifications are, and, based on the feedback, formally specify the functionality to be included, a general structure of the application, and the code to implement it Design Set down more detailed plans of the application and the functional components of the application Implement Write the code for the application... to improve the execution time A maintenance step is not part of the threading methodology I assume that once you have an application written, serial or concurrent, that application will be maintained as part of the normal course of business The four steps of the threading methodology are considered in more detail in the following sections Step 1 Analysis: Identify Possible Concurrency Since the code . y0 w0 h1" alt="" The Art of Concurrency Clay Breshears Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo The Art of Concurrency by Clay. Edition. O’Reilly and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. The Art of Concurrency , the image of wheat-harvesting combines,

Ngày đăng: 16/02/2014, 06:20

Từ khóa liên quan

Mục lục

  • Oreilly - The Art of Concurrency (06-2009) (ATTiCA)

  • Table of Contents

  • Preface

    • Why Should You Read This Book?

    • Who Is This Book For?

    • What’s in This Book?

    • Conventions Used in This Book

    • Using Code Examples

    • Comments and Questions

    • Safari® Books Online

    • Acknowledgments

    • Some Questions You May Have

      • What Is a Thread Monkey?

      • Parallelism and Concurrency: What’s the Difference?

      • Why Do I Need to Know This? What’s in It for Me?

      • Isn’t Concurrent Programming Hard?

      • Aren’t Threads Dangerous?

      • Four Steps of a Threading Methodology

        • Step 1. Analysis: Identify Possible Concurrency

        • Step 2. Design and Implementation: Threading the Algorithm

        • Step 3. Test for Correctness: Detecting and Fixing Threading Errors

        • Step 4. Tune for Performance: Removing Performance Bottlenecks

          • The testing and tuning cycle

          • What About Concurrency from Scratch?

Tài liệu cùng người dùng

Tài liệu liên quan