jeudi 3 décembre 2015

What if anything can you use as a 64-bit threading model in GCC (C++) in Windows, in relation to what Visual Studio offers?

Here's the whole question I wanted to ask:

What is the relationship between the most recent/fastest/most advanced threading system for Windows you might find in Microsoft's Visual Studio C++ and the various things you would use for threading in Windows in GCC and other compilers?

Today I installed MinGW-w64 to get a working GCC installation on Windows 7. http://ift.tt/1egcudB

The options in the installer have you select which threading model you want to do, either posix (via winpthreads) or win32. I feel like neither of these options are good options, and there are a few things I don't understand.

I heard that while the windows port of the POSIX threads library allows you to use std::thread, it's also slower than Win32 so if you can get over the inconvenience of not having std::thread then it's better to use the Win32 threading model. I also seem to have some understanding that regardless of which model you select, you can use the APIs of whichever model separately on your own terms. In general I would of course want the fastest threading with the most features, but it seems like this is nothing but tradeoffs and unfinished work.

What part of the standard library uses threading for its execution so that the selection of the internal threading model becomes significant? How is it that GCC has a native Win32 threading model? Is this a wrapper around something Microsoft made, or something that was made from scratch to interface with Microsoft's threading model?

Wouldn't there be a 64-bit Windows threading model too? Is this what Visual Studio uses? How would the 32-bit version work with the system's threading where a lot of other threads are programmed in 64-bit? I've heard that GCC is faster than Visual Studio these days but it bothers me that it would yet have an inferior out of date threading system.

If I use the Win32 model, what kind of code do I use to use that? Is it any different from what you would do in Visual Studio? What if I wanted to use the Win64 threading model (as in what Visual Studio would maybe have) for my GCC code assuming it exists? Is there an API that works with GCC I can use (or even develop as a wrapper) for that, or am I stuck using something that's just not as good?

I don't really need to hear that the advantages of 64-bit are a myth. To me it's more important that the advantages and disadvantages exist and I need to be able to work in 64-bit to take advantage of everything that I can, so it bothers me that I would be locked out of it for thread processing because nobody bothered to program it in GCC. I want to use GCC but I don't know what to think right now. Or maybe even LLVM.

(It said the question appears subjective. I'm merely asking for an reason why these things do or do not exist in GCC and other compilers, or even if they do or do not in the first place, or if "64-bit threading models" really exist at all.)

Aucun commentaire:

Enregistrer un commentaire