How much overhead is there when creating a thread?

后端 未结 11 1379
故里飘歌
故里飘歌 2020-12-02 20:14

I just reviewed some really terrible code - code that sends messages on a serial port by creating a new thread to package and assemble the message in a new thread for every

11条回答
  •  佛祖请我去吃肉
    2020-12-02 20:23

    For comparison , take a look of OSX: Link

    • Kernel data structures : Approximately 1 KB Stack space: 512 KB (secondary threads) : 8 MB (OS X main thread) , 1 MB (iOS main thread)

    • Creation time: Approximately 90 microseconds

    The posix thread creation also should be around this (not a far away figure) I guess.

提交回复
热议问题