chapter 6: Limited Direct Execution Flashcards Preview

Csc369 > chapter 6: Limited Direct Execution > Flashcards

Flashcards in chapter 6: Limited Direct Execution Deck (14)
Loading flashcards...
1
Q

challenges of time sharing

A

performance

control

2
Q

what does “direct execution” mean

A

running the program directly on the CPU

3
Q

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

A
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
Q

what is the problem with direct execution?

A

problem 1: restricted operations

5
Q

what are the 2 modes to prevent restricted operations

A

user mode : cant issue IO request

kernel mode : can do whatever

6
Q

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

A

user program performs a system call

7
Q

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

A

trap: jumps into kernel mode

return-from-trap: returns to user mode

8
Q

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

A

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

9
Q

how does user code execute system call?

A

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

10
Q

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

A
  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
Q

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

A

there are 2 ways, cooperative and noncooperative approach

12
Q

how does the cooperative approach work?

A

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
Q

how does the non-cooperative approach work?

A

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
Q

what is a context switch?

A

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