> On Apr 11, 2017, at 9:10 AM, Gerard Iglesias via swift-users 
> <swift-users@swift.org> wrote:
> 
> Thanx for the link on this…
> 
> I am experimenting the use of dispatch queue to mimic somme Actor Model 
> things and it is not a bad idea, dispatch queue are perfect for that.
> 
> I wonder what is the scalability of the Dispatch layer, are we able to create 
> a bunch of dispatch queue without putting the system on its knees ? I will do 
> tests

Dispatch queues are intended to be cheap, comparable to a pthread_mutex IIRC.

The limited resource are the top-level global queues, DispatchQueue.main and 
DispatchQueue.global(…). There are a limited number of threads available to 
service concurrent items on those queues (around 500 threads on macOS and iOS, 
IIRC). If too many concurrent work items are pushed into the global queues at 
one time then the process may deadlock when dispatch exhausts its thread pool.


-- 
Greg Parker     gpar...@apple.com <mailto:gpar...@apple.com>     Runtime 
Wrangler


_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to