-
Notifications
You must be signed in to change notification settings - Fork 89
[Question] one instance per component #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, that's right: each component instance contains and encapsulates zero or more core instances and each core instance (created in a component-model context) has exactly one containing component instance. You could even go farther and say that each component instance contains and encapsulates one core wasm With threading, the idea is to extend the approach of the thread-spawn proposal by allowing component-level functions to be marked as However, even before we add Hope that helps, happy to answer any more questions. |
Thanks! That is what I thought. Thank you for the further explanation as well. If I understand it correctly, you mean how to make a component accessible from multiple threads in parallel and how to make internally-threaded components, given the support, right? What I am curious about is this scheme, where threads in a component would call other components:
These dependencies can be just instances of the same thing or different (what's important is that they are different from initiating component). Do they need to be thread-safe? Are there any extra consideration for communication between |
If I'm understanding your example right (let me know if not), |
Awesome, thank you for explaining. If two threads call (Edit) One concern I have with this, which is somewhat orthogonal to threading is the cost of trying to talk to multiple instances. Let's say a library of math primitives is a component: maybe passing a couple of values to and from is fast, and maybe handing off a sufficiently large array to it is fast too, but there might be a performance swamp somewhere in the middle where cost of communication becomes comparable to the cost of operation. |
Just one instance (in the thread-spawn world with "shared", threads never create new instances, either at the core wasm level or at the component level).
Maybe you have a more specific situation in mind but, just speaking generally to this: the situations in which one would call across component instance boundaries roughly corresponds to the situations where today you'd call across process boundaries or through a native extension interface (like JNI), which are already have significant or much greater overhead. Note that same-language calls (e.g., across library or package or dlls boundaries) are expected to compile to intra-component calls, using either static linking of the core module or shared-everything dynamic linking of multiple core modules (just like we do in wasm today). |
Thank you! Static linking via piqued my curiosity a little further, hence #239 |
Is it fair to say that multiple components are going to live in multiple instances from core point of view? It seems to be the case from the fact that components share nothing, but I might be missing something obvious.
If it is the case, I am curious what implications this would have from multi-threading point of view, in terms of what would happen when threads (regardless of how that is implemented) would call into components - would that work, and if so how?
The text was updated successfully, but these errors were encountered: