[Webkit-unassigned] [Bug 90584] Add DispatchQueue class.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 5 19:21:25 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=90584





--- Comment #20 from Kwang Yul Seo <skyul at company100.net>  2012-07-05 19:21:24 PST ---
(In reply to comment #18)
> What's the rationale for adding this class? 
> 
> We already have a WorkQueue class in the WebKit2 platform code which does more or less the same thing (and it's actually used in a bunch of places).

Parallel image decoders create a serial queue for each image being decoded. That means a large number of serial queues can be created and used at the same time. DispatchQueue internally manages a pool of threads, and assigns a thread from the pool to each serial queue. So more than two serial queues can share a single underlying thread. libdispatch's serial queue handles this internally. DispatchQueue's generic back-end (thread-pool implementation) follows this.

WorkQueue is not ideal for this situation because a WorkQueue instance creates its own thread. WorkQueueMac is the only exception because it uses libdispatch's serial queue. If parallel image decoders use WorkQueue instead of DispatchQueue, it can create too many threads and degrade the overall system performance.

I admit that a serial DispatchQueue is just a subset of WorkQueue from the API perspective because it does not provide delayed dispatch and event source. The only enhancement it has is thread pooling. On the other hand, this patch is more generic than is necessary in some cases. For example, the global queue is not used anywhere and the main queue is simple wrapper around callOnMainThread. 

We will try to reuse WorkQueue in our parallel image decoders implementation since WorkQueue provides most of the features we need. I think we can probably do thread pooling on top WorkQueue. The first job is to move WorkQueue to WTF, so that WebCore code can use it.

For the time being, please stop reviewing this patch. BTW, we barely know how WorkQueue works before submitting this patch. Thank you for the information and review.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list