Hash Network Matrix Datab08c3417
Hash Network Matrix Datab08c3417
OS Program
Create entry for process list
Allocate memory for program
Load program into memory
Set up stack with argc/argv
Clear registers
Execute call main()
Run main()
Execute return from main
Free memory of process
Remove from process list
to it, and starts running the user’s code. Figure 6.1 shows this basic di-
rect execution protocol (without any limits, yet), using a normal call and
return to jump to the program’s main() and later back into the kernel.
Sounds simple, no? But this approach gives rise to a few problems
in our quest to virtualize the CPU. The first is simple: if we just run a
program, how can the OS make sure the program doesn’t do anything
that we don’t want it to do, while still running it efficiently? The second:
when we are running a process, how does the operating system stop it
from running and switch to another process, thus implementing the time
sharing we require to virtualize the CPU?
In answering these questions below, we’ll get a much better sense of
what is needed to virtualize the CPU. In developing these techniques,
we’ll also see where the “limited” part of the name arises from; without
limits on running programs, the OS wouldn’t be in control of anything
and thus would be “just a library” — a very sad state of affairs for an
aspiring operating system!
O PERATING
S YSTEMS WWW. OSTEP. ORG
[V ERSION 1.10]
2 M ECHANISM : L IMITED D IRECT E XECUTION
OS Program
Create entry for process list
Allocate memory for program
Load program into memory
Set up stack with argc/argv
Clear registers
Execute call main()
Run main()
Execute return from main
Free memory of process
Remove from process list
to it, and starts running the user’s code. Figure 6.1 shows this basic di-
rect execution protocol (without any limits, yet), using a normal call and
return to jump to the program’s main() and later back into the kernel.
Sounds simple, no? But this approach gives rise to a few problems
in our quest to virtualize the CPU. The first is simple: if we just run a
program, how can the OS make sure the program doesn’t do anything
that we don’t want it to do, while still running it efficiently? The second:
when we are running a process, how does the operating system stop it
from running and switch to another process, thus implementing the time
sharing we require to virtualize the CPU?
In answering these questions below, we’ll get a much better sense of
what is needed to virtualize the CPU. In developing these techniques,
we’ll also see where the “limited” part of the name arises from; without
limits on running programs, the OS wouldn’t be in control of anything
and thus would be “just a library” — a very sad state of affairs for an
aspiring operating system!
O PERATING
S YSTEMS WWW. OSTEP. ORG
[V ERSION 1.10]
2 M ECHANISM : L IMITED D IRECT E XECUTION
OS Program
Create entry for process list
Allocate memory for program
Load program into memory
Set up stack with argc/argv
Clear registers
Execute call main()
Run main()
Execute return from main
Free memory of process
Remove from process list
to it, and starts running the user’s code. Figure 6.1 shows this basic di-
rect execution protocol (without any limits, yet), using a normal call and
return to jump to the program’s main() and later back into the kernel.
Sounds simple, no? But this approach gives rise to a few problems
in our quest to virtualize the CPU. The first is simple: if we just run a
program, how can the OS make sure the program doesn’t do anything
that we don’t want it to do, while still running it efficiently? The second:
when we are running a process, how does the operating system stop it
from running and switch to another process, thus implementing the time
sharing we require to virtualize the CPU?
In answering these questions below, we’ll get a much better sense of
what is needed to virtualize the CPU. In developing these techniques,
we’ll also see where the “limited” part of the name arises from; without
limits on running programs, the OS wouldn’t be in control of anything
and thus would be “just a library” — a very sad state of affairs for an
aspiring operating system!
O PERATING
S YSTEMS WWW. OSTEP. ORG
[V ERSION 1.10]
M ECHANISM : L IMITED D IRECT E XECUTION 5
OS @ boot Hardware
(kernel mode)
initialize trap table
remember address of...
syscall handler
T HREE
© 2008–23, A RPACI -D USSEAU
E ASY
P IECES
M ECHANISM : L IMITED D IRECT E XECUTION 5
OS @ boot Hardware
(kernel mode)
initialize trap table
remember address of...
syscall handler
T HREE
© 2008–23, A RPACI -D USSEAU
E ASY
P IECES
M ECHANISM : L IMITED D IRECT E XECUTION 5
OS @ boot Hardware
(kernel mode)
initialize trap table
remember address of...
syscall handler
T HREE
© 2008–23, A RPACI -D USSEAU
E ASY
P IECES
8 M ECHANISM : L IMITED D IRECT E XECUTION
O PERATING
S YSTEMS WWW. OSTEP. ORG
[V ERSION 1.10]
8 M ECHANISM : L IMITED D IRECT E XECUTION
O PERATING
S YSTEMS WWW. OSTEP. ORG
[V ERSION 1.10]
8 M ECHANISM : L IMITED D IRECT E XECUTION
O PERATING
S YSTEMS WWW. OSTEP. ORG
[V ERSION 1.10]