robert-w-gries / rxinu

Rust implementation of Xinu educational operating system
Apache License 2.0
33 stars 4 forks source link

Process allocation occurs on the heap? #35

Closed toor closed 6 years ago

toor commented 6 years ago

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?

robert-w-gries commented 6 years ago

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.

toor commented 6 years ago

I see, thank you for the clarification.