Limited Direct Execution Flashcards
What are the two main challenges we face with virtualisation of the CPU?
Ensuring good performance, and being efficient while still maintaining control.
What is Limited Direct Execution? What are the limits?
Essentially, limited directly execution means that certain instructions are read in user mode, and if the program wants to do a privileged instruction, it must switch to kernel mode. You can only read and write from your own process memory, and timers are used to force you to yield execution.
What must a program do if it wants to run an IO request?
It must make a system call, so that it switches from user mode to kernel mode. To issue a system call, it must execute a trap instruction, and then perform a return-from-trap when they are done.
When is the trap table set up?
When the system is booted.
Name two ways that the OS can regain control from a program?
Relying on processes to yield themselves. Using timer interrupts.
What does a context switch involve?
Saving the current process context, and restoring the context of the process we are switching to.
Why are libraries important?
Because reading is cool…
Because it prevents us from having to make as many lengthy system calls to the kernel. Library calls are cheap, as they only use the library.
What is indirect execution?
Where the OS decodes and executes instructions of a user process itself. This is done in Java and Erlang. It tends to be quite time expensive.
What is direct execution?
Where the OS sets up the program, and then lets it run. This is less intensive and more efficient, but it places too much trust in the process.
What are synchronous and asynchronous interrupts?
Synchronous interrupts are exceptions raised by the CPU, e.g. when you try to access restricted memory. Asynchronous interrupts occur when the hardware detects something, such as keyboard, IO, etc.