Slashdot Mirror


Pthreads vs Win32 threads

An anonymous reader writes "It's interesting when different people have different opinions. While I was searching for something on Intel's website, I came across an article on why Windows threads are better than Posix threads. Curiously, I also came across this article on why Posix Pthreads are better that Win32 threads. The thing is, both of these articles are written by the same author!

So who is right (metaphorically speaking?), or what has changed since the first article was written?"

16 of 385 comments (clear)

  1. quothe the poster by TinBromide · · Score: 5, Insightful

    "or what has changed since the first article was written?"

    Vista's release and a massive advertising campaign/increase in revinue for microsoft partners?

    --
    Is it sad that I am more likely to recognize you and your posts by your sig than your name or UID?
    1. Re:quothe the poster by should_be_linear · · Score: 5, Funny

      I have different theory: Dude has 2 separate threads in his brain. Comparing pthreads to Win32 threads only exposed dangerous race condition producing funny effects in his blog.

      --
      839*929
    2. Re:quothe the poster by Hal_Porter · · Score: 5, Funny

      Q)Why did the multithreaded chicken cross the road?
      A)to To other side. get the

      Q)Why did the multithreaded chicken cross the road?
      A)other to side. To the get

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    3. Re:quothe the poster by PitaBred · · Score: 5, Informative
      Did you notice the other similarities?

      Initial (2003) article:

      I've used both POSIX threads (Pthreads) and Win32 threads APIs and I believe that Pthreads has the better programming model of the two. While each threading method can create threads, destroy threads, and coordinate interactions between threads, the reason I make this claim is the simplicity of use and elegance of design of Pthreads. Let me illustrate with a few examples.
      And in the later article:

      I've used both POSIX threads (Pthreads) and Windows threads APIs, and I believe that Windows has the better programming model of the two. While each threading method can create threads, destroy threads, and coordinate interactions between threads, the reason I make this claim is the simplicity of use and elegance of design of the Windows threads API. This is all from the perspective of multithreaded code developers or maintainers. Let me illustrate with a few examples.
      It's not plagiarism because he copied from himself and just added a few edits, but c'mon... how lazy of a shill can you be?
    4. Re:quothe the poster by 0xABADC0DA · · Score: 5, Funny

      Q) Which came first, the multithreaded chicken or the multithreaded egg?
      A) They came at the same time, but the multithreaded chicken terminated first.

      Q) Which came first, the multithreaded chicken or the multithreaded egg?
      A) Neither; mt egg could not acquire chicken-lock from mt chicken. mt chicken could not acquire egg-lock from mt egg.

      Q) Which came first, the multithreaded chicken or the multithreaded egg?
      A) Multithreaded egg, but it overwrote its DNA while still in use and became mt turkey.

  2. Pthreads = Win32 threads? by arlo5724 · · Score: 5, Funny

    ( Pthreads >= Win32 threads ) and ( Win32 threads >= Pthreads ) => Pthreads = Win32 threads

    1. Re:Pthreads = Win32 threads? by anci_pants · · Score: 5, Funny

      I think you mean Pthreads == Win32 threads.

      Although, it may be true that Win32 threads = Pthreads (which may account for the improvement)

  3. From the obvious dept by hey · · Score: 5, Funny

    If you are programming on Widows I would recommend Windows threads, while on *nix Pthreads are a better choice.

    1. Re:From the obvious dept by Hal_Porter · · Score: 5, Funny

      Windows threads work on BOTH platforms, Windows XP/Vista and Windows CE.

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
  4. Re:Look at the dates, Dude. by Anonymous Coward · · Score: 5, Informative

    Except that the 2006 entry is essentially a structural copy of the 2003 entry, just with some wording changes. He even uses the same arguments against PThreads in the second entry that he used to support it in the first. Weird...

  5. Re:Look at the dates, Dude. by AKAImBatman · · Score: 5, Interesting

    I have a feeling that as the author worked more and more with the different threading models, he seems to have a more matured opinion.

    Normally I'd agree with you. But if you read both articles, you realize that his intentions may be a bit less honorable. The Win32 article is the exact same article, but with the conclusions changed. Maturing opinions usually result in some discussion of why one has changed their mind (even if it's only mentioned in passing) and/or a deep explanation of what caused their mind to change. This smells more like an attempt to play both sides.

    Of course, it could be that the author is simply not comfortable with writing. He could be looking to make a quick buck by taking a simple forum post of his and modifying it to reflect his current opinion. It's worth giving him the benefit of the doubt on, but I am certainly suspicious.
  6. Re:Yes, the real world is a complicated place. by Ctrl-Z · · Score: 5, Insightful

    It is perfectly feasable for there to be ways in which Win32 threads are better than Pthreads (as hard as that is to believe), and also vice versa. Hence the two articles. You didn't read the two articles, did you?

    From the first one:

    I've used both POSIX threads (Pthreads) and Win32 threads APIs and I believe that Pthreads has the better programming model of the two. While each threading method can create threads, destroy threads, and coordinate interactions between threads, the reason I make this claim is the simplicity of use and elegance of design of Pthreads. Let me illustrate with a few examples. And, from the second one:

    I've used both POSIX threads (Pthreads) and Windows threads APIs, and I believe that Windows has the better programming model of the two. While each threading method can create threads, destroy threads, and coordinate interactions between threads, the reason I make this claim is the simplicity of use and elegance of design of the Windows threads API. This is all from the perspective of multithreaded code developers or maintainers. Let me illustrate with a few examples.
    --
    www.timcoleman.com is a total waste of your time. Never go there.
  7. Re:PThreads is better by PhrostyMcByte · · Score: 5, Informative

    You're in luck-

    Vista comes with APIs for condition variables and reader-writer locks so you don't have to spend 15 minutes writing your own.

  8. Re:quothe the poster-What Has Changed by Nom+du+Keyboard · · Score: 5, Insightful
    "or what has changed since the first article was written?"

    What has likely changed is were the paycheck came from this week.

    --
    "It's the height of ridiculousness to say for those 9 lines you get hundreds of millions."
  9. Re:And so the point becomes... by skoaldipper · · Score: 5, Funny

    > Who gives a shit. They're just threads, man. Both work.

    You know, I said this very same thing back in the 70s. However, my buddy with the bell bottoms and KISS shirt got more play than I ever did with my adidas shorts and Vader cape.

    --
    I hope, when they die, cartoon characters have to answer for their sins.
  10. Re:Eeew, threads. by Mysticalfruit · · Score: 5, Interesting

    A while back I had to write a server that would recieve concurrent network connections from different clients and then get some data from those clients and do some processing and then interact with a database, then when it's done the fork exits.

    I ended up writing the whole thing using forks and no pthreads. My code was then subjected to a code review and one of the questions that came up in the review meeting was why I used fork and didn't do the implementation in pthreads. My arguement was one of complexity. I was challenged with the "fork is old technology, you should have used pthreads" and my response was "My implementation is easy to understand, oh and by the way, it works!"

    Needless to say, my code has been in production for about a year and a half with no issues. I'm sure someone smarter than me could have wrote the whole using pthreads, but I'm just not sure what it would have gained them other than a slightly smaller memory footprint but at the price of increased complexity.

    --
    Yes Francis, the world has gone crazy.