This Gist has a super hacky ugly implementation of a part of the UserfaultFD feature of the linux kernel (awkwardly) using raku's NativeCall. This could be much improved with a little bit of care.
Check this recording of what happens:
you can see multiple worker threads (doods) trying to read from and write to a memory region that was initially write-protected and watched for access attempts by the UFFD thread.
The doods are stopped in their tracks when they first access some location, then the UFFD thread decides to let them continue after copying some data into the area and when they try to write to it, it just un-write-protects the page.