9+10 Flashcards

1
Q

How do we pass more parameters than we have registers in assembly?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do high level languages return values?

A

Store in a global variable, store on the stack, or store in a register.

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

What is the preamble and postamble?

A

Preamble, saves registers we are going to use and loads top of stack for indirect addressing.
Postamble: Restores registers to their original state.

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

What is self modifying code?

A

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.

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

Why might we want to manipulate the PC at runtime?

A

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.

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

What is a floppy disk? What are some problems?

A

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.

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

What is multiple zone recording?

A

Disk divided into zones, tracks in different zones have a different number of sectors, The number of sectors in a particular zone is constant.

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

What are FM and MFM? Why do they exist?

A
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is hard and soft sectoring? How do we tell how far in or out we are?

A

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.

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

What is are seek time, rotational latency, access time and block transfer time?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How can we store multiple files per disk?

A

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).

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

What are the characteristics of moving media?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do CD-ROMs work?

A

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.

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

What is locality of reference?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can cache be used?

A

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.

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

What is the cache write policy?

A

Write-Back: CPU writes go to cache, cache then writes to main memory (Can lead to dirty data in cache, is complex and expensive).
Write-through: CPU writes go to main memory and cache.

17
Q

What are the cache eviction policies?

A

least recently used, first in first out, least frequently used.

18
Q

How do we calculate the effective access time?

A

((#hits)(time per hit) + (#misses)(time per miss))/Total number of memory access.