CS/시스템소프트웨어

02. Bits, Bytes, and Integers

닉네임정하기쉽지않음 2022. 10. 25. 02:56

'Computer Systems: A Programmer's Perspective 3rd (Randal E. Bryant)'를 주교재로 한 시스템 소프트웨어 강의 수업자료를 복습하며 정리한 것


Encoding Byte Values

  • Byte = 8bits
    • Binary : 00000000 ~ 11111111
    • Decimal : 0 ~ 255
    • Hex : 00 ~ FF

 

Integers

  • 음수의 표현
    • Signed-magnitude
    • One's complement
    • Two's complement - MSB(Most Significant Bit) indicates sign (0 - nonnegative, 1 - negative)
  • Conversion
    • Two's Complement to Unsigned
      • 첫번째 bit가 Large negative weight 에서 Large positive weight가 됨
    • Casting(Expression Evaluation)
      • 한 expression에 unsigned와 signed가 함께 있다면, signed value가 암묵적으로 unsigned로 cast된다.

 

Representations in memory

  • Byte-Oriented Memory Organization
    • system provides private address spaces to each process
  • Machine Words
    • word size
    • Until recently, most machines used 32 bits(4 bytes) as word size(Limits address to 4GB(2^32 bytes)
    • Nowadays, machines have 64 bit word size(Potentially could have 18EB(exabytes) of addressable memory)
    • pointer type의 크기 == word size 크기
  • Byte Ordering
    • Big Endian: LSB(Least Significant Byte) has highest address
    • Little Endian: LSB has lowest address