Today, I have read through some documents about file system (http://tekrants.me/2014/07/14/linux-file-system-write/). And the term kernel page is mentioned several times in this article. I am now quite confused about the memory usage of kernel and of user.

I understand that the address space for kernel and user and between users are different. The virtual to physical mapping is independent with each other. Is the memory mapped to kernel address space cannot be mapped to any user address space?

And, for the article I mentioned above, it basically talks about the usage of page cache. So, when the operating system is asked to load some data or code from disk to the page cache, where should those pages holding the data and code come from? And can those pages be accessed by users?

1 Answer 1

  1. The kernel manages the memory, so kernel code has access to both kernel and user space. When talking about "kernel space" one usually means pages which are used exclusively by the kernel.

  2. "User space" is not a single entity. Each process has its own address space, possibly partially overlapping with other processes.

  3. The cache is governed by the kernel and cannot be accessed by user-space code. Of course, kernel can transfer pages from kernel space to user space if needed.

  • 1
    And, when you say cache, you mean the page cache right?
    – Xin Li
    May 15, 2015 at 0:54
  • 1
    Yes, exactly. Simply put, page cache is all the memory which is not used by kernel or user-space application. So the kernel uses it as a disk cache when possible. May 15, 2015 at 0:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .