9+10 Flashcards
How do we pass more parameters than we have registers in assembly?
Use calling-convention:
1. Push parameters onto stack(typically in reverse order)
2. Call the subroutine
3. Subroutine does processing and returns
4. stack is returned to previous state.
This is done using indexed addressing.
How do high level languages return values?
Store in a global variable, store on the stack, or store in a register.
What is the preamble and postamble?
Preamble, saves registers we are going to use and loads top of stack for indirect addressing.
Postamble: Restores registers to their original state.
What is self modifying code?
If we have 2 or more routines that do nearly the same thing then we can code it once and then write a program that changes the program, this is known as self modifying code.
Why might we want to manipulate the PC at runtime?
Can be done by using RTS. Can be used to change return address inside subroutine call. Useful if we want to return to a different address to call address. This technique can also be used to pass parameters inline.
What is a floppy disk? What are some problems?
A floppy disk involves joining two ends of magnetic tape to form a circle. The head then passes this at a tangent.
Data further from the center passes under the head quicker, meaning we need to slow the motor as the head moves outwards.
What is multiple zone recording?
Disk divided into zones, tracks in different zones have a different number of sectors, The number of sectors in a particular zone is constant.
What are FM and MFM? Why do they exist?
Frequency modulation(FM) involves always encoding a clock pulse then the bit, a second pulse for 1, no pulse for 0. Modified frequency modulation: Store a 1 as no pulse then pulse. To store a 0 we do a pulse then no pulse if last bit was 0 or if last bit was 1 we do no pulse no pulse. We need these in order to be able to detect a sequence of multiple ones and zeroes, as otherwise no current would be induced in the magnetic disk.
What is hard and soft sectoring? How do we tell how far in or out we are?
To tell where we are on the disk we can use hard sectoring(bunch of holes at start of disk which can be used to tell which sector we are in), or soft sectoring(one hole on disk, can tell how big one rotation of the disk is by going the whole way round).
To tell how far in or out we are we fully retract the head to track 0, and then just keep track of where we are using stepper motor.
What is are seek time, rotational latency, access time and block transfer time?
Seek time: The average time for the head to move from one track to another.
Rotational latency: Time for the disk to do one full revolution.
Access time:
Worst case: Seek time + rotation
Block transfer time: How much data can move from the disk to the computer per second.
How can we store multiple files per disk?
divide disk into tracks(concentric rings, known as cylinders if multiple platters). Sectors are wedges in these tracks. Files are chains of sectors(don’t have to be sequential).
What are the characteristics of moving media?
Number of platters, single sided or two sided, number of cylinders per disk, number of sectors per track and number of bytes per sector.
How do CD-ROMs work?
Plastic resin disk, with reflective surface with pits. 1 is transition between pit and no pit, 0 is no transition. A CD-ROM has a single spiral track, with consistent density throughout surface.
What is locality of reference?
This refers to how programs tend to not jump around memory, but rather keep in a small area which moves over time, a good solution is to store this small area in the high speed memory temporarily.
How can cache be used?
Look through cache: If the addressed location is in cache use, else transfer block of memory to cache(can have stale data)
look aside cache: Main memory and cache see memory operation, cache terminates early if found(can have stale data)
Fully associative: Main memory divided into lines of bytes, Each be stored anywhere in Cache RAM, Tag RAM stores where memory lines are.
Direct Map Cache: Main memory divided into pages (of cache RAM size). All line-0 are cached in same cache RAM. Tag RAM stores which memory pages are where.
Set Associative cache: Direct map to a set, then associate within that set, Tag Ram stores what is where.