mylinuxer

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

随笔分类 -  linux应用

摘要:使用多线程时,pthread_create的参数flag有CLONE_FILES, 最终调用do_fork(),并且会根据CLONE_FILES标志来调用copy_files()来共享父进程中的文件描述符(这里包括socketfd)。 使用多进程时,fork的参数flag没有CLONE_FILES, 阅读全文
posted @ 2016-02-05 17:11 mylinuxer 阅读(403) 评论(0) 推荐(0)

摘要:第一题: //fork1.c #include <unistd.h> #include <stdio.h> int main(void) { int i = 0; for(i = 0; i < 3; i++) { pid_t fpid = fork(); if(fpid == 0) { printf 阅读全文
posted @ 2016-02-05 16:30 mylinuxer 阅读(325) 评论(0) 推荐(0)

摘要:One of the features merged in the 3.9 development cycle was TCP and UDP support for the SO_REUSEPORTsocket option; that support was implemented in a s 阅读全文
posted @ 2016-01-26 09:59 mylinuxer 阅读(536) 评论(0) 推荐(0)

摘要:一、安装valgrind 安装valgrind,正常的三部曲configure/make/make install就行。 二、memchk使用 1、执行命令 [root@10g-host4 tools]# valgrind --track-fds=yes --log-file=memchk-svr. 阅读全文
posted @ 2016-01-06 11:42 mylinuxer 阅读(444) 评论(0) 推荐(0)

摘要:要谈segment fault,必须要谈指针。 指针的本质是什么?只不过是一种带*的数据类型,其特色有: 1、宽度 2、声明 3、赋值 4、++与-- 5、+与- 6、求差值 7、比较 当声明int *ptr = 0x0之后,ptr1就是一个指针变量了, 可以对ptr1做++,--,+,-等各种操作 阅读全文
posted @ 2015-12-31 15:38 mylinuxer 阅读(1014) 评论(0) 推荐(0)