Parallel Programming: for Multicore and Cluster Systems- P35

Parallel Programming: for Multicore and Cluster Systems- P35: 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 | 332 6 Thread Programming public int getPriority public int setPriority int prio of the Thread class. If there are more executable threads than free processors a thread with a larger priority is usually favored by the scheduler of the JVM. The exact mechanism for selecting a thread for execution may depend on the implementation of a specific JVM. The Java specification does not define an exact scheduling mechanism to increase flexibility for the implementation of the JVM on different operating systems and different execution platforms. For example the scheduler might always bring the thread with the largest priority to execution but it could also integrate an aging mechanism to ensure that threads with a lower priority will be mapped to a processor from time to time to avoid starvation and implement fairness. Since there is no exact specification for the scheduling of threads with different priorities priorities cannot be used to replace synchronization mechanisms. Instead priorities can only be used to express the relative importance of different threads to bring the most important thread to execution in case of doubt. When using threads with different priorities the problem of priority inversion can occur see also Sect. p. 303. A priority inversion happens if a thread with a high priority is blocked to wait for a thread with a low priority . because this thread has locked the same mutex variable that the thread with the high priority tries to lock. The thread with a low priority can be inhibited from proceeding its execution and releasing the mutex variable as soon as a thread with a medium priority is ready for execution. In this constellation the thread with high priority can be prevented from execution in favor of the thread with a medium priority. The problem of priority inversion can be avoided by using priority inheritance see also Sect. If a thread with high priority is blocked . because of an activation of a synchronized method then the

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
1    84    2    07-06-2024
Đã 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.