What are the differences between the threading and multiprocessing modules?

I am learning how to use the threading and the multiprocessing modules in Python to run certain operations in parallel and speed up my code. I am finding this hard (maybe because I don’t have any theoretical background about it) to understand what the difference is between a threading.Thread() object and a multiprocessing.Process() one. Also, … Read more

No ConcurrentList in .Net 4.0?

I was thrilled to see the new System.Collections.Concurrent namespace in .Net 4.0, quite nice! I’ve seen ConcurrentDictionary, ConcurrentQueue, ConcurrentStack, ConcurrentBag and BlockingCollection. One thing that seems to be mysteriously missing is a ConcurrentList<T>. Do I have to write that myself (or get it off the web 🙂 )? Am I missing something obvious here? 12 … Read more

What is the difference between asynchronous programming and multithreading?

I thought that they were basically the same thing — writing programs that split tasks between processors (on machines that have 2+ processors). Then I’m reading this, which says: Async methods are intended to be non-blocking operations. An await expression in an async method doesn’t block the current thread while the awaited task is running. … Read more

What is the difference between concurrent programming and parallel programming?

What is the difference between concurrent programming and parallel programing? I asked google but didn’t find anything that helped me to understand that difference. Could you give me an example for both? For now I found this explanation: http://www.linux-mag.com/id/7411 – but “concurrency is a property of the program” vs “parallel execution is a property of … Read more

How to wait for all threads to finish, using ExecutorService?

I need to execute some amount of tasks 4 at a time, something like this: ExecutorService taskExecutor = Executors.newFixedThreadPool(4); while(…) { taskExecutor.execute(new MyTask()); } //…wait for completion somehow How can I get notified once all of them are complete? For now I can’t think about anything better than setting some global task counter and decrease … Read more