Reputation: 21
In 32-Bit Linux, user space is 3G, and kernel space is 1G. From point of theory, can a kernel and user occupy the 4G address space, when they visit address, they can just visit by their page table. Is is feasible or why it is unable to implement?
Upvotes: 2
Views: 238
Reputation: 782683
It simplifies the kernel greatly to share the address space with the user. Consider a system call that wants to copy data provided by the caller into a kernel buffer. If they each had their own page tables, it would have to switch page tables between reading a word from the caller's buffer and writing it into the kernel buffer:
while (i < caller_buffer_length) {
switch_to_user_pt();
register = caller_buffer[i];
switch_to_kernel_pt();
kernel_buffer[i] = register;
i++;
}
If they're in the same address space, it can simply use memcpy()
.
Upvotes: 2