chapter 6: Limited Direct Execution Flashcards

1
Q

challenges of time sharing

A

performance

control

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what does “direct execution” mean

A

running the program directly on the CPU

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is the problem with direct execution?

A

problem 1: restricted operations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what are the 2 modes to prevent restricted operations

A

user mode : cant issue IO request

kernel mode : can do whatever

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly