Pthreads - High memory usage

后端 未结 6 2013
梦谈多话
梦谈多话 2021-02-08 15:42

I am programming something in C that creates a lot of Pthreads in Linux on a 256Mb system. I usually have +200Mb free.

When I run the program with a low amount of thread

6条回答
  •  一生所求
    2021-02-08 16:14

    If you want lower overheads consider user-space threading technologies such as fibers, ala co-operative task management.

    http://en.wikipedia.org/wiki/Fiber_(computer_science)

    http://www.evanjones.ca/software/threading.html

    GNU Portable threads:

    http://www.gnu.org/software/pth/

    Boost C++ co-routines:

    http://www.boost.org/doc/libs/1_60_0/libs/coroutine/doc/html/index.html

    Windows-only fibers as an FYI:

    http://msdn.microsoft.com/en-us/library/ms682661(v=vs.85).aspx

    See the Wikipedia link for more example implementations.

提交回复
热议问题