关于mm_struct结构体

发布于 2022-10-15 04:24:37 字数 388 浏览 17 评论 0

字段atomic_t mm_count;在LKD3有下面的一句话:

When the kernel operates on an address space and needs to
bump its associated reference count, the kernel increments mm_count. Having two counters
enables the kernel to differentiate between the main usage counter (mm_count) and
the number of processes using the address space (mm_users).

究竟什么时候增长mm_count?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

因为看清所以看轻 2022-10-22 04:24:37

We'll try to explain the difference between the use of mm_users and mm_count with an example. Consider a memory descriptor shared by two lightweight processes. Normally, its mm_users field stores the value 2, while its mm_count field stores the value 1 (both owner processes count as one).

If the memory descriptor is temporarily lent to a kernel thread (see the next section), the kernel increases the mm_count field. In this way, even if both lightweight processes die and the mm_users field becomes zero, the memory descriptor is not released until the kernel thread finishes using it because the mm_count field remains greater than zero.

森林迷了鹿 2022-10-22 04:24:37

tks,内核线程用的是前一个进程的地址空间

澜川若宁 2022-10-22 04:24:37

准确的说,所有的内核例程都在一个空间里面。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文