3 ms·
I was under the impression that GCD used green threads, which means it's sharing the same address space, and ultimately would be subject to the GIL? When you'r
by danpalmer 10y ago
I was under the impression that GCD used green threads, which means it's sharing the same address space, and ultimately would be subject to the GIL?
When you're memory bound, sharing the address space is important, and Celery might not work well at all.
- mdomans 10y agoDepends on how much memory we're talking about. In regard to GCD - AFAIK it uses classic posix threads. In regard to GIL, if you can indeed guarantee that each task is atomic and lockless, you can use the same approach pyparralel uses
- danpalmer 10y agoI believe GCD actually multiplexes green threads across a pool of posix threads, which wouldn't work for Python because of the GIL.
- richardwhiuk 10y agoCorrect. GCD has dispatch_queues, and each block on the dispatch queue will be executed on one of a pool of posix threads.
- mdomans 10y agoThat's correct, but looking at the Python internals it seems that working around the GIL is possible if having this pattern exposed to end programmer.