---
# System prepended metadata

title: Storage-Device Hierarchy

---

# Storage-Device Hierarchy
Factors: Speed, Cost, Volatility(揮發性)

---
## Main Memory
the only large storage media that the **CPU can access directly**

### RAM: Random Access Memory
#### DRAM(Dynamic)
- Need only one transistor(電晶體)
- Comsume less power
- values must be periodically refreshed
- slower access speed

#### SRAM(Static)
- Need six transistor
- Consume more power
- quicker access speed
- **usage: cache memory**

差異來源：製程技術的不同

---
## Secondary Memory
- CPU cannot access directly
- Extension of main memory
- Provides **large non-volatile storage**

### Disk Mechanism
- Speed of magnetic disk
    - Transfer time = data size / transfer rate
    - Positioning time (random access time)
        - seek time (cylinder) + rotational latency (sector)

### Caching

#### Mechanism
- Information in use copied from slower to faster storage temporarily
- Cache will be checked first to determine if information is there
    - If it is, then used data directly from cache(fast)
    - If not, then data is copied to cache and used there

- Scenario without caching: Big data

#### Coherency and Consistency Issue
- The same data may appear in different levels. They should be consistent
- Single task accessing: Not a problem, always use the Highest level copy
- Multi-task accessing: Obtain the most recent value
- Distributed system: Difficult because copies are on different computers