.NET Framework中的手动内存分页(是否可以/如何进行?) [英] Manual Memory Paging in the .Net Framework (Is it possible / How?)

查看:135
本文介绍了.NET Framework中的手动内存分页(是否可以/如何进行?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对编写数据库管理系统非常感兴趣.阅读了有关如何实现SQL Server 2000的几页之后,我发现使用了4KB内存页,每个内存页都是硬盘上4KB页的直接副本.这些页面将根据需要加载到RAM中,然后在它们处于空闲状态时就懒惰地写回磁盘(过于简化).

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).

在我的项目计划阶段,我想知道在CLR上运行的代码中是否可以实现这种级别的控制.我意识到C,C ++或 D 可能更适合此任务,但我想证明这一点我自己.造成这种情况的部分原因是,我最终希望使用数据库作为堆,至少对于相对陈旧的对象,使用我自己的CLR垃圾收集器实际覆盖它.

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.

是否可以从CLR直接控制内存?如果是这样,我该怎么办?

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

现在假设我的数据是一堆256字节宽的结构/类,存储在磁盘的平面表中,并且我正在使用64KB页面.

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.

推荐答案

排序.您可以在.NET中使用内存映射文件,以便写入内存" 实际上是在写磁盘.

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

这篇关于.NET Framework中的手动内存分页(是否可以/如何进行?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆