2024年10月5日
摘要: 常用于网络文件传输 正常的网络传输 4次 上下文切换与拷贝 如下图 而零拷贝使用诸如 mmap+write 或 sendfile ,只有 一次系统调用(sendfile) , DMA复制(2次)和 内核缓冲区和网络缓冲区 的复制(1次) sendfile 允许数据直接从一个文件描述符发送到另一个文件 阅读全文
posted @ 2024-10-05 16:43 towboat 阅读(14) 评论(0) 推荐(0)
摘要: 代码大概如下 do { old_value = atomic_load(&c->count); // 获取当前值 //1 } while (!atomic_compare_exchange_weak(&c->count, &old_value, old_value + 1)); 1处c->count 阅读全文
posted @ 2024-10-05 00:22 towboat 阅读(9) 评论(0) 推荐(0)