Skip to content
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

Is it able to use a vm instance to run multiple function tasks? #89

Open
ActivePeter opened this issue Nov 14, 2023 · 4 comments
Open

Comments

@ActivePeter
Copy link

No description provided.

@L-jasmine
Copy link
Collaborator

The VM instance cannot simultaneously run multiple function tasks; it can execute multiple function tasks sequentially. This is because, during the execution of wasm, changes to some data in the VM may occur through host functions. Therefore, a function, while executing, requires a mutable reference to the VM.

@ActivePeter
Copy link
Author

How to implement the concurrency through wasm?

@ActivePeter
Copy link
Author

each task spawn a VM Instance?

@L-jasmine
Copy link
Collaborator

In most cases, a VM Instance includes both wasm and the host module. The execution of wasm often changes the state of the host module. If you ensure that your host module is reusable, you can retain this VM Instance after wasm execution, then register new wasm into it for subsequent runs.
Otherwise, it's better to create a new VM instance each time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants