design icon indicating copy to clipboard operation
design copied to clipboard

Threads are old + have huge overhead, we should use goroutines!

Open PaperPrototype opened this issue 4 years ago • 3 comments

I've been perpetually somewhat disturbed by the idea of threads... they are a software/OS primitive, and they have a large overhead! Goroutines are a huge step in the righthdirection, and I think we shouldn't ignore this, and end up implementing "threads", in what is going to probably be the biggest movement in software (aka WASM, and its endless possibilities + its immediate widespread adoption).

What I am saying is we should remove threads from the accepted/to be implemented features of WASM, and instead look at the future and go with goroutines as the alternative (pun not intended).

I don't profess to be an expert in this area, but I think this makes sense (to me), and seems like an obvious direction to be going + in the future OS's could provide goroutines as primitives (thus giving us lighter and faster parrallelism capabilities)!

Or... maybe just have the "threads" api use goroutines (rathaer than actual threads?), is this possible?

PaperPrototype avatar Oct 30 '21 16:10 PaperPrototype

EDIT: looking/thinkig back on what I said, I am realizing that threads are already a common primitive, thus foring evertying to not be able to use them woudln;t make sense.

PaperPrototype avatar Oct 30 '21 16:10 PaperPrototype

We we actively work on a stack switching feature. Stay tuned. Better yet; get involved

fgmccabe avatar Oct 30 '21 19:10 fgmccabe

@fgmccabe I'd love to get involved, although I probably can't right now due to circumstances, but good luck!

PaperPrototype avatar Nov 07 '21 21:11 PaperPrototype

The stack switching proposal now has a repository: https://github.com/WebAssembly/stack-switching

Please follow up there with any questions!

sunfishcode avatar Oct 29 '22 23:10 sunfishcode