Exam 1 (up to Scheduling) Flashcards
What is the mode of communication between the CPU and Main Memory?
Memory Bus (DDRX)
Instructions come from
Memory hierarchy (iL1 cache)
What holds the address of each new instruction executed by the CPU?
Program Counter (PC)
PC is updated after each instruction with what?
Either the next instruction (move 4/8 bytes) or the target of a branch address to be taken
Four components of a CPU
Registers (temporary data storage), ALUs or Functional Units, PC for next instruction to fetch, Stack Pointer (SP) for top of stack
What is an ISA?
Instruction Set Architecture, a model of a computer. Involves Memory Operations (load, store), Arithmetic Operations (add, or), and Control Flow Operations (jne, jmp)
What is the purpose of a CPU interrupt?
To handle asynchronous events, possible external. These are handled at the end of instruction execution (the boundaries of instructions).
What is ISR?
Interrupt Service Routine. This is what happens when a CPU handles an interrupt. After the interrupt the PC will push the next instruction (before the interruption).
What is memory hierarchy?
The concept that smaller SRAM cells are kept closer to the CPU (more frequently used data is kept closer). When data is not found in SRAM, the CPU will go as far as DRAM.
How to determine if something is in the cache?
Cache is broken into blocks, then sets (which contain a certain number of blocks). If number of blocks in a set is one, it is called direct mapped. If there are n-blocks in a set, it is called n-way associative. You must find the set where the block exists and then search every block in the set by using the tag (tag comparison)
What happens on a cache miss?
Bring in a block from deeper in the hierarchy (maybe even DRAM) and evict a block in the SRAM (Least Recently Used, a.k.a. LRU).
What happens when a block is modified after it is evicted?
The data will need to be written again (write-back cache).
What is Memory Mapped IO?
The CPU can access IO devices like regular memory, using addresses. Events from IO devices are handled as interrupts.
What’s the problem with Memory Mapped IO?
It causes a lot of CPU resource usage. Everything the IO devices does needs to be handled by the CPU. Solution is to add controllers to the IO devices to take the usage off of the CPU.
Components of a Program
Code, Data, Stack, Heap. Space occupied by each part is called a segment.
Where are heap and stack located before execution in memory?
Heap starts at a lower address and grows toward higher addresses. Stack starts at the highest address and grows toward lower addresses. Both are empty before execution.
How does a computer know how to execute a program?
Load code and data into memory, set Heap and Stack pointers, and set the PC to main.
What’s the difference between a program and a process?
A process is a program in execution. A process has a program and a state at any point in time.
How to create a process in UNIX?
Call either fork() or exec(). fork() will create a duplicate of the already running process, and both will execute the next instruction from the PC. exec() will override the calling process with a new one.
What happens when you type a.out() in the shell?
The shell itself is a process that then calls fork() to make a duplicate of itself. The duplicate then calls exec() with a.out as a parameter, which runs the program.
What is it called to perform one activity after another when you have many to run?
Batching
What does it mean to time-multiplex the CPU amongst the processes?
It means even if one activity is done, we may still want to move on to processing another.