728x90
2.1 Information Storage
- Rather than accessing individual bits in memory, most computers use blocks of 8 bits, or bytes, as the smallest addressable unit of memory.
- The actual implementation (presented in Chapter 9) uses a combination of dynamic random access memory (DRAM), flash memory, disk storage, special hardware, and operating system software to provide the program with what appears to be a monolithic byte array.
2.1.1 Hexadecimal Notaion
- if the total number of bits is not a multiple of 4, you should make the leftmost group be the one with fewer than 4 bits, effectively padding the number with leading zeros.
2.1.2 Data size
2.1.3 Addressing and Byte Ordering
- Most Intel-compatible machines operate exclusively in little-endian mode. On the other hand, most machines from IBM and Oracle (arising from their acquisition of Sun Microsystems in 2010) operate in big-endian mode.
- A common problem is for data produced by a little-endian machine to be sent to a big-endian machine, or vice versa, leading to the bytes within the words being in reverse order for the receiving program.
- To avoid such problems, code written for networking applications must follow established conventions for byte ordering to make sure the sending machine converts its internal representation to the network standard, while the receiving machine converts the network standard to its internal representation.
- A second case where byte ordering becomes important is when looking at the byte sequences representing integer data.
- A third case where byte ordering becomes visible is when programs are written that circumvent the normal type system.
728x90
'csapp' 카테고리의 다른 글
2.1.7 Bit-Level Operations in C (0) | 2023.03.31 |
---|---|
2.1.3 Addressing and byte Ordering (0) | 2023.03.30 |
1.9.2 Concurrency and Parallelism (0) | 2023.03.28 |
1.5 Caches Matter (0) | 2023.03.27 |
CHAPTER 1 : A Tour of Computer Systems (0) | 2023.03.26 |
댓글