web serviceLinux教学课件.ppt

  1. 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Cryptography Web Services apache的生命周期 apache的处理流程 阻塞模式 多进程或多线程 套接字 监听的套按字 已连接套接字 I/O动作如何执行? 进程无法直接操作I/O设备,其必须通过系统调用请求kernel来协助完成I/O动作 内核会为每个I/O设备维护一个buffer 对于输入而言,等待(wait)数据输入至buffer需要时间,而从buffer复制(copy)数据至进程也需要时间 根据等待模式不同,I/O动作可分为五种模式 Five I/O Models blocking I/O: blocked all the way nonblocking I/O: if no data in buffer, immediate returns EWOULDBLOCK I/O multiplexing (select and poll): blocked separately in wait and copy signal driven I/O (SIGIO): nonblocked in wait but blocked in copy (signaled when I/O can be initiated) asynchronous I/O (aio_): nonblocked all the way (signaled when I/O is complete) 同步I/O和异步I/O Synchronous I/O:引起请求进程阻塞,直到I/O完成; Asynchronous I/O:不导致请求进程阻塞; IO复用 event-driven IO Comparison of Five I/O Models select(1024),poll select(1024),poll mmap: 内存映射 select(1024),poll mmap: 内存映射 Blocking versus Multiplexing If we want to read from multiple devices, we are not able to do it properly with the read() system-call If one device has no data, our task will be blocked, and so can’t read data that may become available from some other device Idea: use ‘nonblocking’ i/o When we ‘open()’ a device-file, we could specify the ‘O_NONBLOCK’ i/o mode For the keyboard: two problems with this: The ‘stdin’ device is already open by default If a task tries to do multiplexing with devices that have been opened in non-blocking mode, it will likely consume way too much cpu time! Better idea: use ‘select()’ The ‘select()’ system-call was designed to allow applications to efficiently perform i/o multiplexing With ‘select()’ the application informs the kernel as to which system devices it is interested in The kernel then ‘polls’ those devices, to see if any of them is ready to do i/o without blocking If not, it puts the process to sleep until at least one device is ready to do i/o without blocking select/poll/epoll select 本质上是通过设置或者检查存放fd标志位的数据结构来进行下一步处理 缺点 单个进程可监视的fd数量被限制,即能监听端口的大小有限 # cat /proc/sys/fs/file-max 对socket进行扫描时是线性扫描,即采用轮询的方法,效率较低 需要维护一个用来存放大量fd的数据结构,

文档评论(0)

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

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

1亿VIP精品文档

相关文档