开发者

C++ Multithreading vs Python and the GIL

I have several questions about how multithreading is handled in C++. It is known that in Python, thanks to the GIL, having multiple threads running at the "same time" is not truly correct. Only one thread can execute an action at the time. Is this the case with C++? If I use multithreading in C++ is it really simultaneously multithreaded? Can I have multiple threads really running at the same time?.

T开发者_运维问答he other question is that, if I wrote a function in C++, say it is using multiple threads, and I wrap it to use it in Python, is the execution flow and performance of the function written in C++ affected by the GIL? How is this process handled behind the scenes? Will the threads initiated in the C++ function be affected by the Python GIL?

Also, is there any equivalent in C++ for the multiprocessing library in Python? Or all of this could be handled by the use of threads? Thanks in advance.

Parallelism and simultaneously multithreaded apps in C++ vs Python.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜