23. file_format: mystnb kernelspec: name: python3#

24. How do different types of storage work together?#

24.1. Why do we need to know about this?#

  • computers are not magic and edge cases help you see that

  • in case you want to do high performance programming

  • it’s good practice with abstraction

24.2. Hardware vs Software abstraction#

Abstraction is to remove details and use higher level units

abstraction layers

in hardware our abstractions are less leaky becuase it is less forgiving.

software abstractions can suffer from leaks; think git- it’s hard to learn because the abstraction is leaky.

a lot of programming is designing abstractions, to get good at making something, you study examples first- good and bad- to learn what to do, and not to do.

leaky abstractions

  • the above is a blog post by one of the co-founders and the 2010-2019 CEO of Stack Overflow Joel Spolsky

24.3. How to store a value#

We need a few more components:

  • mux select one of two values

  • flip-flop hold a value until told otherwise

register

this gives us SRAM which can hold a value as long as the system has power (1963)

24.4. another way to physically store a value#

DRAM uses one transistor and one capacitor. (SRAM uses 4-6 transistors)

a capacitor holds a charge for a time, but gradually fades, so it has to be refreshed

ROM is a diode matrix traditionally

  • hardward encodes the instructions

  • cannot be changed without rewiring

PROM

  • can be reprogrammed once after device is made

  • used for firmware/microcode

EPROM or EEPROM

  • treated like ROM

  • can be erased & reprogrammed

  • but not infinitely, very limited number of tmes

  • holds value when power goes away, UV light or electriciy can re-program

SRAM:

  • is volatile; it needs power to hold a value

  • is fast

  • takes up more space on the chip (uses 4-6 transistors per bit)

  • typically used of cache and internal registers

DRAM:

  • is volatile; it needs power to hold a value

  • is slower and requires a refresh

  • is small (1 transistor + 1 capacitor per bit) and space efficient

  • used for the main RAM

Flash memory

  • non-volatile; holds a value without power, can be electircally erased and re-programmed

  • comprised of memory “cells” in layerd boards

  • memory cells are mosfets - a different type of transistor that retains a state after power is removed and put bag

  • implemented with EEPROM

  • designed for large blocks and limited writes (~10k)

  • used for ssd, usb flash drives, smartphones, etc

  • slow to write, fast to read

24.5. Prepare for Next Class#

Preview the Stack Overflow Developer Survey Technology section parts that are about tools. Create dev_insights.md with 3-5 bullet points for discussion. These can be facts you found most interesting or questions you have based on the results (it can be clarifying or deeper questions)

24.6. Badges#

this is integrative-2

  1. Add conclusion.md to your KWL repo. In the file include 2 sections: (1) summary with an overall description of what you learned and how this course was/not helpful to you (paragraph or bullet form is fine) (2) key points with the top 10 thigns you want to make sure you remember from this class

  2. Reflect on how this course impacts programming/debugging skills in skillup.md. You can write this as how you think your own skill has improved or as if you are convincing another student to take this class. Touch on at least three topics.

this is integrative-2

  1. Create in_five_years.md and answer the following two questions: What do you think you will remember from this class in five years? What parts of this course’s content do you think will change the most in five years?

  2. Reflect on how this course impacts programming/debugging skills in skillup.md. You can write this as how you think your own skill has improved or as if you are convincing another student to take this class. Touch on at least three topics.

  3. Submit a PR with either advice to future students on how to succeed in the course or on why a student should take this course. Each of those is linked to where you should add your advice.

24.7. Experience Report Evidence#

24.8. Questions After Today’s Class#

24.8.1. What makes magnetic disk storage like HDDs more cost efficient than NAND flash storage like SSDs?#

it is cheaper to manufacture

24.8.2. Do different types of connections significantly impact data speeds?#

the bandwidth can for certain. More on this is a good explore

24.8.3. Can the fact that data is not erased just the pointer to the file name is removed impact performance?#

In electromechanical disks it is called fragmentation and requires fixing.

For SSDs, however that is actually better the nonconsecutive and defragmentation is not worth it, because it is additional wear on the drive.

24.8.4. What sort of storage is best for very long storage?#

Tape drives or even CDs can be good. This type of storate is called cold storage. Learning more about cold storage is a good explore.

24.8.5. How does memory differ from when there were disks and cds to now with the internet?#

RAM is unimpacted by that, but we need less removable storage because we can transfer information over the internet.

24.8.6. What makes caches faster than long term memory? One aspect is because it’s closer to the CPU, but is there a different way they store data?#

cache is implemented with the faster SRAM generally instead of DRAM.

24.8.7. When a file is updated how are the edits stored back on disk? Is the entire file contents rewritten to the disk or is only the edited part updated?#

Could be either depending on needs and the type of writing.

24.8.8. why is RAM much more expensive than storage.#

More expensive materials and manufacturing process.

24.8.9. Why are there so many different types of memory? Cant technically only one of them be used for everything?#

They all have various tradeoffs. Some are faster, but expensive or maybe space consuming, others might be slow but space effective.

24.8.10. What are the different types of RAM and what does RAM do?#

RAM is the main memory that holds values you are computing with.

the different types are contrasted above.

24.8.11. Is it very expensive for companies to invest in these data storage units?#

Building from scratch? yes. Getting a small share? no.