Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

Operating system kernel and processes in main memory

$
0
0

Continuing my endeavors in OS development research, I have constructed an almost complete picture in my head. One thing still eludes me.

Here is the basic boot process, from my understanding:

1) BIOS/Bootloader perform necessary checks, initialize everything.

2) The kernel is loaded into RAM.

3) Kernel performs its initializations and starts scheduling tasks.

4) When a task is loaded, it is given a virtual address space in which it resides. Including the .text, .data, .bss, the heap and stack. This task "maintains" its own stack pointer, pointing to its own "virtual" stack.

5) Context switches merely push the register file (all CPU registers), the stack pointer and program counter into some kernel data structure and load another set belonging to another process.

In this abstraction, the kernel is a "mother" process inside of which all other processes are hosted. I tried to convey my best understanding in the following diagram:

enter image description here

Question is, first is this simple model correct?

Second, how is the executable program made aware of its virtual stack? Is it the OS job to calculate the virtual stack pointer and place it in the relevant CPU register? Is the rest of the stack bookkeeping done by CPU pop and push commands?

Does the kernel itself have its own main stack and heap?

Thanks.


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>