Lecture 5: System Calls Flashcards

1
Q

System calls do what?

A

Provide an interface to the OS’s services

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

System calls are written in what language?

A

C, C++, sometimes Assembly

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

How do you invoke system calls?

A

Through using Function Calls provided to the programmer via an API

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

How are parameters passed from Function Calls to System Calls (to the OS’s services)?

A

3 methods:

1) Registers (pass parameters to registers)
2) Block
3) Stack

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

Define:

1) Registers
2) Block
3) Stack

A

1) Registers: pass parameters to registers
2) Block : parameters stored in a block or table, in memory, and address of block passed as a parameter in a register
3) Stack: Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system

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

Out of the 3 OS-parameter-passing methods, which are limiting / not limiting?

A

Block and Stack do not limit the number or length of parameters being passed. Registers are limited (only fewer than 6 parameters can be passed to registers)

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

A system call number has an alternative name, what is it?

A

Read_Code (this points to where the actual code is located)

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

A system call number is associated with what?

A

with each system call.

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

What is a System Call Handler Table?

A

A table that the OS maintains which contains all the system call numbers (each entry is indexed by the system call number itself). Each entry points to the actual code to run the system call.

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

Define: TRAP Instruction

A

Instruction that switches the CPU from User mode to Supervisor (kernel) mode so the predetermined OS instructions can execute as a separate process.

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

What happens to the user process(es) when the TRAP instruction is used?

A

User process’s state is saved so the OS instructions needed can be executed. When finished, then the user process can execute.

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

List the steps in making a system call (5 Steps)

A

Step 1: After function call calls a system call, the calling program pushes the parameters onto the stack. (NOTE: There is a stack entry for each call)
Step 2: Input parameters are passed into registers or to a block
Step 3: TRAP instruction is executed
Step 4: System call handler code is executed
Step 5: After execution, control returns to the library procedure (system function)

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

How does a process find out about reading data from disk memory being completed?

A

1) Polling

2) Interrupt

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

What does the interrupt handler do:

A

Saves processor state: CPU registers of interrupted process are saved into a data structure in memory
Runs code to handle the I/O
Restores processor state: CPU registers values stored in memory are reloaded
PC is set back to PC of interrupted process

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