2007年3月5日

摘要: 1.值替代const 和 define比有类型检查2.指针指向const的指针const int* uint const* uconst指针int* const w;int d=1;const int* const x = &d;int const* const x2 = &d;现在,指针和对象都不能改变3.函数和返回值传递const值void f1(const int i){ i++; //illegal -- compile-time error}返回const值const int g();对于内部类型(int, char)来说,按值返回的是否是一个const,是无关紧要的 阅读全文

posted @ 2007-03-05 16:01 Teddy Yan 阅读(143) 评论(0) 推荐(0) 编辑

摘要: STL GP--generic programIt's same to OOP, it's an other program method.Class TemplateHow C++ Templates Enable Generic Programming1.Class TemplatesThere is usually more to making an ordinary class into a generic one than just adding the template keyword and type parameter list. Some modificati 阅读全文

posted @ 2007-03-05 15:58 Teddy Yan 阅读(148) 评论(0) 推荐(0) 编辑


2007年3月4日

摘要: 2.1 Default Constructor 的建构操作C++ Annotated Reference Manual (ARM)什么时候编译器会自动创建出default constructor?两种implicit constructor: trivial & nontrivial. nontrivial的话,编译器会自动创建如果一个class没有任何constructor,但它内含一个member object,而后者有default constructor, 那么这个class的implicit constructor就是“nontrivial”如果class A内含一个或一个以 阅读全文

posted @ 2007-03-04 15:54 Teddy Yan 阅读(130) 评论(0) 推荐(0) 编辑


2007年3月1日

摘要: 新的task_struct加入到task向量链表中,并且父进程的task_struct内容被复制到新进程的task_struct中当进程刚刚被创建还未进行写操作时,linux允许两个进程共享资源而不是有两份独立的拷贝。这种共享可用于进程的文件、信号处理器和虚拟内存。linux使用称为“写时复制”(copy on write)的技术进程的状态TASK_RUNNINGTASK_INTERRUPTIBLETASK_UNINTERRUPTIBLETASK_ZOMBIETASK_STOPPED进程的选择进程切换进程存储空间包括两部分:一部分是进程私有的内存空间,另一部分是进程占用的cpu寄存器。进程的选 阅读全文

posted @ 2007-03-01 11:44 Teddy Yan 阅读(125) 评论(0) 推荐(0) 编辑

摘要: 等待队列是基础,struct __wait_queue{unsigned int flags;#define WQ_FLAG_EXCUSIVE 0x01struct task_struct * task;struct list_head task_list}1.软中断信号同中断和异常(excepiton)相比较,信号对用户态的进程是可见的,可以被用户态进程捕获。UNIX系统V中有19个软中断信号。1>进程终止相关的软中断信号,子进程死2>意外事件相关的软中断信号,访问地址越界3>在系统调用期间发生不可恢复条件相关的软中断信号,exec资源释放4>在执行一个系统调用时遇到 阅读全文

posted @ 2007-03-01 11:36 Teddy Yan 阅读(97) 评论(0) 推荐(0) 编辑


2007年2月19日

摘要: 1. Layout Cost for Adding Encapsulationinheritance don't have cost. But virtual function and virtual base class will add extra cost.2. C++ Object ModelHow Compiler implement the OO:A Simple Object ModelA Table-driven Object ModelTwo conceptions: virtual table vtbl;vptrHow the Object Model Effect 阅读全文

posted @ 2007-02-19 22:08 Teddy Yan 阅读(132) 评论(0) 推荐(0) 编辑


2007年1月6日

摘要: 虚拟地址由操作系统维护,由MMU可以进行转换。扩大了内存空间分页管理,把内存分为页和页桢,大小一样,一个在磁盘,一个在内存。页表就像一个函数,输入是页号,输出是页桢号。页表可以是多级页表,可以用TLB(Translation Lookaside Buffer)缓存。速度和成本介于内存和寄存器页表项:禁止缓存,访问位,保护位,修改位,存在位----页桢号页面置换:最优算法,先进先出和最近最少使用 (Leaset Recently Used)Linux 虚拟内存的管理1.缺省页面大小8K,每一个进程维护自己的一张页表。所以,不同进程的虚拟地址可能一样2.虚拟地址:0x2194 ---> 因为 阅读全文

posted @ 2007-01-06 16:45 Teddy Yan 阅读(204) 评论(0) 推荐(0) 编辑

摘要: 实现进程间通讯的方法:1.管道2.套接字3.System V IPC-------1.message queue.2 semaphore 3.shared memory关于共享内存的四个函数shmget(key_t key, int size, int shmflg);//创建或者查找一个共享内存void *shmat (int shmid, char *shmaddr, int shmflg); //返回一个地址空间void *shmdt (char *shmaddr);int shmctl(int shmid, int cmd, struct shmid_ds *buf); //对共享内存 阅读全文

posted @ 2007-01-06 16:43 Teddy Yan 阅读(154) 评论(0) 推荐(0) 编辑


2006年12月28日

摘要: Mpgv.c 是对mpeg vedio的解码部分,从demux开始,到sample到输出。其中,核心部分是函数ParseMPEGBlock。两种数据格式:video_format 是video的meta_data,block是实际的数据Code Path:Open()----->Modules/demux/Mpgv.c1)set function point. p_sys is main structurep_demux->pf_demux = Demux;p_demux->pf_control= Control;p_demux->p_sys = p_sys = mal 阅读全文

posted @ 2006-12-28 02:06 Teddy Yan 阅读(820) 评论(0) 推荐(0) 编辑

摘要: POSIX 是系统调用的————操作系统的标准程序只有通过门(gate)陷入(trap)到内核调用中去,实际上是通过0x80中断进入的0)概念:mode switch & context switch 前者简单,只是进行寄存器上下文切换page, frame, segment逻辑地址 = 选择子 : offset,选择子= 索引:TI:RPL GDT(Global Descriptor Table) & LDT逻辑地址到线性地址的转换中断,异常和陷入的区别1)堆栈的切换 SAVE_ALL,RESTORE_ALL, eax的重要性(指明了那个系统调用)2)sys_call_tab 阅读全文

posted @ 2006-12-28 01:56 Teddy Yan 阅读(240) 评论(0) 推荐(0) 编辑


Copyright © 2024 Teddy Yan
Powered by .NET 8.0 on Kubernetes