防止页面错误 [英] Preventing Page Faults

查看:60
本文介绍了防止页面错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个实时应用程序,它必须在大约16.6毫秒(或60Hz)的窗口中运行,然后我们才能进行运行".并开始实时操作,我们将加载约500 MB的几何图形和其他数据.我们的目标系统是一个4核Windows 7盒子,带有 安装了12 gigs的RAM.我们确实没有太多其他资源可以运行,并且我们的总内存使用量不到2个演出.在大约99%的时间里,我们都处在窗口之内,而我们只需要5毫秒来处理帧,大约需要11毫秒的繁忙等待时间, 我们的计时可能会稍微偏离16.6窗口+/- 1 ms,而不会出现太多问题.我们有时会看到+30 ms的停顿,并且在我们的某些"16 ms"延迟期间会遇到2000+页错误.帧,当我们重新同步时,我们已经 谈论悬挂大约45毫秒时,我们可能会在5分钟内看到其中7个失速.这些30毫秒以上的停顿对我们来说是无法接受的.

I have a real-time application, it has to run with a window of about 16.6 ms (or 60Hz), before we go to "run" and start our real-time operation we load about 500 MB of geometry and other data. Our target system in is a 4-Core Windows 7 box with 12 gigs of RAM installed. We really do not have too much else we are running and our total memory usage is under 2 gigs. For about 99% of the time we are well within our window, and we are taking just 5 ms to process our frame, and around 11 ms of busy waiting, our timing can float a little out of the 16.6 window maybe by +/- 1 ms without too many problems. We are seeing from time to time stalls of +30 ms and getting 2000+ page faults during some of our "16 ms" frames, by the time we have re-synced we are talking about hanging for like 45 ms, we see maybe 7 of these stalls in 5 minutes. These 30+ ms stalls are just unacceptable for us.

 

问题是,我们如何减少页面错误.考虑到我们拥有多少RAM和实际使用了多少内存,我宁愿再也不会分页处理任何东西.我已经看过使用VirtualLock,即我们的工作集"就像800 MB 我想锁定整个内存空间,以防止页面被分页.是否知道防止Windows从物理内存中分页数据的实用方法?

The question is, how can we cut down on page faults. Really given how much RAM we have and how much we are actually using I would rather not have anything paged out ever. I have looked at using VirtualLock, our "working set" is only like 800 MB and I would like to lock down the entire memory space to keep it from being paged. Does any know of a practical way of preventing Windows from paging our data out of physical memory?

我了解Windows Pages出了很长时间未触及的数据,而且我们要等到运行30分钟后才能获取一些数据,但是我们真的不希望在运行期间加载任何数据

I understand Windows Pages out Data that is not touched in a long time, and well we are not going to get to some our data until 30 minutes into a run, but we really don't want to load anything durring a run.

推荐答案

听起来有点像您在假设页面错误导致挂起".延误.我向您保证,您的计算机未挂起,正在执行某些操作.  您应该弄清楚在45毫秒内发生了什么事.

It sounds a bit like you're assuming that the page faults cause the "hanging" delays.  I assure you, your computer is not hanging, it's doing something.  You should figure out what's going on in that 45 ms period.

您应该密切注意自己的堆.  糟糕的内存分配策略将导致不必要的堆操作.  如果您是实时的,则不惜一切代价避免堆.我是说...如果可以帮助,不要使用堆!为您的计划 资源,请提前分配它们.  重复使用它们.

You should be watching your heap closely.  Poor memory allocation strategies will cause unnecessary heap operations.  Avoid the heap at all costs if you are real-time.  I mean it...don't use the heap if you can help it!  Plan for your resources, allocate them ahead of time.  Reuse them.

注意系统中其他应用程序的IO操作.  系统中是否有任何异常硬件?  特别是任何USB IO正在进行吗?

Watch for IO operations by other applications in the system.  Do you have any unusual hardware in the system?  Particularly any USB IO going on?

您使用任何重量级的库吗?  (例如DirectX/DirectShow吗?)

Do you make use of any heavyweight libraries?  (like DirectX / DirectShow?)

您还有其他重量级应用程序在运行吗? - (就像SQL Server一样?即使是空闲的,也会定期吸收资源.)

Do you have any other heavyweight apps running? -- (like SQL server? even idle, it'll suck resources periodically.)

观察响应网络流量的应用程序.  如果不需要,可在配置文件时拔出电缆.

Watch for apps that respond to network traffic.  Yank the cable while profiling if you don't need it.

通常是病毒检查程序-希望您已经排除了其他程序.  偶然地,这些客户端计算机还是专用工作站?

Virus checkers are the usual suspects - hopefully you've ruled out other processes.  Incidentally, are these client machines or dedicated workstations?

您不需要锁定内存.  如果您有很多物理RAM,就可以了.

You shouldn't need to lock down your memory.  If you have lots of physical RAM you'll be okay.

我认为您已经适当调整了流程优先级.   SetPriorityClass(...,REALTIME_PRIORITY_CLASS); SetThreadPriority(...,THREAD_PRIORITY_TIME_CRITICAL);

I assume you've adjusted process priorities appropriately.  SetPriorityClass(...,REALTIME_PRIORITY_CLASS); SetThreadPriority(...,THREAD_PRIORITY_TIME_CRITICAL);

 

我看到您花了很多时间来衡量时间.  但是现在是时候确定在这些时间间隔内发生了什么.

I see you've spent lots of effort measuring timing.  But now it's time to decide what's happening in those intervals.

" ...不想在运行期间加载任何内容."  有趣,但高度含糊.  我想知道你到底在做什么!

"...don't want to load anything during a run."  Interesting, but highly ambiguous.  I'm wondering what exactly you're up to!



这篇关于防止页面错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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