[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
<>单缓冲区
在单缓冲情况下,每当用户进程发出一I/O请求时,OS便在主存中为之分配一缓冲区。在块设备输入时,假定从磁盘把一块数据输入到缓冲区的时间为T,OS将该缓冲区中的数据传送到用户区的时间为M,而CPU对这一块数据的处理时间为C,
T和C是可以并行的,所以系统对每一块数据的处理时间为MAX(T,C)+M
<>双缓冲区
由于缓冲区是共享资源,生产者与消费者在使用缓冲区时必须互斥。
如果消费者尚未取走缓冲区的数据,生产者又生产新的数据,也无法将它送入缓冲区,所以设置两个缓冲区。
双缓冲机制(缓冲对换):在设备输入时,先将数据送入第一缓冲区,装满后转向第二缓冲区。在双缓冲时,系统处理一块数据的时间可以粗略地认为是MAX(C,T)
在两台机器中,都设置两个缓冲区,一个是发送缓冲区,一个是接收缓冲区
<>环形缓冲区
当输入与输出的速度基本相匹配时,采用双缓冲能获得较好的效果,可使生产者和消费者基本上能并行操作。但当两者的速度相差很远时,双缓冲的效果很不理想,所以引入环形缓冲区
环形缓冲区:
在环形缓冲区中包括多个缓冲区,每个缓冲区的大小相同,作为输入的多缓冲区可分为3类:用于装输入数据的空缓冲区,已装满数据的缓冲区G,计算进程正在使用的现行工作缓冲区C。
<>缓冲池
既可以用于输入也可以用于输出的公用缓冲池,在池中设置了多个可供若干个进程共享的缓冲区。
缓冲池和缓冲区的区别:缓冲区仅仅是一组内存块的链表,而缓冲池则是包含了一个管理的数据结构以及一组操作函数的管理机制,用于管理多个缓冲区