I read about these topics but I have some questions remained unanswered and some points I wish to verify.
Kernel:
1.1. Verify:
1.1.1. The kernel is not a task nor an execution unit in the sense we are used to think of when we think of processes/tasks. It's a code , loaded into the RAM by the bootloader and being executed once the CPU jumps there (I know it's true for everything but the point is that its not a process that manages everything). "The early stage" executed kernel's code is responsible for initializing a bunch of staff and creating the first process. From that point , the only way a kernel's code will be executed is only if a process/task will stop their current execution, switch to "kernel context/kernel privileges" and will execute some kernel's code.1.1.2. The kernel has it's own stack and heap.
In its heap it stores different dynamically allocated data structures such as processes task_structs.
In its stack it stores , among the other , dynamically allocated processes kernel stacks.
1.2. Asking:
1.2.1. Where I determine the kernel stack and heap sizes (maximum sizes)?
1.2.2. Does The kernel image that is being loaded into the RAM by the Bootloader already contains the kernel stack and heap or just their "settings" and they are being allocated once the kernel code itself is being executed?
1.2.3. Where I can read / how can I see what is the content of the kernel's heap/stack? I wish to know which structures are kept in the heap and which in the stack.Process kernel stack:
2.1. Verify:
2.1.1. Each process keeps two stacks. the kernel stack is kept in the kernel space inside the kernel stack. the process itself cannot access its kernel stack since its in the kernel space. the kernel stack is there for the use of the kernel code to save the process execution state once it's get preempted.2.2. Ask:
2.2.1. What resides in the "kernel virtual memory space part" of each process virtual memory space besides of its kernel stack? I'm asking because 1GB (32bit system) is a lot. it sounds like a lot of space for just the process kernel stack.
2.2.2. Is there a code example of storing process info in its kernel stack and restoring it afterwards?
2.2.3. Are there other reasons for keeping portion of each process virtual address space reserved for the kernel code use?
Thanks