高级检索

Copier:异步内存拷贝作为操作系统原生服务

Copier: A First-Class Operating System Service for Asynchronous Memory Copy

  • 摘要: 在现代计算机系统中,内存拷贝广泛存在于系统调用、进程间通信(IPC)以及用户态应用等执行路径中,已成为影响系统性能的重要瓶颈。现有优化方法,如基于页重映射的零拷贝和基于硬件加速的拷贝机制,通常仅适用于特定场景,难以作为通用方案服务于全系统数据搬运。为此,本文提出将内存拷贝提升为一种一等操作系统服务,并指出这种设计具有三方面优势:一是通过异步拷贝抽象实现拷贝与应用执行的重叠;二是由操作系统统一调度硬件能力以提升拷贝效率;三是利用全局视图识别并优化跨组件、跨边界的冗余拷贝。基于上述思想,本文提出协调式异步拷贝操作系统服务Copier,使其同时服务于用户态应用和内核态系统组件。本文实现了Copier-Linux,并在Redis、Protobuf、网络栈、代理等多类场景中验证了其有效性。实验结果表明,Copier在Redis等真实应用中可获得最高1.8倍加速,相比拷贝优化领域代表性方案zIO实现了1.6倍的性能提升。为降低使用门槛,本文还设计了配套工具链,并将Copier集成到商业化智能手机操作系统HarmonyOS 5.0中,取得了良好的实验效果。

     

    Abstract: In modern systems, memory copy remains a critical performance bottleneck across various scenarios, playing a pervasive role in system-wide execution such as syscalls, inter-process communication (IPC), and user-mode applications. Numerous efforts have aimed at optimizing copy performance, including zero-copy with page remapping and hardware-accelerated copy. However, they typically target specific use cases. This article argues for copy as a first-class OS service, offering three key benefits: 1) with the asynchronous copy abstraction provided by the service, applications can overlap their execution with copy; 2) the service can effectively utilize hardware capabilities to enhance copy performance; 3) the service’s global view of copies further enables holistic optimization. To this end, the article introduces Copier, a new OS service of coordinated asynchronous copy, to serve both user-mode applications and OS services. The authors build Copier-Linux to demonstrate Copier’s ability to improve performance for diverse use cases, including Redis, Protobuf, network stack, proxy, etc. Evaluations show that Copier achieves up to a 1.8× speedup for real-world applications like Redis and a 1.6× improvement over zIO, the state of the art in optimizing copy efficiency. To further facilitate adoption, the authors develop a toolchain to ease the use of Copier. The authors also integrate Copier into a commercial smartphone OS (HarmonyOS 5.0), achieving promising results.

     

/

返回文章
返回