views:

364

answers:

9

Should there be any preconditions to be fulfilled by a team if the team were to be assigned a task that would involve a good deal of multi-threaded coding?

What would you look for?

+2  A: 

Threading is often so intricate and so implementation specific that I think the only valid way to assess this would be to set them a mock task (in the desired architecture) and "have at it". Something that involves competing readers/writers/workers - and UI if needed.

Of course... you also need to have somebody qualified to assess their efforts...

You could also talk about overall principles, but I'm not sure that covers it. As an example, just yesterday in the C# area there was a lot of confusion about some subtle issues that involved the memory-model, the language spec and the clr spec. You can't assess that type of detail in vague terms; it has to be very specific to the problem.

Equally, the tools / approaches change per framework. OCAML / F# etc has very different threading code to Java/C# - and even that changes per version (see Parallel Extensions/TPL vs things like ReaderWriterLockSlim in 3.5 vs ReaderWriterLock in 2.0)

Marc Gravell
good point about approaches Erlang doesn't even have threads
Sam Saffron
+1  A: 

I'd look for some damn good programamers.

In addition, more important even than that, is to have a team that can think about the architecture of whatever you're working on. In complex systems you've got to have a workable design to start with - you just can't make it up as you go along and hope for the best.

DavidK
+1  A: 

Give them a broken multi threaded problem and get them to fix it.

Ask them:

  • What is transactional memory?
  • Why do people hate shared state concurrency?
  • What is a livelock?
  • What are actors?
  • Whats the deal with those dining philosophers?
  • How do you structure complex multithreaded apps?
  • Why only 1 UI thread?
  • What is a mutex? What is a semaphore?
  • Whats a reader writer lock, and why would you use it?
  • When is it time to create a new thread?
  • What are green threads, what are fibers?

The tricky thing is to find an expert in the field you will need an expert to start off with.

Sam Saffron
This can be next to impossible. I'd rather hire programmers who don't write broken apps in the first place.
anon
Great idea, but how are you going to find them? I think that's what the question is about. I think the approach where you show them some broken code (written by someone else, not themselves!) is quite good. A programmer who quickly identifies the race condition, potential deadlock or whatever in a non-trivial example is likely to be able to write good MT code.
Robert Petermeier
@Neil, simple problems can be fixed, however the "real world" tm, is filled with complex hard to debug multi threaded problems which can be impossible to fully grok. Hence why the current trend towards message passing and actor like frameworks or transactional memory. Debugging is a key skill required by any developer that has to deal with complex multi threading code.
Sam Saffron
@Robert, from the question I understood that the OP has a pool of people to choose from, this could be a filter
Sam Saffron
+10  A: 

Get the team over to the coffee room for drinks, make sure there's only 1 spoon available.

Bonus: whoever stirs their coffee before the others have put sugar in, loses.


(seriously, ask them, and see who knows about object members with shared objects between 2 threads, and other shared resources. Ask them how to prevent this, then ask them how to make your MT app perform without putting locks everywhere. Ask them about deadlocks. If they don't know the answers, they're not experienced enough for you, or need to read up on the subject and have good design reviews of the code once they start).

gbjbaanb
A: 

Interesting question... Maybe you could take a real multithreading-related bug from production code and let them fix it. Ideally from a system they'd be working with. Perhaps break it down to the multithreading aspects so they don't have to learn the whole system.

Robert Petermeier
A: 

I'd hire people with a track record of implementing MT applications on the architectures you are interested in, using the languages you use. I know that this seems heartless, and that everyone has to start learning a new technology somewhere, but I'm selfish enough not to want them to do it on my projects!

anon
You could perhaps hire N-1 people like that, and 1 person who has other skills relevant to the project but who is forbidden from making any decisions about anything without review. Not that anyone should make big decisions on their own, but this person in particular has the potential to design something that will eventually need to be junked...
Steve Jessop
+1  A: 

A team would require at least one person who is experienced with this. Especially an architect (if you have this role) should be experienced. To check: normally it is visibile in peoples resume (if external). Otherwise, just ask some open questions. Like : how would you tackle synchronisation betweeen two tasks I'd be interested in : * attitude * process (i.e. it's a good sign if people have some relevant questions) and then you can still throw in a why do you think this is a good solution?

Of course you'd still need someone who can judge the correctness of their answers, as several correct solutions are possible.

Adriaan
A: 

Look for functional programmers. Often the best way to avoid issues with multithreading is not to ensure that they don't happen, but to ensure that they can't happen: instead of making side-effects thread-safe, don't use side-effects. That's exactly what functional programming does. Your functional programmers will carry this idea into their non-functional code.

Imagist
good answer, but it doesn't need to be functional, just split the threads into almost unrelated areas. eg a game may use 3 threads: 1 for display, 1 for AI and 1 for sound, they hardly interact with each other.
gbjbaanb
A: 

Have them explain the concept of "visibility" in Java. This is so complicated that you can only get it right with serious former exposure.

Ringding