helloworld12
V2EX  ›  问与答

futex 的理解, 求指点

  •  
  •   helloworld12 · Oct 26, 2018 · 2145 views
    This topic created in 2769 days ago, the information mentioned may be changed or developed.

    写了个 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

    谢谢

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2648 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 15:43 · PVG 23:43 · LAX 08:43 · JFK 11:43
    ♥ Do have faith in what you're doing.