gpt4 book ai didi

java - 应用程序空闲时意味着什么

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:51:46 25 4
gpt4 key购买 nike

我正在阅读有关虚拟内存交换的内容,它说当应用程序空闲时可以交换内存页面。我试图用谷歌搜索这意味着什么,但除了 this 之外没有找到更多详细信息。计算器答案:

Your WinForms app is driven by a message loop that pulls messages out of a queue. When that queue is emptied, the message loop enters a quiet state, sleeping efficiently until the next message appears in the message queue. This helps conserve CPU processing resources (cycles wasted spinning in a loop takes CPU time away from other processes running on the machine, so everything feels slower) and also helps reduce power consumption / extend laptop battery life.

那么当消息队列中没有消息时,应用程序会变为空闲吗?

最佳答案

操作系统决定空闲意味着什么。通常,这意味着应用程序不会主动利用系统资源(如处理器周期、IO 操作等)。

但是,这并不意味着如果应用程序不处于“空闲”状态,则不会交换应用程序在内存中的页面。可能有许多“Activity ”应用程序争用相同的有限物理内存,并且操作系统可能被迫交换属于 Activity 应用程序的一些页面以为另一个 Activity 应用程序腾出空间。

关于java - 应用程序空闲时意味着什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31474786/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com