Manual Memory Paging in the .Net Framework (Is it possible / How?)

我怕爱的太早我们不能终老 提交于 2019-12-10 07:22:31

问题


I have a major interest in writing a database management system. Having read a few pages about how SQL Server 2000 was implemented, I discovered that 4KB memory pages were used, each being a direct copy of a 4KB page on the hard disk. These pages were loaded into RAM as needed, and then lazily wrote back to disk when they fell idle (oversimplification).

Being in the planning stage of my project, I am wondering if this level of control is possible in code running on the CLR. I realize that C, C++, or D is probably a better fit for this task, but I would like to prove that to myself first. Part of the motivation behind this is that I would eventually like to actually override the CLR Garbage Collector with my own, using my database as the heap, at least for relatively stale objects.

Is it possible to directly control memory from the CLR? If so, how would I do this?

Assume for now that my data is a bunch of 256 byte wide structs/classes, stored in a flat table on disk, and I'm using 64KB pages.


回答1:


Sort of. You can use memory mapped files in .NET so that writing to "memory" is really writing to disk.



来源:https://stackoverflow.com/questions/12380852/manual-memory-paging-in-the-net-framework-is-it-possible-how

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!