iOS 多线程 之 GCD(大中枢派发)(一)

导语:

本文个人原创,转载请注明出处(http://www.cnblogs.com/pretty-guy/p/8126981.html)

在iOS开发中多线程操作通常是一下3种,本文着重介绍Dispatch

. NSThread
. NSOperation
. GCD

先来一段Apple对dispath的介绍

Dispatch

Execute code concurrently on multicore hardware by submitting work to dispatch queues managed by the system.

GCD

The BSD subsystem, Core Foundation, and Cocoa APIs have all been extended to use these enhancements to help both the system and your application to run faster, more efficiently, and with improved responsiveness. Consider how difficult it is for a single application to use multiple cores effectively, let alone doing it on different computers with different numbers of computing cores or in an environment with multiple applications competing for those cores. GCD, operating at the system level, can better accommodate the needs of all running applications, matching them to the available system resources in a balanced fashion.

翻过过来就是:

Dispatch

通过提交工作来调度系统管理的调度队列,在多核硬件上并发的执行代码

GCD
BSD子系统,Core Foundation和Cocoa API已经全部扩展到使用这些增强功能来帮助系统和应用程序更快,更高效地运行,并且提高了响应速度。 考虑单个应用程序有效地使用多个内核是多么的困难,更不用说在具有不同数量的计算核心的不同计算机上或者在具有多个应用程序的环境中竞争这些内核。 在系统级运行的GCD可以更好地适应所有正在运行的应用程序的需求,并以均衡的方式将它们与可用的系统资源进行匹配。

划重点:在系统级运行的GCD可以更好地适应所有正在运行的应用程序的需求,并以均衡的方式将它们与可用的系统资源进行匹配。意思很明显,多线程操作还是建议使用GCD,毕竟是系统级别的

上一篇:Entity Framework 并发处理借鉴


下一篇:我的GTD中收集的书单