ThreadPool max threads

Firstly, your “knowledge” of the defaults is incorrect. The limit of 25 threads per processor was back from .NET 1.1. It was increased in .NET 2, and now: Beginning with the .NET Framework version 4, the default size of the thread pool for a process depends on several factors, such as the size of the … Read more

What is the difference between SynchronizationContext.Send and SynchronizationContext.Post?

Send – synchronous: wait for answer (or action completed) Post – asynchronous: drop off and continue So your example uses the correct methods at the right moments. There is no need to halt the for-loop until the progress update is complete (on the contrary). And Execute does want to wait for the Action to complete, … Read more

Propagating ThreadLocal to a new Thread fetched from a ExecutorService

The set of ThreadLocal instances associated with a thread are held in private members of each Thread. Your only chance to enumerate these is to do some reflection on the Thread; this way, you can override the access restrictions on the thread’s fields. Once you can get the set of ThreadLocal, you could copy in … Read more

What’s the advantage of a Java-5 ThreadPoolExecutor over a Java-7 ForkJoinPool?

ThreadPool (TP) and ForkJoinPool (FJ) are targeted towards different use cases. The main difference is in the number of queues employed by the different executors which decide what type of problems are better suited to either executor. The FJ executor has n (aka parallelism level) separate concurrent queues (deques) while the TP executor has only … Read more

Difference between delegate.BeginInvoke and using ThreadPool threads in C#

Joe Duffy, in his Concurrent Programming on Windows book (page 418), says this about Delegate.BeginInvoke: All delegate types, by convention offer a BeginInvoke and EndInvoke method alongside the ordinary synchronous Invoke method. While this is a nice programming model feature, you should stay away from them wherever possible. The implementation uses remoting infrastructure which imposes … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)