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

Moving objects between threads #138

Open
MostAwesomeDude opened this issue May 31, 2021 · 1 comment
Open

Moving objects between threads #138

MostAwesomeDude opened this issue May 31, 2021 · 1 comment

Comments

@MostAwesomeDude
Copy link

Suppose I have many (thousands to millions of) objects per thread, all managed by the GC on the heap, and several dozen threads. These objects are concurrent actors. A thread can run a single actor at a time.

There is a theoretical problem where one thread may be starving some of its actors due to too many incoming messages, while another thread has no work to do, leading to poor multicore performance. In this situation, a possible technique is to evict actors from the busy thread to the idle thread.

What's the best way to move a GC object from one thread to another? I am prepared to accept that it isn't possible and that I will have to copy the object in chunks by sending messages between threads.

@orangeduck
Copy link
Owner

I don't think there are functions to do it right now in Cello but in theory it should be possible to de-register a pointer with one thread's GC and then re-register the same pointer with a different thread's GC. You will need to also ensure there is some pointer to this object on the new thread's stack or in some part of that thread's GC heap.

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