摘要:
Linux 中线程和进程切换的开销: Linux 操作系统层面的进程和线程的实现都是task_struct描述符. task_struct 包含成员变量:内核态stack. 这些都存在3-4G虚拟地址空间的内核态空间中。内核栈用于保存各个寄存器值:CS,DS,SS等. os层面的线程进程切换,都是在 阅读全文
摘要:
c++ 的初始化过程比较复杂:根据对象的storage duration来分类。所谓storage duration是对象而言的,Storage duration is the property of an object that defines the minimum potential life 阅读全文
摘要:
C++11 引入了右值引用的概念,由此在引出 an rvalue reference to a cv-unqualified template parameter. 在template function 推导中,我们需要推导出template parameter. 那么template functi 阅读全文
摘要:
本质的原因:raw data和引用计数的管理块,可能是分开的 使用场景: 需要在对象中得到shared ptr, 错误的代码:直接构造新的shared_ptr<A>对象,两个shared_ptr objects 是独立的,pointer to the same raw mem. 两个独立的manag 阅读全文