Reputation: 113
I have not been successful in finding out what uvm or kvm stands for in xv6. I will need it for an exam on explaining each part of a section of a code, and I would love to be able to say its definition also. Is here anyone who can tell me? I'm trying to understand what the switch command does exactly and what parts it switches when calling either.
c->proc = p;
switchuvm(p);
p->state = RUNNING;
swtch(&(c->scheduler), p->context);
switchkvm();
Upvotes: 2
Views: 5229
Reputation: 9659
The u in switchuvm
stands for User.
The k in switchkvm
stands for Kernel.
The OS loads the process information to run it.
After having loaded the process (see line 165) switchuvm(p);
The process is marked running (p->state = RUNNING;
) and the processor switches to execute it (swtch(&(c->scheduler), p->context);
)
When the process comes back to scheduler (so after the swtch
) the kernel load its memory: switchkvm();
Here the explaination from proc.c
file:
//PAGEBREAK: 42 // Per-CPU process scheduler. // Each CPU calls scheduler() after setting itself up. // Scheduler never returns. It loops, doing: // - choose a process to run // - swtch to start running that process // - eventually that process transfers control // via swtch back to the scheduler.
Upvotes: 4