Multi-threading related questions including technique, structure, and safety issues.

learn more… | top users | synonyms (5)

6
votes
2answers
744 views

Thread class design?

I have a method like this in my UI code: void MyDialog::OnCommandSaveData() { std::list<MyClass*> objects; service_->GetAll(objects); dataService_->SaveObjects(objects); ...
15
votes
6answers
2k views

Solutions to C# 5 async re-entrancy

So, something's been bugging me about the new async support in C# 5: The user presses a button which starts an async operation. The call returns immediately and the message pump starts running again ...
5
votes
2answers
2k views

Is there such a thing as too much asynchronous code?

I am at the moment messing around with clients and servers in C# winforms and I'm trying to implement it all asynchronously. However, I'm beginning to wonder, should I use asynchronous code for ...
20
votes
10answers
10k views

State machines vs threads

Alan Cox once said "A Computer is a state machine. Threads are for people who can't program state machines". Since asking Alan directly is not an option for humble me, I'd rather ask here: how does ...
4
votes
2answers
418 views

Multithreaded Programming? [closed]

Recently I've finished learning about multithreaded programming on single shared objects, but was curious about how different things would be in order to successfully program on multiple shared ...
5
votes
2answers
1k views

Erlang or 'x'.. Is it worth it (vs. Python w/ GIL)?

So, I've finally gotten myself to a point where I'm comfortable enough with Python (using Pyramid as my framework of choice) to undertake a rather large personal project. As it's a personal project, I ...
55
votes
15answers
9k views

How important is multithreading in the current software industry? [closed]

I have close to 3 years experience writing web applications in Java using MVC frameworks (like struts). I have never written multithreaded code till now though I have written code for major retail ...
2
votes
1answer
2k views

Common Qt Producer/Consumer Example: What is the point of multithreading here?

While trying to figure out how to implement a Producer/Consumer Queue in Qt, I stumpled upon several SO answers, blogs and sites linking to this site: You're doing it wrong... I got the point of ...
6
votes
1answer
9k views

THREADS: Kernel threads vs. Kernel-supported threads vs. User-level threads?

Does anyone know what the difference between these are? It seems to me that kernel threads correspond to the code that runs the kernel (intuitively), but I'm not sure about the other two... Also, ...
7
votes
5answers
253 views

When developing a piece of software, when do you start thinking/designing the concurrent sections?

Following along with the principle of not optimizing too early, I'm wondering at what point in the design / development of a piece of software do you start thinking about the concurrency ...
7
votes
1answer
3k views

Parallel programming library? (+ some features)

Note: this is a reposting as the question has been considered non-suitable for the Stack Overflow forum and should have been posted here. The original topic is there. I'd like to talk of ...
2
votes
3answers
2k views

Design choices when doing multithreading in C++

OK, so, background: I have a little "server" app/module that is written in C++. This is kindof a tunnel application that provides a standardized API via TCP/IP[a] and on the other hand talks to the ...
84
votes
13answers
40k views

What can multiple threads do that a single thread cannot? [closed]

While threads can speed up execution of code, are they actually needed? Can every piece of code be done using a single thread or is there something that exists that can only be accomplished by using ...
4
votes
4answers
379 views

What's the opposite colour to “green” for a native thread?

Simulated threads are known as "green threads" in programming-language-wonk speak. They are compared to "native threads" as provided by the operating system, but is there an analogous colour for ...
7
votes
2answers
226 views

Are Concurrency Abstractions Emulating UNIX Processes?

OK, I was pondering this today, and I've come to ask for completely subjective and bias opinions on it. Paradoxically, despite this, I don't think it's flame-war fodder either. I think there is room ...
0
votes
3answers
1k views

Design pattern for a multi-threaded URL fetcher in java

I'm looking for hints and suggestions on a design for a multi-threaded URL fetcher in java. Specific requirements are: To fetch each one of around 1,000 URLs periodically The interval between each ...
12
votes
7answers
1k views

What constitutes proper use of threads in programming?

I am tired of hearing people recommend that you should use only one thread per processor, while many programs use up to 100 per process! take for example some common programs vb.net ide uses about 25 ...
3
votes
3answers
297 views

How to you solve the problem of implicit locking and parallel execution?

Where the code is: function A() { lock() doSomething() unlock() } We can call A safely from multiple threads, but it never be executed in parallel . For parallel execution, we have to ...
7
votes
3answers
22k views

Multi-threading in C# .NET Windows Service

I am writing a Windows Service (using C# .NET 3.5 VS2008) and my requirement is: When the Windows Service start - it performs record check operation (in Database) @ every 30 second interval (I have ...
12
votes
7answers
1k views

Can anyone suggest a project for me write to help me understand threading

I am currently a C# developer with a pretty shaky understanding of threading. Both of these links have been suggested in other posts: http://www.yoda.arachsys.com/csharp/threads/ ...
10
votes
8answers
1k views

What lessons did you learn from a project which nearly/actually failed due to bad multithreading? [closed]

What lessons did you learn from a project which nearly/actually failed due to bad multithreading? Sometimes, the framework imposes a certain threading model that makes things an order of magnitude ...
1
vote
2answers
237 views

Descriptive Locking and Concurrency

I'm thinking about how one would go about designing a descriptive concurrency model for an OOP language that helps simplify concurrency scenarios for programmers (no easy task, concurrency is hard). ...
0
votes
5answers
1k views

Examples of concurrent iterating scenarios needed

I'm trying to wrap my head around different concurrency solutions to several threads iterating over the same collection but I'm having difficulty coming up with good realistic (but preferably easy to ...
14
votes
6answers
2k views

Why don't xUnit frameworks allow tests to run in parallel?

Do you know of any xUnit framework that allows to run tests in parallel, to make use of multiple cores in today's machine? If none (or so few) of them does it, maybe there is a reason... Is it that ...
0
votes
6answers
528 views

Structuring multi-threaded programs [closed]

Are there any canonical sources for learning how to structure multi-threaded programs? Even with all the concurrency utility classes that Java provides I'm having a hard time properly structuring ...
13
votes
4answers
4k views

Is It “Wrong”/Bad Design To Put A Thread/Background Worker In A Class?

I have a class that will read from Excel (C# and .Net 4) and in that class I have a background worker that will load the data from Excel while the UI can remain responsive. My question is as follows: ...
5
votes
3answers
859 views

What are the so-called “levels” of understanding multithreading?

I seem to remember reading somewhere some list of 4 "levels" of understanding multithreading. This may have been in a formal publication, or it may have been in an extremely informal context (even ...
17
votes
6answers
5k views

What do you look for when debugging deadlocks?

Recently I've been working on projects that heavily use threading. I think that I'm OK at designing them; use stateless design as much as possible, lock access to all resources that more than one ...
0
votes
1answer
49 views

Where to put profile test?

I have an application with multiple threads that may be run on different hardware. To assist with tuning on different hardware I would like to create a "profiler" that can automatically run a fixed ...
-1
votes
4answers
348 views

What is the point where multitreaded programming becomes slower than the problem?

I currently try to design an engine at the core level. However, I cannot decide if input thread should be mixed with a rendering thread or any other thread. Would making it an extra thread with all ...
2
votes
2answers
874 views

Multithreaded UI desktop application issues

I am involved into development a rich UI project: desktop windows application. Application uses asynchronous invocations and in its turn it should be ready to process external messages (events). The ...
2
votes
6answers
497 views

What threading pratice is good 90% of the time? [closed]

Since my SO thread was closed i guess i can ask it here. What practice or practices are good 90% of the time when working with threading with multiple cores? Personally all i have done was share ...
5
votes
1answer
235 views

Need to re-build an application - how?

For our main system, we have a small monitor application that sits outside our network and periodically tries to log in to verify the system still works. We have a problem with the monitor though in ...
28
votes
6answers
13k views

How would you practice concurrency and multi-threading? [closed]

I've been reading about concurrency, multi-threading, and how "the free lunch is over". But I've not yet had the possibility to use MT in my job. I'm thus looking for suggestions about what I ...
11
votes
7answers
1k views

What false ideas are there that puts people off using threads? [closed]

Implementing threading in a program is hard, yes, however why is it that some people will not implement them even when there is an obvious need for it. An example: Program has to load a dataset from ...
49
votes
19answers
9k views

Servicing background tasks on a large site

We're dealing with an interesting problem on StackOverflow. We've got a whole bunch of little "needs to be done soon-ish" tasks. An example is updating "Related Questions" lists. What we've done in ...
28
votes
8answers
6k views

How do I unit test multi-threaded code? [duplicate]

Are there ways to unit test your multi-threaded code for race conditions and deadlocks? To see if they are performing the way they should be...