In OS X v10.6 and later, operation queues use the libdispatch library (also known as Grand Central Dispatch) to initiate the execution of their operations. As a result, operations are always executed on a separate thread, regardless of whether they are designated as concurrent or non-concurrent operations.

In iOS 4 and later, operation queues use Grand Central Dispatch to execute operations.

这2句话是NSOperationQueue Class Reference中的,这2句话表明NSOperationQueue是利用了GCD机制的,而Thread一直是最基本的多线程机制,那么它们3者的上下层关系便出来了:

Thread最基本,其次是GCD,封装的最高层是operation quque。在遇到多线程问题时,推荐使用Operation Queue。最新的AFNetWorking库也使用Operation Queue代替了GCD,代码开起来更简洁了。

那么这3中多线程方式具体的区别在哪里呢?

首先说NSThread,这个是系统最基本的多线程机制,一切其他机制都是由它衍生出来的。既然是最基本的,那么用起来也一定最复杂:它仅仅提供了最基本的线程机制,不会提供那些同步异步的各种机制。

其实,关键是区别CGD和NSOperationQueue 的区别。

最新文章

  1. UIButton(改变Title和image位置)
  2. 李洪强漫谈iOS开发[C语言-046]-统计输入字符个数
  3. python之网络爬虫
  4. LeetCode-Decode String
  5. Chrome 控制台不完全指南【转载】
  6. easyUI相关知识
  7. innerXml,outerXml,innerText的不同
  8. JMeter 监控和记录&常用功能
  9. Python 简单socket模拟ssh
  10. 自己写的日志框架--linkinLog4j--框架可配置+提性能
  11. Elasticsearch安装详解
  12. PYthon3:简单几步实现冒泡排序
  13. logstash过滤器插件filter详解及实例
  14. OO课程学期末总结
  15. 从零开始编写自己的JavaScript框架(二)
  16. 雷林鹏分享:C# 预处理器指令
  17. php的websocket
  18. ccf认证模拟题之三---最大的矩形
  19. ZOJ 1654 Place the Robots建图思维(分块思想)+二分匹配
  20. Day21-Cookie

热门文章

  1. Java-LinkedHashSet
  2. session共享
  3. BZOJ-1951 古代猪文 (组合数取模Lucas+中国剩余定理+拓展欧几里得+快速幂)
  4. BZOJ3246 [Ioi2013]Dreaming
  5. event driven的一些概念
  6. HDU 5714
  7. ubuntu安装spark
  8. ASP.NET MVC 过滤器详解
  9. Spring MVC:使用SimpleUrlHandlerMapping的一个简单例子
  10. 数数字 (Digit Counting,ACM/ICPC Danang 2007,UVa 1225)