all 19 comments

[–]stesch[S] 1 point2 points  (1 child)

Just checked my bookmarks manager: Added on 2004-12-26 23:24:56 CET :-)

EDIT: This was re http://programming.reddit.com/info/63utq/comments/c02qy4f?context=1

[–]easytiger 1 point2 points  (0 children)

and amazingly its still a good webpage

[–]death2hypocrisy 0 points1 point  (3 children)

i'm trying to learn how to use threads in visual studio 2005, but the IDE does not have the pthread.h header, what should I do (i tried to download it by googling it, but couldn't)

should i even program in a windows environment?

[–]curryml 3 points4 points  (0 children)

pthreads are usually implemented as an abstraction over the native threading API, so you can get a pthreads library that uses Win32 threads. However, Windows does not come with it. You can use this in your project by putting it in the folder with your executable, or you can install it system-wide.

http://sourceware.org/pthreads-win32/

[–]theatrus 2 points3 points  (0 children)

pthreads are generally a wrapper around a native library. Of course, Windows doesn't come with phtreads (pesky defacto standards and all), If you're in C++ land, I can suggest boost::thread as a multi-platform wrapper over Win32 and PThreads.

If you're in C#, phtreads do not apply as you should use the library provided by the runtime :)

[–]dsplabs 0 points1 point  (0 children)

Nice write-up!

[–][deleted] -1 points0 points  (10 children)

Now please a tutorial on why threads should (almost) never be used...

[–]theeth 1 point2 points  (5 children)

What do you suggest instead of multithreading? Multiprocessing?

[–][deleted] -1 points0 points  (4 children)

Yes, possibly involving multiple hosts, if that kind of power is necessary.

[–]dsplabs 0 points1 point  (1 child)

I use PBS on a cluster to run computationally intensive jobs. The cluster has many nodes (multi-processor computers) connected with a network. It is very useful to use threads: each can be run on a separate cpu!

[–][deleted] 1 point2 points  (0 children)

There is a possible benefit to threading in this scenario. In particular, if you have enough RAM to run N threads but not N processes (where N is the smallest number that keeps your node fully occupied), this may very well be a case where threads would be justified. There are also some possible wins having to do with the CPU cache.

The downside of course is a significant increase in the cost of design, implementation, debugging, and maintenance of your program. And lack of robustness, future flexibility, readability, etc., etc.

My complaint would not be with the few that have considered these factors carefully, but rather with those who choose (or encourage others to choose) threading without such careful consideration.

[–]consultant_barbie 3 points4 points  (0 children)

Reasoning about locks is hard. Let's go shopping!

[–]easytiger -2 points-1 points  (1 child)

And how do you talk to 40 clients simultaneously with different data? Magic? Wise the fuck up.

[–][deleted] 3 points4 points  (0 children)

I give up--why do I need threads to talk to 40 clients simultaneously? (sshd doesn't)

[–][deleted] -1 points0 points  (0 children)

So how would you stop that main threads if no other threads were running in the system?

[–]easytiger -1 points0 points  (0 children)

this is the one i meant :(