TAILIEUCHUNG - THE JR PROGRAMMING LANGUAGE phần 7

Ví dụ, nếu mã phục vụ cho hoạt động bao gồm tập tin I / O, sau đó một IOException có thể được ném ra. Nếu ngoại lệ này là tuyên truyền ra khỏi cơ thể của lệnh hoạt động, sau đó nó phải được bao gồm trong các điều khoản ném được chứng minh bởi các mã sau: | 214 Parallel Matrix Multiplication private op void strip int p final int R p S starting row compute S N inner products for int r R r R S r for int c 0 c N C double inner_prod local accumulator for int k 0 k N k inner_prod A r k B k c c r c V done The compute method creates the strip processes using send invocations and then waits for them to complete using a semaphore. That code could not be replaced only by declaring the equivalent family of processes using the process abbreviation because those processes might execute before the code in the compute method initializes instance variables used within strip. See Exercise . Many shared-memory multiprocessors employ caches with one cache per processor. Each cache contains the memory blocks most recently referenced by the processor. A block is typically a few contiguous words. The purpose of caches is to increase performance but they have to be used with care by the programmer or they can actually decrease performance due to cache conflicts . Reference 22 gives three rules-of-thumb programmers need to keep in mind Perform all operations on a variable especially updates in one process. Align data so that variables updated by different processors are in different cache blocks. Reuse data quickly when possible so it remains in the cache and does not get spilled back to main memory. A two-dimensional array in Java is an array of references to singledimensional arrays. So a matrix is stored in row-major order . by rows although adjacent rows are not necessarily contiguous. The above program therefore uses caches well. Each strip process reads one distinct strip of A and writes one distinct strip of C and it references elements of A and C by sweeping across rows. Every process references all elements of B but that is unavoidable. If B were transposed so that columns were actually stored in rows it too could be referenced efficiently. Dynamic Scheduling A Bag of Tasks 215 Dynamic Scheduling A .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.