スキップしてメイン コンテンツに移動

dispatch

Dispatch Queues

Dispatch queues are a C-based mechanism for executing custom tasks. A dispatch queueexecutes tasks either serially or concurrently but always in a first-in, first-out order. (In other words, a dispatch queue always dequeues and starts tasks in the same order in which they were added to the queue.) A serial dispatch queue runs only one task at a time, waiting until that task is complete before dequeuing and starting a new one. By contrast, a concurrent dispatch queue starts as many tasks as it can without waiting for already started tasks to finish.

Dispatch queues have other benefits:

  • They provide a straightforward and simple programming interface.

  • They offer automatic and holistic thread pool management.

  • They provide the speed of tuned assembly.

  • They are much more memory efficient (because thread stacks do not linger in application memory).

  • They do not trap to the kernel under load.

  • The asynchronous dispatching of tasks to a dispatch queue cannot deadlock the queue.

  • They scale gracefully under contention.

  • Serial dispatch queues offer a more efficient alternative to locks and other synchronization primitives.

コメント

このブログの人気の投稿

日本に来た 今三週間

四月六日に日本に来た、今三週間になった。 嬉しくなかった、悲しくなかった。 日本の携帯電話のカメラはとてもいいよ、私は今撮影が好きだ、いつも寮に帰る途中で花とか魚とか写真を撮る。これも生活の趣味だ。 滴は綺麗だ 桜が凋んで落ちる 天気がいいとき、自転車に乗って、食材を買った。 自分で料理をつくる、おいしそうでしょう。 昨日清水寺に行った、天気はとても熱いね。日に焼けすぎたので、腕は今赤い。 側に花があるので、赤い清水寺はもっと美しそうだ。 木の色は艶やかだ。