Posts

Showing posts with the label linux技术 零拷贝 i/o优化

Valorant requires a restart or loads slowly when entering the game. What can I do? I have an idea.

Valorant is a free first -person tactical shooting game developed by Riot Games, which combines the exact system of arms shooting and heroism. Players will be transformed into agents and will compete for target points using team collaboration, tactical layout and skills cooperation 5V5 offensive and defense stroke. The game has a low economic system and high competitiveness. Before each game start, buy weapons and armor according to tactical needs and use a combination of heroic skills to create the benefits of the battlefield. Its solid ballistic mechanism and map design require players for accurate purposes and tactical decision -making. At the same time, the rich character pool and skill combination give the game a strategic depth. If you have the problems you need to restart or slowly load while playing a "Varorant", try the following systematic solution: Network environment optimization is the main solution. Because valante servers can be introduced abroad, physical dist...

从Linux零拷贝深入了解Linux I/O 操作及其原理和优化!

Image
前言 存储器是计算机的核心部件之一,在完全理想的状态下,存储器应该要同时具备以下三种特性: 速度足够快:存储器的存取速度应当快于 CPU 执行一条指令,这样 CPU 的效率才不会受限于存储器; 容量足够大:容量能够存储计算机所需的全部数据; 价格足够便宜:价格低廉,所有类型的计算机都能配备。 但是现实往往是残酷的,我们目前的计算机技术无法同时满足上述的三个条件,于是现代计算机的存储器设计采用了一种分层次的结构: 从顶至底,现代计算机里的存储器类型分别有: 寄存器、高速缓存、主存和磁盘 ,这些存储器的速度逐级递减而容量逐级递增。 存取速度最快的是 寄存器 ,因为寄存器的制作材料和 CPU 是相同的,所以速度和 CPU 一样快,CPU 访问寄存器是没有时延的,然而因为价格昂贵,因此容量也极小,一般 32 位的 CPU 配备的寄存器容量是 32✖️32 Bit,64 位的 CPU 则是 64✖️64 Bit,不管是 32 位还是 64 位,寄存器容量都小于 1 KB,且寄存器也必须通过软件自行管理。 第二层是 高速缓存 ,也即我们平时了解的 CPU 高速缓存 L1、L2、L3 ,一般 L1 是每个 CPU 独享,L3 是全部 CPU 共享,而 L2 则根据不同的架构设计会被设计成独享或者共享两种模式之一,比如 Intel 的多核芯片采用的是共享 L2 模式而 AMD 的多核芯片则采用的是独享 L2 模式。 第三层则是 主存 ,也即主内存,通常称作随机访问存储器(Random Access Memory, RAM)。是与 CPU 直接交换数据的内部存储器。它可以随时读写(刷新时除外),而且速度很快,通常作为操作系统或其他正在运行中的程序的临时资料存储介质。 至于 磁盘 则是图中离用户最远的一层了,读写速度相差内存上百倍;另一方面自然针对磁盘操作的优化也非常多,如 零拷贝 、 direct I/O 、 异步 I/O 等等,这些优化的目的都是为了提高系统的吞吐量;另外操作系统内核中也有 磁盘高速缓存区 、 PageCache 、 TLB 等,可以有效的减少磁盘的访问次数。 现实情况中,大部分系统在由小变大的过程中,最先出现瓶颈的就是 I/O ,尤其是在现代网络应用从 CPU 密集型转向了 I/O 密集型的大背景下, I/O 越发成为大多数应用的性能瓶颈。 传统的 Linux...