<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 11, 2017, at 9:10 AM, Gerard Iglesias via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">Thanx for the link on this…</div><div class=""><br class=""></div><div class=""><div class="">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.<br class=""></div></div><div class=""><br class=""></div><div class="">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</div></div></div></div></blockquote><br class=""></div><div>Dispatch queues are intended to be cheap, comparable to a pthread_mutex IIRC.</div><div><br class=""></div><div>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.</div><div><br class=""></div><div><br class=""></div><div>--&nbsp;</div><div>Greg Parker &nbsp; &nbsp; <a href="mailto:gparker@apple.com" class="">gparker@apple.com</a>&nbsp; &nbsp; &nbsp;Runtime Wrangler</div><div><br class=""></div><br class=""></body></html>