TAILIEUCHUNG - peer-topeer Networks phần 7

11,5 Mô-đun Mô-đun này phân chia nhiệm vụ thành các nhiệm vụ và trả về các mảng nhiệm vụ cho các module gọi. Các mã nguồn được trình bày trong hình. 11,8. 11,6 Module này khác nhau từ các (Chương 9) trong những cách sau đây: r mới | 158 11. Power Server Model 3 Note that it is important to distinguish the differences between getNextNumber and getTaskNumber methods. The getNextNumber returns the number of next available sub-task but the sub-task is not assigned to the thread yet. On the other hand the getNextTask method returns the number next available sub-task and assigns it to the thread. The sub-task is assigned only when the server is ready to process it. run Method In the run method the connection is checked by the following statement if connected return The sub-task is assigned by the following statement subTask The source codes of the addClientThread2 module are presented in Fig. . Module This module divides the task into sub-tasks and returns the task array to the calling module. The source codes are presented in Fig. . This module differs from the in Chapter 9 in the following ways Two new methods are added . getTaskNumber and getNextTask. The setGoAhead method is removed as this synchronization is not required. The following are the functions of the new methods getTaskNumber return the next available task number to the calling thread. getNextTask assign and return the next available sub-task number to the calling thread. The source codes of this module are presented in Fig. . Testing Programs can be tested in a similar way to Sections and . Again I would recommend that you start with one computer even if you have several computers in front of you. Testing 159 import . import . public class divide double x long endPosition long totalTasks boolean debug public divide double x long endPosition long totalTasks boolean debug if debug divide module x endPosition totalTasks debug public void go long width endPosition totalTasks dividing job into sub-tasks for int i 0 i i i 2 if i 0 x i 1 else x i x

TỪ KHÓA LIÊN QUAN
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.