Interupts/Week5 Flashcards

1
Q

What is a “process” ?

A

In operating systems, a process is an instance of running program.
* More formally, process can be viewed as a collection of all system resources used
for executing some program.

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

What is “multiprocessing” ?

A

having multiple harts, which are capable of executing multiple streams of
machine instructions simultaneously

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

What is “multitasking” ?

A

periodically switching a signle hart between multiple streams of machine
instructions

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

What is a “process context” ?

A

process context is the minimal amount of data – usually
contents of some or all processor registers – that must be saved to allow the
process to be interrupted and, later, resumed.

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

What is a “hart” ?

A

A pice of hardware within CPU that can fetch and perform instructions is usually called
“processor hardware thread”. It has its own
* Set of registers (x0-x31, …)
* Program counter (pc)
* control circuits that can fetch and pefrom instructions from memory

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

What happens when a device needs attention and sets its IRQ to 1.

A

When the CPU detects IRQ equal to 1, it finishes executing the current instruction but
instead of processing the next instruction, it:
1) Sets the bit corresponding to the device in the special Cause register
2) Saves the address of the next instruction in the special Exception Program Counter
(ECP) register
3) Disables all interrupts by resetting the Interrupt Enable (IE) bit in the Status register
4) Jumps to the starting address of the Interrupt Service Routine (ISR)

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

What is the “Interupt Service Routine” ?

A

The Interrupt Service Routine:
1) Saves contents of all CPU registers that ISR will use
2) Determines which device caused the interrupt and why (by reading status registers)
3) Services the device (e.g. supplies or consumes device data through MMIO registers)
4) Ensures that CPU sents IACK to the device
5) Restores contents of all CPU registers that ISR used
6) Returns to the interrupted task

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

What does the “mstatus” register do ?

A

(Machine Mode Status) This register enables overall interupt processing. Writing a 1 into the least significant bit allows for interupt handling.

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

What does the “mie” register do ?

A

(Machine Mode enterupt enable); This register controls interupt processing from specific sources
- writing 0x001 enables software interupts.
-writing 0x10 enables timer interupts.
-writing 0x100 enables external interupts.

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

What does the “mtvec” register do ?

A

(Machine Mode Trap Vector); This registers stores the address of the interupt service reoutine also known as the trap handler. When interupt occurs, the CPU jumps to this address to handle the interupt.

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

What does the “mscratch” register do ?

A

(Machine Mode Sratchoad Register); This register servers as a holding place for a CPU register value. Its used for temporary storage during the interupt handling.

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

What does the “mepc” register do ?

A

(Machine Mode Exception Program Counter); This register contains the program counter value at the time of an interupt. Its used by mret instruction to return from an interupt.

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

What does the “mcause” register do ?

A

(Machine Mode Interupt Cause); This register describes the cause of an interupt. It helps identify weather the interupt was due to an external even, a timer, or other reasons.

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

How does an “interupt” occur?

A

An interrupt is caused by a device external to a hart (e.g. timer, or MMIO
keyboard)

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

How does a “Software Exception” occur?

A

A software exception is caused by the hart itself
━ Arithmetic exception (e.g. division by zero)
━ Attempt to execute an unknown or unsupported CPU instruction
━ Attempt to access non-existent or prohibited memory location
━ User program invoking a system call (environment call)

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

How is mepc register value come from?c,

A

A software exception is caused by the hart itself
━ Arithmetic exception (e.g. division by zero)
━ Attempt to execute an unknown or unsupported CPU instruction
━ Attempt to access non-existent or prohibited memory location
━ User program invoking a system call (environment call)

17
Q

What does the “csrw” instruction do?

A

(Control and Status Register Write);
puts the value from some general purpose
register into one of CPU’s status and control registers. For example to put value from t0 into
ustatus we can use
csrw t0,ustatus

18
Q

What does the “csrr” instruction do?

A

(Control and Status Register Read) :
gets the value from one of CPU’s status and
control registers into some general-purpose register. For example to get the value from
uepc into t0 we can use
csrr t0,uepc

19
Q

What does the “csrrw” instruction do?

A

does both csrw and csrr, swaps the values.
csrrw t0,uscratch,t0

20
Q
A