robert-w-gries / rxinu

Rust implementation of Xinu educational operating system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Process allocation occurs on the heap?

toor opened this issue · comments

commented

It seems to me that you are using a Vec as the process stack in the scheduler. Surely this is bad practice, as accessing the heap to allocate Vec's is a relatively slow process compared to stack allocation. Would it be possible to utilise the stack allocator directly rather than using vectors for stacks?

Hi @too-r thanks for the contribution!

The Vec you see in the process creation is the kernel stack. The kernel stack is dynamically allocated for each process (and eventually each thread) to support usermode execution.

The name was misleading at first. Sorry to lead you astray! I recently changed the field from Process.stack to Process.kstack to make that distinction more clear.

commented

I see, thank you for the clarification.