V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
helloworld12
V2EX  ›  问与答

futex 的理解, 求指点

  •  
  •   helloworld12 · 2018-10-26 02:05:58 +08:00 · 1612 次点击
    这是一个创建于 2006 天前的主题,其中的信息可能已经有所发展或是发生改变。

    写了个 go 程序, 然后发现 50 多个链接的时候,就占了 20%的 CPU (阿里云双核 4G)

    profile 了下, 发现 20% 被 futex 占据

     970ms 21.85% 21.85%      970ms 21.85%  runtime.futex
    

    怀疑 futex 是 spinlock (不断的尝试获取锁), 然后查找到这篇文章,说futex 支持futex_wakefutex_wait

    就是说,futex 是支持唤醒机制的,那么为什么会占据那么多的 CPU

    谢谢

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3268 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 12:54 · PVG 20:54 · LAX 05:54 · JFK 08:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.