TAILIEUCHUNG - Lập trình .net 4.0 và visual studio 2010 part 18

Tạo nhiều chủ đề để thực hiện một lượng nhỏ công việc có thể thực sự kết thúc mất nhiều thời gian hơn thực hiện công tác trên một sợi đơn. Điều này là do thời gian slicing và trên không những tham gia vào khóa, và thêm và loại bỏ các mục vào hàng đợi hồ thread. | CHAPTER 5 PARALLELIZATION AND THREADING ENHANCEMENTS Coordination Data Structures CDS and Threading Enhancements In .NET the thread pool has been enhanced and a number of new synchronization classes have been introduced. Thread Pool Enhancements Creating many threads to perform small amounts of work can actually end up taking longer than performing the work on a single thread. This is due to time slicing and the overhead involved in locking and adding and removing items to the thread pools queue. Previously the queue of work in the thread pool was held in a linked list structure and utilized a monitor lock. Microsoft improved this by changing to a data structure that is lock-free and involves the garbage collector doing less work. Microsoft says that this new structure is very similar to ConcurrentQueue discussed shortly . The great news is that you should find that if your existing applications are using the thread pool and you upgrade them to .NET then your applications performance should be improved with no changes to your code required. Calling the new method tells the thread to give its remaining time with the processor time slice to another thread. It is up to the operating system to select the thread that receives the additional time. The thread that yield is called on is then rescheduled in the future. Note that yield is restricted to the processor core that the yielded thread is operating within. The method has a new overload that takes a Boolean parameter by reference and sets it to true if the monitor call is successful. For example bool gotLock false object lockObject new object try lockObject ref gotLock Do stuff finally if gotLock lockObject 118 CHAPTER 5 PARALLELIZATION AND THREADING ENHANCEMENTS Concurrent Collections The concurrent collection classes are thread-safe versions of many of the existing collection classes that should be used for multithreaded or .

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.