Idea: Implement Concurrent GC on the windows Platform
Benjamin Thaut
code at benjamin-thaut.de
Sun Jan 6 18:32:58 UTC 2019
Hi,
I recently came accross this article:
https://blogs.msdn.microsoft.com/vcblog/2018/09/26/step-back-going-back-in-c-time/
which mentions the following "new" kernel API of Windows.
https://docs.microsoft.com/de-de/windows/desktop/api/processsnapshot/nf-processsnapshot-psscapturesnapshot
It has the following properties (See "under the hood" chapter in
the first link.)
<quote>
* Create a ‘snapshot’ which looks suspiciously like the child
process of an existing process that has no threads running.
* Mark the processes memory, it’s page tables (Wikipedia), as
copy-on-write (Wikipedia). That means that whenever a table is
written to, the table is copied.
</quote>
Now this looks a lot like a fork. At least it does what you would
need from a fork for implementing the concurrent GC. If I
remember correctly the main problem of the concurrent GC on
windows was that there is no equivalent of fork.
The only problem is that there are no threads running after the
"fork" but for that CreateRemoteThread could be used.
Unfortunately I currently don't have the time to try this out
myself. But in case someone has time and is interrested and this
does work out I could see the concurrent GC become a viable
replacement option for the current gc.
Main downside is, that this API has been added with Windows 8.1.
But as windows 7 is going out of support starting in 2020 I think
this is not that big of a downside.
Kind Regards
Benjamin Thaut
More information about the Digitalmars-d
mailing list