2018-04-17 14:03 GMT+02:00 Clément Bera <bera.clem...@gmail.com>: > Hi Pavel, > > I'm looking at PosixSharedMemory again since I have to write a Master > student proposal and I think this could be a good topic. I'm not really > expert on SharedMemory, so I'm going to share what I have in mind, we can > discuss about it, you could also co-supervise the student indirectly (though > officially the supervisor has to be VUB staff). > > Implementation-wise, I was thinking what could be interesting are: > - Making PosixSharedMemory compatible with TaskIt so from you image you can > create a SharedMemory buffer, spawn another image+VM and attach it to the > shared memory to have multiple threads working on the shared section. > - Add the #at:if:put: primitive, which write into the shared memory using > compare and swap instruction for efficient thread-safe access. > - Add on SharedMemory all the primitives to read/write native types to the > buffer (int64, double, etc.) with CAS and non CAS instructions. > - Maybe add APIs to read/write objects through Fuel to pass them by copy, > though this looks difficult in some cases. > - Implement a lock system or a semaphore system on top of the CAS > - implement lock-free and lock-full algorithm using CAS and non CAS > instructions (I think a first try would be parallelSort on a 1Gb buffer of > int32 with 4 native threads) > > What do you think ? Do you have ideas ? Are you interested ? Do you thing > having a student on this would be nice ? > > The master thesis proposal has to include a research question. I am not sure > what other languages do regarding shared memory.It's not clear so far what > the research question is.
I can forward that to a researcher here working on distributed shared memory. Research question can be: - heterogeneity (x86 + pi at the same time) - load balancing between competing images on heterogeneous hardware ... - Object migration (pointer forwarding). Probably not, state of the art is very advanced on that which means a costly implementation to reach parity. Thierry > > Best, > > On Mon, Feb 12, 2018 at 10:33 AM, Pavel Krivanek <pavel.kriva...@gmail.com> > wrote: >> >> Hi, >> >> among other less interesting things, I spent some time on existing >> PosixSharedMemory project. It is a UFFI binding for the LibC methods >> that provide support for the memory allocation between several >> separate processes. I significantly improved the performance by >> implementing the block access. Writing of 10MB byte array takes about >> 1 millisecond, reading of it from other image took me about 4 >> milliseconds. While serialization with Fuel is very fast, it opens >> interesting possibilities. >> To have a shared memory without synchronization tools is not very >> useful so I wrote a basic UFFI interface for the POSIX named >> semaphores. They are quite easy to use and work nicely with Pharo. The >> VM can all wait on the semaphore or it can check the status of it >> periodically in an image thread. It has two small disadvantages. It >> requires to dynamically link the next library (pthread) and they must >> be cleaned manually. I plan to look at System V alternative in future. >> Now we should write a nice framework for inter-image communication on >> top of it or/and adopt Seamless for it ;-) >> >> Cheers, >> -- Pavel >> > > > > -- > Clément Béra > https://clementbera.github.io/ > https://clementbera.wordpress.com/