Assume that process address spaces are isolated using the segmentation hardware. Consider the following:

1  void scheduler(void) {
2      struct proc *p;
3      ...
4      for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
5          if(p->state != RUNNABLE)
6             continue;
7          switchuvm(p);
8          p->state = RUNNING;
9          swtch(&cpu->scheduler, p->context);
10     }
11     ...
12  }