TAILIEUCHUNG - Parallel Programming: for Multicore and Cluster Systems- P29

Parallel Programming: for Multicore and Cluster Systems- P29: Innovations in hardware architecture, like hyper-threading or multicore processors, mean that parallel computing resources are available for inexpensive desktop computers. In only a few years, many standard software products will be based on concepts of parallel programming implemented on such hardware, and the range of applications will be much broader than that of scientific computing, up to now the main application area for parallel computing | 272 6 Thread Programming thread releases the mutex variable and proceeds with the execution of the succeeding program part. If the specified condition is not fulfilled pthread_cond_wait is called. This call has the effect that the specified mutex variable mutex is implicitly released and that the executing thread is blocked waiting for the condition variable until another thread sends a signal using pthread_cond_signal to notify the blocked thread that the condition may now be fulfilled. When the blocked thread is woken up again in this way it implicitly tries to lock the mutex variable mutex again. If this is owned by another thread the woken-up thread is blocked again now waiting for the mutex variable to be released. As soon as the thread becomes the owner of the mutex variable mutex it continues the execution of the program. In the context of the usage pattern from above this results in a new evaluation of the condition because of the while loop. In a Pthreads program it should be ensured that a thread which is waiting for a condition variable is woken up only if the specified condition is fulfilled. Nevertheless it is useful to evaluate the condition again after the wake up because there are other threads working concurrently. One of these threads might become the owner of the mutex variable before the woken-up thread. Thus the woken-up thread is blocked again. During the blocking time the owner of the mutex variable may modify common data such that the condition is no longer fulfilled. Thus from the perspective of the executing thread the state of the condition may change in the time interval between being woken up and becoming owner of the associated mutex variable. Therefore the thread must again evaluate the condition to be sure that it is still fulfilled. If the condition is fulfilled it cannot change before the executing thread calls pthreaimute unlock or pthread_cond_wait for the same condition variable since each thread must be the owner of the .

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.