Question
What is user space and is it different from the user stack? If the user stack is part of the user space, what else does user space have besides the user stack?
Answer
User space is a portion of memory of an Operating Systems that is not designated for kernel space. System calls enable user processes to enter kernel space. To read more about a system call, see this article.
System memory in Linux can be divided into two distinct regions: kernel space and user space. Kernel space is where the kernel (i.e., the core of the operating system) executes (i.e., runs) and provides its services.
http://www.linfo.org/kernel_space.html
Kernel space is mutually exclusive with user space (according to https://unix.stackexchange.com/questions/87625/what-is-difference-between-user-space-and-kernel-space, http://www.catb.org/jargon/html/U/userland.html, https://www.educative.io/answers/what-is-the-difference-between-the-kernel-and-user-spaces).
"Grossly simplifying, the kernel space is the memory area that is reserved to the kernel while user space is the memory area reserved to a particular user process. The kernel space is access protected so that user applications can not access it directly, while user space can be directly accessed from code running in kernel mode." (This quote was taken from https://linux-kernel-labs.github.io/refs/heads/master/lectures/intro.html.)
"When running in user mode, the CPU can access only memory that is marked as being in user space…" (according to page 605 of The Linux Programming Interface by Michael Kerrisk).
POSIX threads have IDs that are created and controlled in user space (according to page 605 of The Linux Programming Interface by Michael Kerrisk).
Yes, user space is different from the user stack. "In the user space, we can find the user stack that grows downward to lower addresses, whereas dynamic allocations (heap) grow upwards to higher addresses." (Taken from https://www.baeldung.com/linux/kernel-stack-and-user-space-stack.)
Definitely the user stack is only a sub-component of the user space. "The user space part of the virtual space is categorized into Stack and Heap, BSS, Data, Text." (Taken from https://medium.com/@shoheiyokoyama/understanding-memory-layout-4ef452c2e709.)
Here is a visual of what user space encompasses (beyond the user stack):
https://miro.medium.com/max/640/1*CtL4OiSQFvSrK8mIOkb5zQ.webp
BSS stands for Block Started by Symbol (according to http://dev.fyicenter.com/Interview-Questions/UNIX/What_is_BSS_Block_Started_by_Symbol_.html).
For further reading, see the following:
This explains the difference between the heap and the stack: https://stackoverflow.com/a/80113
This article refers to a user-space stack and to a user-space TCP stack.
This article also refers to a "userspace network stack."
This article refers to "user-space stack."
Do Either Kernel Space or User Space Play a Role in Operating Systems Networking?