In [6]: for x in xrange(1, 65):
...: print "power(2, {0})".format(x) , pow(2, x)
...:
power(2, 1) 2
power(2, 2) 4
power(2, 3) 8
power(2, 4) 16
power(2, 5) 32
power(2, 6) 64
power(2, 7) 128
power(2, 8) 256
power(2, 9) 512
power(2, 10) 1024
power(2, 11) 2048
power(2, 12) 4096
power(2, 13) 8192
power(2, 14) 16384
power(2, 15) 32768
power(2, 16) 65536
power(2, 17) 131072
power(2, 18) 262144
power(2, 19) 524288
power(2, 20) 1048576
power(2, 21) 2097152
power(2, 22) 4194304
power(2, 23) 8388608
power(2, 24) 16777216
power(2, 25) 33554432
power(2, 26) 67108864
power(2, 27) 134217728
power(2, 28) 268435456
power(2, 29) 536870912
power(2, 30) 1073741824
power(2, 31) 2147483648
power(2, 32) 4294967296
power(2, 33) 8589934592
power(2, 34) 17179869184
power(2, 35) 34359738368
power(2, 36) 68719476736
power(2, 37) 137438953472
power(2, 38) 274877906944
power(2, 39) 549755813888
power(2, 40) 1099511627776
power(2, 41) 2199023255552
power(2, 42) 4398046511104
power(2, 43) 8796093022208
power(2, 44) 17592186044416
power(2, 45) 35184372088832
power(2, 46) 70368744177664
power(2, 47) 140737488355328
power(2, 48) 281474976710656
power(2, 49) 562949953421312
power(2, 50) 1125899906842624
power(2, 51) 2251799813685248
power(2, 52) 4503599627370496
power(2, 53) 9007199254740992
power(2, 54) 18014398509481984
power(2, 55) 36028797018963968
power(2, 56) 72057594037927936
power(2, 57) 144115188075855872
power(2, 58) 288230376151711744
power(2, 59) 576460752303423488
power(2, 60) 1152921504606846976
power(2, 61) 2305843009213693952
power(2, 62) 4611686018427387904
power(2, 63) 9223372036854775808
power(2, 64) 18446744073709551616
In [7]: # 4294967296 max mem
In [8]: 4294967296 / 8
Out[8]: 536870912
In [9]: 4294967296 / 8 /1024 /1024 # MB
Out[9]: 512
In [10]: 4294967296 /1024 /1024 # MB
Out[10]: 4096
In [11]: 4294967296 /1024 /1024 / 1024 # GB
Out[11]: 4
In [12]: # so 32bit computer supput 4GB mem
In [13]: 18446744073709551616 / pow(1024, 3) # GB
Out[13]: 17179869184L
In [14]: 18446744073709551616 / 1024/ 1024/ 1024 # GB
Out[14]: 17179869184L
In [15]: 64 / 1
Out[15]: 64
In [16]: print("1"*64)
1111111111111111111111111111111111111111111111111111111111111111
In [17]: int("1"*64, 2)
Out[17]: 18446744073709551615L
In [18]: # 18446744073709551616
In [19]: # 18446744073709551615L
In [20]: # so 64bit cpu 是近几年不会增大位数的CPU
In [21]: # 内存通道问题
In [22]: # 多物理CPU, 4颗CPU 256G内存如何分配,通过主机的通道来分配
In [23]: 256 / 4 # 每通道配置内存最合适
Out[23]: 64
乱想数学
最新推荐文章于 2021-10-29 20:59:17 发布