remzi-arpacidusseau / ostep-homework

1.99k stars 959 forks source link

Chapter 44 ssd simulator - is it doing correct erase counts for direct mapping? #17

Open kasliwalr opened 3 years ago

kasliwalr commented 3 years ago

I am not clear about direct mapping... Based on the simulator output for the following run, it seems writing twice to the same block but on different pages invokes two block erases.

> ./ssd.py -T direct -s 2 -n 10 -C -S -F

ARG seed 2
ARG num_cmds 10
ARG op_percentages 40/50/10
ARG skew 
ARG skew_start 0
ARG read_fail 0
ARG cmd_list 
ARG ssd_type direct
ARG num_logical_pages 80
ARG num_blocks 12
ARG pages_per_block 10
ARG high_water_mark 10
ARG low_water_mark 8
ARG erase_time 1000
ARG program_time 40
ARG read_time 10
ARG show_gc False
ARG show_state False
ARG show_cmds True
ARG quiz_cmds False
ARG show_stats True
ARG compute False

FTL   (empty)
Block 0          1          2          3          4          5          6          7          8          9          10         11         
Page  0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 1111111111 1111111111 
      0000000000 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999 0000000000 1111111111 
      0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 
State iiiiiiiiii iiiiiiiiii iiiiiiiiii iiiiiiiiii iiiiiiiiii iiiiiiiiii iiiiiiiiii iiiiiiiiii iiiiiiiiii iiiiiiiiii iiiiiiiiii iiiiiiiiii 
Data                                                                                                                                      
Live                                                                                                                                      

cmd   0:: write(58, F) -> success
cmd   1:: write(46, 9) -> success
cmd   2:: write(31, I) -> success
cmd   3:: trim(31) -> success
cmd   4:: write(35, g) -> success
cmd   5:: read(46) -> 9
cmd   6:: read(35) -> g
cmd   7:: write(44, e) -> success
cmd   8:: read(58) -> F
cmd   9:: write(79, F) -> success

FTL    35: 35  44: 44  46: 46  58: 58  79: 79 
Block 0          1          2          3          4          5          6          7          8          9          10         11         
Page  0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 1111111111 1111111111 
      0000000000 1111111111 2222222222 3333333333 4444444444 5555555555 6666666666 7777777777 8888888888 9999999999 0000000000 1111111111 
      0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 
State iiiiiiiiii iiiiiiiiii iiiiiiiiii EvEEEvEEEE EEEEvEvEEE EEEEEEEEvE iiiiiiiiii EEEEEEEEEv iiiiiiiiii iiiiiiiiii iiiiiiiiii iiiiiiiiii 
Data                                    I   g         e 9            F                      F                                             
Live                                        +         + +            +                      +                                             

Physical Operations Per Block
Erases   0          0          0          2          2          1          0          1          0          0          0          0          Sum: 6
Writes   0          0          0          3          3          1          0          1          0          0          0          0          Sum: 8
Reads    0          0          0          2          2          1          0          0          0          0          0          0          Sum: 5

Logical Operation Sums
  Write count 6 (0 failed)
  Read count  3 (0 failed)
  Trim count  1 (0 failed)

Times
  Erase time 6000.00
  Write time 320.00
  Read time  50.00
  Total time 6370.00

In the above, w46:9, w44:e, should only require one erase, as page 44 is already erased (after w46:9) and therefore writeable without an erase