arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2512.03083cs.PLcs.SE
收藏

利用libseff C库评估效果处理程序中的堆栈管理

Evaluate the Stack Management in Effect Handlers using the libseff C Library

School of Informatics, University of Edinburgh(爱丁堡大学信息学院)

ZeHao Yu

AI总结:

本文利用libseff C库提出用户级堆栈管理方法,通过动态调整堆栈大小提升内存利用率,对比传统方法发现其在灵活性与性能间的平衡点及优化方向。

摘要:

效果处理程序在现代编程中越来越突出,用于以模块化和灵活的方式管理复杂的计算效果,包括并发、异步操作和异常处理。高效的堆栈管理仍然是效果处理程序面临的主要挑战,因为它们引入了动态的控制流变化。本文探讨了一种新的堆栈管理方法,利用libseff C库中的用户级过承诺,该方法结合了虚拟内存机制和基于保护的惰性分配,以及信号驱动的内存承诺。我们的用户级过承诺实现能够按需动态调整堆栈大小,比传统方法更有效地利用内存并减少浪费。我们通过基准测试和评估,将这种新策略与传统固定大小堆栈、分段堆栈和基于内核的过承诺进行比较,使用诸如上下文切换延迟、堆栈扩展效率、多线程性能以及在快速堆栈增长条件下的鲁棒性等指标。实验结果表明,基于内核的过承诺在性能和灵活性之间实现了有效的平衡,而我们的用户级实现虽然灵活,但会带来额外的开销,突显了优化的领域。本研究提供了各种堆栈管理策略的详细比较分析,为特定应用需求和操作约束提供了实用的建议。未来的工作将专注于改进用户级过承诺机制,减轻非确定性行为,并扩展基准框架以包含现实世界场景。

英文摘要:

Effect handlers are increasingly prominent in modern programming for managing complex computational effects, including concurrency, asynchronous operations, and exception handling, in a modular and flexible manner. Efficient stack management remains a significant challenge for effect handlers due to the dynamic control flow changes they introduce. This paper explores a novel stack management approach using user-level overcommitting within the libseff C library, which leverages virtual memory mechanisms and protection-based lazy allocation combined with signal-driven memory commitment. Our user-level overcommitting implementation dynamically resizes stacks on-demand, improving memory utilization and reducing waste compared to traditional methods. We rigorously benchmark and evaluate this novel strategy against conventional fixed-size stacks, segmented stacks, and kernel-based overcommitting, using metrics such as context-switch latency, stack expansion efficiency, multi-threaded performance, and robustness under rapid stack growth conditions. Experimental results demonstrate that kernel-based overcommitting achieves an effective balance between performance and flexibility, whereas our user-level implementation, while flexible, incurs additional overheads, highlighting areas for optimization. This study provides a detailed comparative analysis of various stack management strategies, offering practical recommendations tailored to specific application requirements and operational constraints. Future work will focus on refining user-level overcommitting mechanisms, mitigating non-deterministic behaviors, and expanding benchmark frameworks to include real-world scenarios.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑