textbook chapter 8 Flashcards
(8.0) Define control transfer
Human Def: Moving from one instruction to another either by sequence or branch / returns.
Textbook Def: A transition from address a(k) -> a(k+1), where a(k) is the address of some corresponding instruction l(k).
(8.0) Define control flow
A sequence of control transfers
(8.0) Define Exceptional Control Flow (ECF)
Abrupt changes in the control flow not caused by the internal program. Computers need to do a lot of things, such as: context switch between processes, handle incoming network packets, user I/O, etc.
Exception: an abrupt change in the control flow in response to some
change in the processor’s state.
(8.0) What is a system call?
As an application user, it is requesting services from the OS.
Examples: Writing data to a disk, reading network data.
(8.1) What is an event? (In terms of exceptions and control flow)
A change in the processors state.
(8.1) True or False: All exceptions that a program faces are due to its current instruction.
False. An exception CAN occur because of a program’s instruction, such as a divide by 0, but could also occur due to a system timer going off or the need to read in network data.
(8.1) What goes on when the processor detects an exceptional event has occurred?
It makes an indirect procedure call (The exception), through a jump table called an exception
table, to an operating system subroutine (the exception handler) that is specifically designed to process this particular kind of event.
(8.1) What are the three ways the handler can finish its processing?
- Return to current instruction.
- Return to next instruction
- Abort the program
(8.1.1) What kind of exceptions are handled by the OS?
Divide by zero, page faults, memory access violations, break-points, arithmetic overflows.
(8.1.1) What kind of exceptions are handled by the processor?
System calls, I/O device signals.
(8.1.1) When is the jump table (exception table) initialized?
At system boot time (when the computer is reset or power,ed on)
(8.1.1) Define exception / jump table.
The exception table is a
jump table where entry
k contains the address
of the handler code for
exception k.
(8.1.1) What is the exception table base register?
The exception number is an index into the exception table, whose starting address is contained in a special CPU register called the exception table base register.
(8.1.1) Which mode do exception handlers run in?
Kernel mode (complete access to all system resources)
(8.1.1) Distribution of load between hardware and software
Once the hardware triggers the exception, the rest of the work is done in software by the exception handler.
After the handler has processed the event, it
optionally returns to the interrupted program by executing a special “return from interrupt” instruction
, which pops the appropriate state back into the processor’s control and data registers, restores the state to user mode if the
exception interrupted a user program, and then returns control to the interrupted program.