samanbarghi / uThreads

A concurrent user-level thread library implemented in C++
Other
314 stars 22 forks source link

uThreadCache needs to check stack size #12

Closed samanbarghi closed 8 years ago

samanbarghi commented 8 years ago

uThreadCache currently just returns a uThread from the list. However, it needs to make sure the stack size of the chosen uThread is larger than the requested stack size.

samanbarghi commented 8 years ago

Should there even be various sized uThreads? it can add complexity and overhead to the runtime system. Also for segmented stacks there can be performance overhead according to this Rust documentation: https://mail.mozilla.org/pipermail/rust-dev/2013-November/006314.html

martinkarsten commented 8 years ago

I would stick with a default size for now and otherwise simply skip the cache.

If you want to be slightly more flexible, we could support several initial stack sizes, but only powers of 2. Then keep an array of thread pools, indexed by log2(stacksize) - log2(minstack).

What's the overhead of segmented stacks and can we even support it in a pure library? Probably not...

On 07/09/16 03:29 PM, Saman Barghi wrote:

Should there even be various sized uThreads? it can add complexity and overhead to the runtime system. Also for segmented stacks there can be performance overhead according to this Rust documentation: https://mail.mozilla.org/pipermail/rust-dev/2013-November/006314.html

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/samanbarghi/uThreads/issues/12#issuecomment-245280286, or mute the thread https://github.com/notifications/unsubscribe-auth/AJeeujvNE2FsyT290Fm_COl6JbNdvv8tks5qnrwggaJpZM4HOA2D.

samanbarghi commented 8 years ago

The best approach for now in terms of simplicity and performance is using fixed size stacks. So I close the issue.