Drive Usage and Capacity Calculation
Problem Description
Luke has just bought 7 disk drives and grouped them together into a single logical drive so he could back up all funny cat pictures from the internet. Luke's drive usage can be described as a sustained workload of 200,000 write operations per second with the following distribution:
- 512 bytes – 20% of all operations
- 1024 bytes – 30% of all operations
- 4096 bytes – 40% of all operations
- 16384 bytes – 10% of all operations
Each write operation appends sequentially to an individual drive, and the load is evenly distributed among all drives. There is no compression, garbage collection, or redundancy elimination involved. Assuming each drive has a capacity of exactly 513 GiB (1 GiB = 1024 MiB, 1 MiB = 1024 KiB, 1 KiB = 1024 bytes), how soon will Luke's array be filled from completely empty to 86%?
Solution
Average write size:
= 0.2 * 512 + 0.3 * 1024 + 0.4 * 4096 + 0.1 * 16384
= 102.4 + 307.2 + 1638.4 + 1638.4
= 3686.4 bytes per write
Total write throughput:
200,000 writes/sec * 3686.4 bytes/write = 737,280,000 bytes/sec
= 703.125 MiB/sec
Total capacity of 7 drives:
= 7 * 513 GiB = 3591 GiB
= 3591 * 1024 = 3,676,224 MiB
86% of capacity:
= 0.86 * 3,676,224 = 3,160,548.64 MiB
Time to fill:
= 3,160,548.64 MiB / 703.125 MiB/sec ≈ 4495.6 seconds
≈ 74.9 minutes
Answer: 75 minutes
Minimal Bytes to Store Page Metadata
Problem Description
Suppose you want to store the following properties per each memory page:
- Page status – one of:
In use, Dirty, Free → 3 states → needs 2 bits - Page index – an integer in range [0 .. 364847] → requires ceil(log2(364848)) = 19 bits
- Access mode – one of:
Read-only, Write-only, Execute-only, Can read and write, Can read and execute, Can read, write and execute
→ 6 states → needs 3 bits - Process ID – an integer in range [0 .. 37337] → requires ceil(log2(37338)) = 16 bits
Solution
Total bits needed = 2 (status) + 19 (index) + 3 (access) + 16 (PID) = 40 bits
Convert to bytes:
40 bits / 8 = 5 bytes
Answer: 5 bytes per record
我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。
We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.
