V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
helloworld12
V2EX  ›  问与答

futex 的理解, 求指点

  •  
  •   helloworld12 · Oct 26, 2018 · 2088 views
    This topic created in 2742 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   ·   1190 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 17:44 · PVG 01:44 · LAX 10:44 · JFK 13:44
    ♥ Do have faith in what you're doing.