Theo mọi người, cài đặt Thread Pool kiểu này trong C# .netcore có vấn đề gì không? C# Thread Pool
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Cài đặt theo cách này sẽ có nhược điểm:
1. Giả sử các task có độ phức tạp khác nhau thì sẽ có luồng ngồi chơi còn có luồng phải hoạt động liên tục và task sẽ bị delay, ví dụ:
Thread1: task11, task12, task13
Thread2: task21, task22, task23
Thread3: task31, task32, task33
Giả sửa các task11, task12, và task12 là các task dễ thì thread1 sẽ được kết thúc rất nhanh, và lẽ ra nó phải có task xử lý tiếp, tuy nhiên các task trên Thread2, Thread3 đều rất nặng nên các task này bị delay trong khi thread1 đang ngồi chơi.
2. Bạn sẽ rất khó để quyết định khi nào sẽ tạo thêm thread, vì để tạo được thêm thread bạn sẽ phải biết khi nào task kết thúc để quản lý được trạng thái của các thread.