Comp 1313 Systems 1 Flashcards
What is a combination circuit?
An Interconnected set of gates whose output is a function of the input at a time.
What is a tri-state?
A gate with a extra input that disables the gate, used to prevent short-circuits.
How would I make a two variable Karnaugh Map?
- Create a table using your two variables, e.g A on top row and B on the first column
- Fill the next row/column with the possible values of the variables.
- Use the expression to calculate what result in 1, and place these in the table.
- Draw rectangles of size 2^n boxes around the ones. They cannot be diagonal and must be as big as possible.
How do you decipher a Karnaugh Map?
- Take each box
- If the digit in the heading stays the same keep it, otherwise discard the box
- The boxes left represent the expression
Why can’t machine code be run on different machines?
As different CPU’s have different instruction sets.
The clock is an electronic pulse. So when does the CPU perform an action?
On a clock edge
What is RISC?
Reduced Instruction Set Computer
What is CISC?
Complex Instruction Set Computer
How can runtime be calculated?
Runtime = instruction-time x cycles per instruction x Number of instructions
What is the difference between RISC and CISC?
RISC often has one instruction per cycles, while CISC instruction are more complex and therefore can take multiple cycles.
CISC will look much nicer than RISC code.
CISC aims to reduce Ninstr while RISC reduces the cycles per instruction
What is a register?
A group of flip-flops that can store multiple bits. Used as temporary storage on the processor.
What is a shift register?
They shift a bit every single clock cycle along the register. This is used to convert between serial and parallel data.
How many registers (general purpose) are needed?
16ish
Where are registers on the memory hierarchy?
Top
What is a general purpose register?
They store the CPU’s current required data.
How big is a register (general)?
Word length or more depending on if it has a specific purpose (e.g storing floating points)
What are the 6 types of registers?
Address only
General purpose
Condition Code
Status/flags
Control
Special
What can be stored in an address only register?
Just a memory address
What is the purpose of a Condition Code register?
Set of individual bits that indicate if an error has occurred.
Can a condition code register be written to be a program?
Not usually, but they can be read from
What is a Status/FLAGS register?
A register contain condition code or the sign of a result, an overflow indicator.
What are control registers?
A set of registers that are hidden by the CPU. This includes the MBR, MAR and others.
The PC is the only control register readable by assembly
What is a special register?
An additional register used for a specific function, like storing vectors. Usually implemented on CPU’s that have a specific purpose.
What is a pipeline?
Overlapping instructions with the aim to complete one instructions per cycle rather than one stage per cycle (if that).
Similar to an assembly line.
What can ruin pipelining?
Branching
How can we deal with branches?
Multiple streams
Prefetch Branch Target
Loop buffer
Branch Prediction
What is Prefetching the Branch target
Prefetch the branch target and a few instructions after before the actual branch
What is loop buffering?
Very fast memory that store the last n instructions, maintained in the fetch stage of the pipeline.
Check the buffer before fetching, and then load the buffer instead.
Good for small loops
What is Branch predicition?
Predict where you’re going to branch.
This involves predict that you either will always branch here or will never branch here.
If so we either prefetch the next instruction or the branch instructions.
How can we improve branch prediction?
Predicting by Opcode. As some are more likely to jump than others (75% success rate)
Taken/Not taken switch, use previous execution history to detirmine if it’s going to jump.
What is overloading?
Operators have different meanings in different algebras.
How many bits can be stored in a register of length n?
2^n-1
What are some benefits of biased offset?
Eliminates negative values
Simplifies comparison operations
Symmetrical range about zero
Facilitates floating point
Simpler conversion between systems
What does two’s complement avoid?
Avoids the double representation of zero
How to convert to two’s complement?
Flip every bit and then add one
How to convert to biased-n?
Add the bias to the original number and then convert to an unsigned binary number
What is biased-n?
Shifting by a bias so that 0000… would be -128 and 1111… would be 128
What is superscalar?
Doing simple commands at the same time using multiple arithmetic units.
Basically not vector or array logic
What is true data dependency?
When one instruction is dependant on another instruction happening previously and thus cannot execute together.
What is procedural dependency?
Can’t execute instructions after a branch with instructions before, otherwise we waste processor time.
What is resource conflict?
Two or more instructions request the same resource at the same time.
How can resource conflict be resolved?
By duplicating the resource
What is instruction level parallelism?
Instructions in a sequence are all independent of each other, so their execution can be overlapped.
Governed by data and procedural dependency.
What is machine parallelism?
Ability to take advantage of instruction parallelism.
What is an instruction issue?
Where the order of instructions, fetched, executed, memory and registers changed.
What is an In-order issue?
Issuing instructions in the order the occur
This is inefficient
Instructions could stall if required
What is an out-of-order issue?
Decouple, decode pipeline from the execution pipeline.
Continue to fetch and decode until the pipeline is full, when a unit becomes available then we use it.
What are the result of out-of-order issue?
We need additional logic to ensure that our code isn’t destroyed by being executed out of order.
What is antidependancy?
One instruction cannot happen before another, as the first instruction modifies the other instruction’s operands.
What is register renaming?
Avoid antidependancy by dynamically allocating registers as they are needed to have copies of the original values before have the code reference that version of the registers. These are stored in register specifically for this.
Avoiding pipeline stalls.
What is machine parallelism?
Duplication of resources with out-of-order issues.
Need instruction window length large enough to “see” instructions incoming.
What is speculative execution?
If there is a unit free we can do instruction that may be needed. And dispose of their results if they are not.
Out of order execution can provide this, but, leads to the meltdown vulnerability.
What are the two main families of OS?
Microsoft Windows and UNIX-like
What do OS provide programmers?
An easy and convenient interface with the system.
It is essentially a mediator between programs and hardware.
Why does the OS conceal complexity?
To protect users and programmers from having to work with horrendous complexity. (IP, Compilers, Drivers)
To protect users and programmers from the details of the hardware through an interface.
What does the kernel provide?
Memory management
Task management
File management
Device management
What is kernel memory management?
Allocation of memory and management of virtual memory
Also restricts access helping with programming errors and malware.
What is kernel task management?
Launching processes
Maintaining the process table in memory
Performing time slicing and context switching
Handling interrupts
What is kernel file management?
Respond to program request to open files
Set and check permissions
Handle buffering
What is kernel device management?
Use drivers to respond to request to use devices.
What essential features are required for an OS?
Memory protection
Timer
Privileged instructions
Interrupts
What is scheduling?
Making effective use of the processor because the processor is much faster than memory or I/O devices, so scheduling is required so that other task can be completed while one waits.
What is context-switching?
The state of a running process is saved, and another process given processor resources
What does PCB stand for?
Process Control Block
Comes with an:
Identifier
State
Volatile environment
Priority
I/O status
Accounting information.
What are the types of scheduling?
Long-term
Medium-term
Short-term
I/O
What is swapping?
When space becomes available processes are loaded from disk and when they are stalled or finished they are removed.
What is partitioning?
How do we distribute a set of processes (of unknown and varying sizes) onto fixed memory.
What are fixed partitions?
Partitions of memory of a fixed size
What are variable partitions?
Partitions allocated as required, may lead to fragmentation
What are the three types of address involved in partitioning?
Logical Address, location relative to beginning of the program
Physical address, the actual location in memory
Base address, current starting location of the process
What is paging?
We divide memory into lots of small, equal chunks (frames)
Divide processes into chunks (pages) of the same size as these frames
Then we can map pages to frames efficiently (in terms of memory)
How do we link a logical and physical address?
Through the page table
Why do we need page tables?
Page tables show exactly what pages belong to what process, by translating base address to physical address.
What is demand paging?
Each page of a process is swapped in only when it is needed.
This makes it possible for a program to be larger than memory as only pages required are loaded, a page fault is triggered to inform the OS that a new page is required.
What are the advantages and disadvantages of demand paging?
Advantages:
More processes can be maintained
Time is saved
Disadvantages:
This uses swapping, so one page in and one out.
Thrashing can occur - Where the processor spends most of it’s time swapping pages.
T/F The process table can be paged out
True
What is the TLB?
Translation lookaside buffer
Every logical access requires two physical access, page table entry and the actual access
Most systems have cache reserved for TLB
What is segmentation?
Allowing the programmer to view memory as a series of address spaces or segments.
Good for handling growing data structures
Recompilation independently without requiring an entire set of programs to be recompiled
Sharing among processes
Protection
What is simultaneous multithreading?
One core can look like two with extra instructions but sharing execution units allowing separate threads to run.
What is power management?
Using a separate microcontroller to monitor power
Can shut-off cores and boost cores when required.
What is a turbo boost?
We can turbo-boost a core for short burst or if we are only running a single core.
Used widely.
1 or 2 cores active at 5Ghz
or 3-4 active at 4.8
or 5-8 active at 4.7
In modern systems, is RAM connect to the CPU or the Chipset on the motherboard
Directly to the CPU.
What is NUMA?
Non-Uniform Memory Access
Multiprocessor systems with separate blocks of RAM to reduce bottlenecks and is good with large numbers of cores
What is an NPU?
Neural Processing Unit
specialist unit in a CPU for neural net calculations
What is the hybrid architecture?
Using a mix of performance and efficency cores.
As processes using less resources can run on E cores
E cores are much smaller than P cores
What is a network?
Multiple computer that are connected together and can share information/resources
What is a WAN, LAN, MAN and PAN?
Wide Area Network
Local Area Network
Metropolitan Area Network
Personal Area Network
What are the two network models? And why are they layered?
OSI
TCP/IP
Abstraction, so we don’t need to know about the hardware.