ufrisk / MemProcFS

MemProcFS
GNU Affero General Public License v3.0
3k stars 371 forks source link

Dealy when real-time memory needs to be read quickly #244

Closed BaimiLoveU closed 10 months ago

BaimiLoveU commented 10 months ago

In the previous issue about reading speed, you provided ways to disable automatic refresh, modify flags, and manually refresh to solve the occasional large delay. However, I encountered many problems after modifying the refresh and taking over. Is it possible to manually refresh specific Process memory, where should I modify it?

ufrisk commented 10 months ago

There is not.

The actual process refresh is quite fast. It basically throws away a lot of process-related data and reloads the process list.

The process related data is then re-generated on first access.

A known issue is that if you have a very large amount of memory allocations (as seen by the kernel, i.e. VADs) in your process, lets say 100,000 instead of the usual 100 it will take time to regenerate this information. Just reading that kinds of data from the device may be a couple of seconds worst case just to transfer the data.

Since this would be in the process you want to access anyway there is no real way around it.

DMA memory transfer is "slow" and either you don't update and then things start to drift and stop working after a while, or you do update (automatically or manually) but then you'd have to live with a short delay.