snehil89 wrote:The scheduler borrows one thread from the pool for every Task to execute, and if the majority of tasks takes a relatively long time to complete the scheduler will eventually run out of threads and become laggy.
If the schedular is laggy will it not even submit any new tasks, i thought it utilizes a queue to hold tasks.
No, you can add more tasks while the threads are busy. The Scheduler cannot predict when the next thread will be available for work, it could take 1 millisecond or 1 minute. There's no reason to deny the task submission.
Since you already have said that Tasks are dependent on external I/O then the solution is to either optimize these calls so that they take less time to complete or fine tune the thread pool so that you don't end up with all threads busy at the same time.
Cheers