chapter 6: Limited Direct Execution Flashcards Preview

Csc369 > chapter 6: Limited Direct Execution > Flashcards

Flashcards in chapter 6: Limited Direct Execution Deck (14):
1

challenges of time sharing

performance
control

2

what does "direct execution" mean

running the program directly on the CPU

3

direct execution protocol (how it works) (not limited)

OS:
create entry for process list
allocate memory for program
load program into memory
set up stack with argc/argv
clear registers
execute call main()

program:
run main()
execute return from main

OS:
free memory of process
remove from process list

4

what is the problem with direct execution?

problem 1: restricted operations

5

what are the 2 modes to prevent restricted operations

user mode : cant issue IO request
kernel mode : can do whatever

6

what should a user process do when it wishes to perform some kind of privileged operation such as reading from disk?

user program performs a system call

7

what is trap and return-from-trap instruction that the OS performs?

trap: jumps into kernel mode
return-from-trap: returns to user mode

8

how does OS make sure that the trap knows what to run?

the OS initializes a trap table that is mapped to syscall handlers

9

how does user code execute system call?

it specifies a system-call number which maps to a system call and let the kernel do the thing.

10

what are the 2 phases in the LDE(limited direct execution) protocol?

1. at boot time, kernel initializes trap table
2. kernel sets up a few things. when process wishes to perform syscall, it traps back into OS, performs it, and return from trap to the process.

11

if a process is running, the OS isnt. how can OS regain control so that it can switch between processes?

there are 2 ways, cooperative and noncooperative approach

12

how does the cooperative approach work?

the OS regains control of the CPU by waiting for a system call or an illegal operation to take place.
note: if process goes in infinite loop here, the only way is to reboot the machine

13

how does the non-cooperative approach work?

a timer interrupt!
when the interrupt is raised, the process is halted and the OS regains control.
note: hardware needs to save state of process to resume running it later

14

what is a context switch?

save a few registers on current running process
and restore registers for the soon to be executing process
note: it may hinder performance