随笔分类 -  多线程

摘要:内核掌管一切,可以直接读写线程数据结构 阅读全文
posted @ 2017-05-03 19:20 zzfx 阅读(227) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/yxzfscg/p/4758728.html 三种线程——内核线程、轻量级进程、用户线程 内核线程 内核线程就是内核的分身,一个分身可以处理一件特定事情。这在处理异步事件如异步IO时特别有用。内核线程的使用是廉价的,唯一使用的资源就是内核栈和上下文切换时 阅读全文
posted @ 2017-05-03 18:15 zzfx 阅读(1192) 评论(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 阅读(838) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/liujiayu2/article/details/46517301 线程的上下文 线程的上下文本质上是一组处理器的寄存器,有正在执行程序中的指针及堆栈指针。上下文及其转换的过程根据处理器的结构不同会有所不同。我们可以调用内核调试器的lkd> dt nt!_ 阅读全文
posted @ 2017-05-02 18:45 zzfx 阅读(640) 评论(0) 推荐(0)
摘要:多线程的start_routine指明了CPU的一个可执行流; 多线程的上线文说明了执行流现在的运行情况; 多线程的属性说明了上线文的数据结构。 https://computing.llnl.gov/tutorials/pthreads/ pthread_create arguments: thre 阅读全文
posted @ 2017-05-02 17:37 zzfx 阅读(187) 评论(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 阅读(246) 评论(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 阅读(536) 评论(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 阅读(203) 评论(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 阅读(159) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/xiaofei0859/article/details/5818511 线程安全: 线程安全函数:在C语言中局部变量是在栈中分配的,任何未使用静态数据或其他共享资源的函数都是线程安全的。 使用全局变量的函数是非线程安全的。 使用静态数据或其他共享资源的函数, 阅读全文
posted @ 2017-04-19 18:59 zzfx 阅读(377) 评论(0) 推荐(0)
摘要:临界区是访问共享数据的代码块。 线程安全,线程共享数据的安全访问。 线程安全:对共享资源的有序访问。 http://www.cnblogs.com/wind-net/archive/2012/08/29/2661693.html 每个进程中访问临界资源的那段代码称为临界区(Critical Sect 阅读全文
posted @ 2017-04-19 18:56 zzfx 阅读(298) 评论(0) 推荐(0)
摘要:https://developer.apple.com/library/content/documentation/General/Conceptual/ConcurrencyProgrammingGuide/OperationQueues/OperationQueues.html#//apple_ 阅读全文
posted @ 2017-04-19 17:22 zzfx 阅读(213) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/hsuxu/article/details/8985931 1、线程池简介: 多线程技术主要解决处理器单元内多个线程执行的问题,它可以显著减少处理器单元的闲置时间,增加处理器单元的吞吐能力。 假设一个服务器完成一项任务所需时间为:T1 创建线程时间,T2 在 阅读全文
posted @ 2017-03-03 19:30 zzfx 阅读(383) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/snake-hand/p/3148191.html 我们从图上可以看出,两个线程之间的栈是独立的,其他是共享的,所以,在操作共享区域的时候才有可能出现同步需要,操作栈不需要同步。 最后我们知道,pthread也提供了私有堆机制,关于私有堆机制在以后说明。 阅读全文
posted @ 2017-02-08 11:07 zzfx 阅读(799) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/lujiandong1/article/details/44726373 1、在用户空间中实现线程 (1)特点:把整个线程包放在用户空间,内核对线程包一无所知。从内核角度考虑,就是按正常的方式管理,即单线程进程(存在运行时系统) (2)优点: 1、用户级线程 阅读全文
posted @ 2017-02-08 11:06 zzfx 阅读(960) 评论(0) 推荐(0)
摘要:变量就是变量,与其它的普通变量没有什么区别; 变量的操作函数就是操作函数;同步变量的操作函数成对出现。 同步变量的操作函数,由操作系统保证其原子性。 pthread_barrier_t barrier; pthread_barrier_init(&barrier, NULL, 3); pthread 阅读全文
posted @ 2016-08-11 15:36 zzfx 阅读(233) 评论(0) 推荐(0)
摘要:This method spawns the new thread and invokes the receiver’s main method on the new thread. If you initialized the receiver with a target and selector 阅读全文
posted @ 2016-08-10 11:28 zzfx 阅读(206) 评论(0) 推荐(0)