Secondary Storage Devices:
Secondary ---- We will store data on some device which is not primary storage.
-Why we need it.
Primary Storage: Capacity is less, Very Expensive
Terminologies:
1. Capacity of data.
2. Access Time: The required to read or write data on the secondary storage.
3. Material / Casing
4. Functionality
5. Read / Write
a. Sequential Access
i. If you have a cassette to play song, and you want to play song
no. 5 ? you have to go through song 1, 2, 3, 4, and then 5
ii. Access time of each data depends upon its location on the
driver.
1. If you want to access song no1 it will take 1 second, but
songs no 5 will take 5 seconds.
b. Direct Access
i. Approximately equal time is required to read/write on any
location.
1. For example, if you want to play any songs from 1 to 5,
you will have approximately equal to access any song.
i.e. if song no. 1 is accessed in 1 second , song no 5 will
also be accessed in 1 second
It goes from primary storage to secondary , RAM -- > Hard Drive, what is the
rate of transfer , Transfer rate = MB/ Second
We bits, bytes, kilo byes, mega bytes, giga bytes, tera bytes, exabytes
Petabytes to measure the size of the storage device.
Understanding **bits**, **bytes**, and the larger units like **kilobytes**,
**megabytes**, and so on can be made simple by thinking about them in terms
of data storage and digital information.
Yes
No
Yes = 1
No = 0
Data – Encode ---
A=0
B=1
In one bit you can store only two types of data.
Yes = 1
No = 0
,
Coding Scheme:
Get up = 1
Sit down = 0
English Langauge:
26 Alphabets
A=0
B=1
1. **Bits (b)**
- What is a bit?
A bit is the **smallest unit of data** in a computer.
- It can have only two possible values: **0 or 1** (binary system).
We use bits in the group of 8.
### 2. **Bytes (B)**
What is a byte?
A byte is a group of **8 bits**.
- Example: `1010 1100` is one byte (8 bits together).
A = 0100 0001
B = 0100 0010
Data encode into bytes.
- **Why bytes?**
Computers group bits into bytes because a byte can represent **more complex
data**, like a letter, number, or symbol.
- Example: The letter **"A"** is represented as `0100 0001` in binary (1 byte).
Code of 9 = 0011 1001
Text file
Multan to Lahore , distance = Unit ?
How to measure that ?
1024 bytes = Kilo bytes
3. **Kilobytes (KB)**
- **1 kilobyte (KB) = 1,024 bytes** (technically, though often rounded to
1,000 bytes in general use).
- Imagine a small text file containing about 1,000 characters (letters, numbers,
symbols)—that’s roughly 1 KB.
---
### 4. **Megabytes (MB)**
- **1 megabyte (MB) = 1,024 KB = 1,048,576 bytes** (often rounded to 1
million bytes in casual terms).
- Examples:
- A small photo might take up 2 MB of storage.
- An MP3 song might be 4–5 MB.
---
### 5. **Gigabytes (GB)**
- **1 gigabyte (GB) = 1,024 MB = 1,073,741,824 bytes**.
- Examples:
- A movie in standard quality might be 1–2 GB.
- A smartphone may have 128 GB of storage.
---
### 6. **Terabytes (TB)**
- **1 terabyte (TB) = 1,024 GB = 1,099,511,627,776 bytes**.
- Examples:
- External hard drives are often 1–4 TB.
- A data center may have petabytes or terabytes of data.
---
### Units Beyond Terabytes:
| **Unit** | **Equivalent** | **Example**
|
|-------------------|-------------------------------------|------------------------------------------------
-|
| **Petabyte (PB)** | 1,024 TB | Google handles several petabytes
of data daily. |
| **Exabyte (EB)** | 1,024 PB | Global internet traffic is measured
in exabytes.|
| **Zettabyte (ZB)**| 1,024 EB | Data generated worldwide
annually. |
| **Yottabyte (YB)**| 1,024 ZB | Rarely used; beyond modern
practical needs. |
---
### Quick Real-Life Analogy:
- **1 bit** = A single "yes" or "no" (binary choice).
- **1 byte** = A single letter in a word.
- **1 KB** = A short paragraph.
- **1 MB** = A book.
- **1 GB** = A small library of books.
- **1 TB** = Thousands of libraries of books.
---
### Why Do Computers Use 1,024 Instead of 1,000?
Computers work in **binary (base 2)**, and powers of 2 naturally align with
multiples of 1,024:
- \( 2^{10} = 1,024 \).
This is why kilobytes, megabytes, and others are based on 1,024 rather than
1,000.
---
When dealing with storage devices like **magnetic tapes** and **hard disk
drives (HDDs)**, the performance of data retrieval is measured using terms like
**seek time**, **access time**, and **latency time**. Let’s break them down
clearly:
---
### **1. Seek Time**
- **What is it?**
- Seek time is the time taken to position the read/write head of a storage device
over the correct track or position where the required data is stored.
- **For Magnetic Tape**:
- Magnetic tape stores data sequentially, so seek time involves physically moving
the tape forward or backward to the right position.
- **Example**: If the data is near the end of the tape, the seek time can be long
since the tape must rewind or fast-forward.
- **For Hard Disk Drive**:
- The read/write head must move across the spinning platters to the correct
track.
- Seek time is much shorter in HDDs compared to tapes because of faster
mechanical movement.
---
### **2. Latency Time (Rotational Latency)**
- **What is it?**
- Latency time refers to the time the device waits for the spinning disk or moving
tape to position the data under the read/write head.
- **For Magnetic Tape**:
- Latency is tied to how fast the tape moves and when the required data passes
under the read/write head.
- It can be significant because tapes are slower compared to hard disks.
- **For Hard Disk Drive**:
- Latency depends on the **rotational speed** of the disk (measured in
revolutions per minute or RPM).
- For example, in a 7,200 RPM HDD, the average latency is around 4.16
milliseconds (1 full rotation = 8.33 ms; average latency is half a rotation).
---
### **3. Access Time**
- **What is it?**
- Access time is the total time it takes to retrieve data from a storage device.
- It is the **sum of seek time, latency time, and the time to transfer data** once
the read/write head is in position.
- **For Magnetic Tape**:
- Access time is longer due to the sequential nature of data storage. Both seek
time (moving the tape) and latency (waiting for the correct data position) can be
significant.
- **For Hard Disk Drive**:
- Access time is shorter than for tapes, as HDDs allow random access. Once seek
time and latency are complete, data transfer begins almost immediately.
---
### **Comparison of Magnetic Tape vs. Hard Disk Drive**
| **Factor** | **Magnetic Tape** | **Hard Disk Drive**
|
|---------------------|---------------------------------------------|--------------------------------------
-------|
| **Seek Time** | Very long (data is stored sequentially). | Much shorter
(random access mechanism). |
| **Latency Time** | Depends on tape speed and data position. | Relatively
short (depends on RPM). |
| **Access Time** | Very long due to sequential access nature. | Short due to
faster seek and rotational speed. |
---
### **Summary in Practical Terms**
- **Magnetic Tape**:
Best for archival purposes because it’s cheap but slow. Retrieving a specific file
can take a long time since the tape must physically wind to the correct spot.
- **Hard Disk Drive**:
Better for frequent data access since it allows **random access**, meaning it
can quickly jump to different parts of the disk to read or write data.
---
Magnetic Tape:
1. Capacity of data.
2. Access Time: The required to read or write data on the secondary storage.
3. Material / Casing
4. Functionality
5. Read / Write
a. Sequential Access