随笔分类 -  多线程

摘要:A thread is a fundamental unit of CPU utilization –a thread ID –a program counter –a register set –a stack It shares with other threads belonging to t 阅读全文
posted @ 2017-05-03 20:43 zzfx 阅读(153) 评论(0) 推荐(0) 编辑
摘要:多线程使用场景: 主(控)线程召唤了几个小弟来解决主(控)线程不方便处理的问题; 召唤一个小弟或召唤一群小弟,各有分工,协同完成任务。 普通的程序块通过if-else等流控来控制业务流程; 线程通过线程变量来控制; 与人类社会(公司组织)类似,线程编程的主要思想是任务分解、分离与汇报机制; 线程的角 阅读全文
posted @ 2017-05-03 20:35 zzfx 阅读(221) 评论(0) 推荐(0) 编辑
摘要:https://developer.apple.com/library/content/documentation/General/Conceptual/ConcurrencyProgrammingGuide/OperationQueues/OperationQueues.html#//apple_ 阅读全文
posted @ 2017-05-03 20:18 zzfx 阅读(185) 评论(0) 推荐(0) 编辑
摘要:https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Multithreading/AboutThreads/AboutThreads.html#//apple_ref/doc/uid/10000057i 阅读全文
posted @ 2017-05-03 20:15 zzfx 阅读(169) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/King-Gentleman/p/4278012.html 一、前言 RT-Thread中提供的线程调度器是基于全抢占式优先级的调度,在系统中除了中断处理函数、调度器上锁部分的代码和禁止中断的代码是不可抢占的之外,系统的其他部分都是可以抢占的,包括线程调 阅读全文
posted @ 2017-05-03 19:41 zzfx 阅读(1452) 评论(0) 推荐(0) 编辑
摘要:http://blog.csdn.net/liaodehong/article/details/51206607 作者:IBM 刘欣 我是一个线程,我一出生就被编了个号: 0×3704,然后被领到一个昏暗的屋子里, 这里我发现了很多和我一模一样的同伴。 我身边的同伴0×6900 待的时间比较长, 他 阅读全文
posted @ 2017-05-03 19:28 zzfx 阅读(155) 评论(0) 推荐(0) 编辑
摘要:内核掌管一切,可以直接读写线程数据结构 阅读全文
posted @ 2017-05-03 19:20 zzfx 阅读(220) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/yxzfscg/p/4758728.html 三种线程——内核线程、轻量级进程、用户线程 内核线程 内核线程就是内核的分身,一个分身可以处理一件特定事情。这在处理异步事件如异步IO时特别有用。内核线程的使用是廉价的,唯一使用的资源就是内核栈和上下文切换时 阅读全文
posted @ 2017-05-03 18:15 zzfx 阅读(1100) 评论(0) 推荐(0) 编辑
摘要:一方(通过同步变量、内核变量)告诉另一方自己的状态。 通信实体间传递的控制信号。有别于数据信号。 同步变量是并发机制的组成部分。 锁:一人一个坑位 读写变量:公告板 屏障:坦克战斗小组成员都就绪后可以战斗,够五个走一波 信号量:还有3个名额 条件变量:太复杂最好不用(swich) 阅读全文
posted @ 2017-05-03 17:57 zzfx 阅读(297) 评论(0) 推荐(0) 编辑
摘要:https://en.wikipedia.org/wiki/Thread_control_block Thread Control Block (TCB) is a data structure in the operating system kernel which contains thread 阅读全文
posted @ 2017-05-02 18:52 zzfx 阅读(817) 评论(0) 推荐(0) 编辑
摘要:http://blog.csdn.net/liujiayu2/article/details/46517301 线程的上下文 线程的上下文本质上是一组处理器的寄存器,有正在执行程序中的指针及堆栈指针。上下文及其转换的过程根据处理器的结构不同会有所不同。我们可以调用内核调试器的lkd> dt nt!_ 阅读全文
posted @ 2017-05-02 18:45 zzfx 阅读(614) 评论(0) 推荐(0) 编辑
摘要:多线程的start_routine指明了CPU的一个可执行流; 多线程的上线文说明了执行流现在的运行情况; 多线程的属性说明了上线文的数据结构。 https://computing.llnl.gov/tutorials/pthreads/ pthread_create arguments: thre 阅读全文
posted @ 2017-05-02 17:37 zzfx 阅读(174) 评论(0) 推荐(0) 编辑
摘要:https://computing.llnl.gov/tutorials/pthreads/ Technically, a thread is defined as an independent stream of instructions that can be scheduled to run 阅读全文
posted @ 2017-05-02 17:33 zzfx 阅读(227) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/hnrainll/archive/2011/04/20/2022149.html #include<stdlib.h> #include<stdio.h> #include<unistd.h> #include<pthread.h> void clean 阅读全文
posted @ 2017-05-02 17:17 zzfx 阅读(519) 评论(0) 推荐(0) 编辑
摘要:https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Multithreading/CreatingThreads/CreatingThreads.html#//apple_ref/doc/uid/100 阅读全文
posted @ 2017-04-24 16:20 zzfx 阅读(190) 评论(0) 推荐(0) 编辑
摘要:https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Multithreading/AboutThreads/AboutThreads.html#//apple_ref/doc/uid/10000057i 阅读全文
posted @ 2017-04-24 15:33 zzfx 阅读(146) 评论(0) 推荐(0) 编辑
摘要:http://blog.csdn.net/xiaofei0859/article/details/5818511 线程安全: 线程安全函数:在C语言中局部变量是在栈中分配的,任何未使用静态数据或其他共享资源的函数都是线程安全的。 使用全局变量的函数是非线程安全的。 使用静态数据或其他共享资源的函数, 阅读全文
posted @ 2017-04-19 18:59 zzfx 阅读(360) 评论(0) 推荐(0) 编辑
摘要:临界区是访问共享数据的代码块。 线程安全,线程共享数据的安全访问。 线程安全:对共享资源的有序访问。 http://www.cnblogs.com/wind-net/archive/2012/08/29/2661693.html 每个进程中访问临界资源的那段代码称为临界区(Critical Sect 阅读全文
posted @ 2017-04-19 18:56 zzfx 阅读(281) 评论(0) 推荐(0) 编辑
摘要:https://developer.apple.com/library/content/documentation/General/Conceptual/ConcurrencyProgrammingGuide/OperationQueues/OperationQueues.html#//apple_ 阅读全文
posted @ 2017-04-19 17:22 zzfx 阅读(205) 评论(0) 推荐(0) 编辑
摘要:http://blog.csdn.net/hsuxu/article/details/8985931 1、线程池简介: 多线程技术主要解决处理器单元内多个线程执行的问题,它可以显著减少处理器单元的闲置时间,增加处理器单元的吞吐能力。 假设一个服务器完成一项任务所需时间为:T1 创建线程时间,T2 在 阅读全文
posted @ 2017-03-03 19:30 zzfx 阅读(375) 评论(0) 推荐(0) 编辑