首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    IO - 同步,异步,阻塞,非阻塞

    同步(synchronous) IO和异步(asynchronous) IO,阻塞(blocking) IO和非阻塞(non-blocking)IO分别是什么,到底有什么区别?这个问题其实不同的人给出的答案都可能不同,比如wiki,就认为asynchronous IO和non-blocking IO是一个东西。这其实是因为不同的人的知识背景不同,并且在讨论这个问题的时候上下文(context)也不相同。所以,为了更好的回答这个问题,我先限定一下本文的上下文。 本文讨论的背景是Linux环境下的network IO。 本文最重要的参考文献是Richard Stevens的“UNIX® Network Programming Volume 1, Third Edition: The Sockets Networking ”,6.2节“I/O Models ”,Stevens在这节中详细说明了各种IO的特点和区别,如果英文够好的话,推荐直接阅读。Stevens的文风是有名的深入浅出,所以不用担心看不懂。本文中的流程图也是截取自参考文献。

    01

    IO - 同步,异步,阻塞,非阻塞

    同步(synchronous) IO和异步(asynchronous) IO,阻塞(blocking) IO和非阻塞(non-blocking)IO分别是什么,到底有什么区别?这个问题其实不同的人给出的答案都可能不同,比如wiki,就认为asynchronous IO和non-blocking IO是一个东西。这其实是因为不同的人的知识背景不同,并且在讨论这个问题的时候上下文(context)也不相同。所以,为了更好的回答这个问题,我先限定一下本文的上下文。 本文讨论的背景是Linux环境下的network IO。 本文最重要的参考文献是Richard Stevens的“UNIX® Network Programming Volume 1, Third Edition: The Sockets Networking ”,6.2节“I/O Models ”,Stevens在这节中详细说明了各种IO的特点和区别,如果英文够好的话,推荐直接阅读。Stevens的文风是有名的深入浅出,所以不用担心看不懂。本文中的流程图也是截取自参考文献。

    03

    fio基础10

    bs_is_seq_randIfthisoptionisset,fiowillusethenormalread,writeblocksizesettingsassequential,randominstead.AnyrandomreadorwritewillusetheWRITEblocksizesettings,andanysequentialreadorwritewillusetheREADblocksizesetting.zero_buffersIfthisoptionisgiven,fiowillinittheIObufferstoallzeroes.Thedefaultistofillthemwithrandomdata.refill_buffersIfthisoptionisgiven,fiowillrefilltheIObuffersoneverysubmit.Thedefaultistoonlyfillitatinittimeandreusethatdata.Onlymakessenseifzero_buffersisn't specified, naturally. If data verification is enabled, refill_buffers is also automatically enabled. scramble_buffers=bool If refill_buffers is too costly and the target is using data deduplication, then setting this option will slightly modify the IO buffer contents to defeat normal de-dupe attempts. This is not enough to defeat more clever block compression attempts, but it will stop naive dedupe of blocks. Default: true. buffer_compress_percentage=int If this is set, then fio will attempt to provide IO buffer content (on WRITEs) that compress to the specified level. Fio does this by providing a mix of random data and a fixed pattern. The fixed pattern is either zeroes, or the pattern specified by buffer_pattern. If the pattern option is used, it might skew the compression ratio slightly. Note that this is per block size unit, for file/disk wide compression level that matches this setting, you'llalsowanttosetrefill_buffers.buffer_compress_chunk=intSeebuffer_compress_percentage.Thissettingallowsfiotomanagehowbigtherangesofrandomdataandzeroeddatais.Withoutthisset,fiowillprovidebuffer_compress_percentageofblocksizerandomdata,followedbytheremainingzeroed.Withthissettosomechunksizesmallerthantheblocksize,fiocanalternaterandomandzeroeddatathroughouttheIObuffer.buffer_pattern=strIfset,fiowillfilltheiobufferswiththispattern.Ifnotset,thecontentsofiobuffersisdefinedbytheotheroptionsrelatedtobuffercontents.Thesettingcanbeanypatternofbytes,andcanbeprefixedwith0xforhexvalues.Itmayalsobeastring,wherethestringmustthenbewrappedwit

    04
    领券