揭开unix网络之纱1- 客户服务器编程范式.doc

揭开unix网络之纱1- 客户服务器编程范式.doc

  1. 1、本文档共20页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
揭开unix网络之纱1- 客户服务器编程范式.doc

拨开《unix网络编程--套接字》之纱 -1 客户/服务器编程范式 – 30章 前言 读史蒂文的几本书真的是太难了。决心、恒心、耐心、细心、方法都是需要的。为此我决定开始写关于他著作的一系列帮助文档,也有利于我理解。 范式种类 0 迭代服务器 1 并发服务器 2 预先派生子进程 每个子进程调用accept 3 预先派生子进程 以文件上锁方式保护accept 4 预先派生子进程 以线程互斥锁上锁方式保护accept 5 预先派生子进程 由父进程向子进程传递套接字描述符 6 并发服务器 为每个客户请求创建一个线程 7 预先创建线程 以互斥锁上锁方式保护accept 8 预先创建线程 由主线程调用accept 元函数 由linux提供的函数 getusage getrusage - get resource usage #include sys/time.h #include sys/resource.h int getrusage(int who,struct rusage *usage); get usage returns resource usage measures for who,which can be one the the following: RUSAGE_SELF: return resource usage statistics fro the calling process,which is the sum of resources used by all threads in the process. RUSAGE_CHILDREN: return resource usage static for all children of the calling process that have terminated and been waited for,These statistics will include the resource used by grandchildren,and further removed descendants if all fo the intervening descendarnts waited on their terminated children. RUSAGE_THREAD (since Linux 2.6.26) Return resource usage statistics for the calling thread. The resource usages are returned in the structure pointed to by usage,which has the following form: struct rusage { struct timeval ru_utime; /* user time used */ struct timeval ru_stime; /* system time used */ long ru_maxrss; /* maximum resident set size */ long ru_ixrss; /* integral shared memory size */ long ru_idrss; /* integral unshared data size */ long ru_isrss; /* integral unshared stack size */ long ru_minflt; /* page reclaims */ long ru_majflt; /* page faults */ long ru_nswap; /* swaps */ long ru_inblock; /* block input operations */ long ru_oublock; /* block output operations */ long ru_msgsnd; /* messages

文档评论(0)

rewfdgd + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档