Technically, why are processes in Erlang more efficient than OS threads?

Erlang’s Characteristics From Erlang Programming (2009): Erlang concurrency is fast and scalable. Its processes are lightweight in that the Erlang virtual machine does not create an OS thread for every created process. They are created, scheduled, and handled in the VM, independent of underlying operating system. As a result, process creation time is of the … Read more

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

How efficient is locking an unlocked mutex? What is the cost of a mutex?

In a low level language (C, C++ or whatever): I have the choice in between either having a bunch of mutexes (like what pthread gives me or whatever the native system library provides) or a single one for an object. How efficient is it to lock a mutex? I.e. how many assembler instructions are there … Read more

How to use WPF Background Worker

In my application I need to perform a series of initialization steps, these take 7-8 seconds to complete during which my UI becomes unresponsive. To resolve this I perform the initialization in a separate thread: public void Initialization() { Thread initThread = new Thread(new ThreadStart(InitializationThread)); initThread.Start(); } public void InitializationThread() { outputMessage(“Initializing…”); //DO INITIALIZATION outputMessage(“Initialization … Read more

Python Threading String Arguments

I have a problem with Python threading and sending a string in the arguments. def processLine(line) : print “hello”; return; . dRecieved = connFile.readline(); processThread = threading.Thread(target=processLine, args=(dRecieved)); processThread.start(); Where dRecieved is the string of one line read by a connection. It calls a simple function which as of right now has only one job … Read more

How can I wait for a thread to finish with .NET?

I’ve never really used threading before in C# where I need to have two threads, as well as the main UI thread. Basically, I have the following. public void StartTheActions() { // Starting thread 1…. Thread t1 = new Thread(new ThreadStart(action1)); t1.Start(); // Now, I want for the main thread (which is calling `StartTheActions` method) … Read more

What is the most frequent concurrency issue you’ve encountered in Java? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

Concurrent HashSet in .NET Framework?

I have the following class. class Test{ public HashSet<string> Data = new HashSet<string>(); } I need to change the field “Data” from different threads, so I would like some opinions on my current thread-safe implementation. class Test{ public HashSet<string> Data = new HashSet<string>(); public void Add(string Val){ lock(Data) Data.Add(Val); } public void Remove(string Val){ lock(Data) … Read more