<div dir="ltr"><div><div><div><div><div><div>Hi,<br><br></div>This is really not a linux kernel question, but I guess there are enough OS specialists on this thread that someone can point me in the right direction.<br><br>

</div>Some context<br>----------------------<br></div>On normal hardware machines its possible to change the page table flags to make a particular 4K page area as readonly or readwrite. This is generally used for protecting against memory corruptions. Now even if you have READONLY flags set in the page table, its possible to change the control register of a particular cpu (in a multicore system) such that, that cpu will not cause a fault/trap if you try to modify the contents of the page. What this means is let&#39;s say I have 4 cpus, and I change the control register on cpu-1, only cpu-1 will see the page as readwrite and others will see it as readonly.<br>

<br></div>I&#39;ve seen that this behavior is honoured in virtualised vmware environments too, so I&#39;m assuming that this cpu behavior is getting simulated somehow.<br><br></div>My problem is that I want to simulate the same behavior in userspace, where my 4 cpus map to 4 pthreads. I change the permissions of my memory area using mprotect() but then I also want to have a similar capability where I can flip/change something in one of the threads and that thread should be able to modify the region, while for other pthreads it is still a readonly page.<br>

<br></div>Any suggestions how vmware or other virtualised environments do this, or is this even possible ? Any pointers to the code is appreciated. (Sorry no locking/synchronisation solutions pls).<br clear="all"><div><div>

<div><div><div><div><div><div><div><br>-- <br>Thanks -<br>Manish<br>
</div></div></div></div></div></div></div></div></div></div>