Search code examples
binaryoperating-systemvirtual-address-space

Can't understand how virtual address was converted to binary form


This is a question and answer from my operating system's textbook:

Question:

A certain computer provides its users with a virtual-memory space of 232 bytes. 
The computer has 218 bytes of physical memory. The virtual memory is implemented by paging, 
and the page size is 4096 bytes. A user process generates the virtual address 11123456. 
Explain how the system establishes the corresponding physical location. 
Distinguish between software and hardware operations.

Answer:

The virtual address in binary form is
0001 0001 0001 0010 0011 0100 0101 0110

When I plug "11123456" into a decimal to binary converter (like here: https://www.rapidtables.com/convert/number/decimal-to-binary.html), this is the result: 101010011011101100000000

which differs from the book answer.

Also, when I manually convert using a method like here: https://indepth.dev/the-simple-math-behind-decimal-binary-conversion-algorithms/

I still get something different.

I'm just confused how that virtual address was converted into binary form......

Thanks!


Solution

  • You think

    11123456

    is a decimal number but it isn't. The Computer representation of number is ever binary, octal or hexadecimal. In this case is Hexadecimal. If you convert the above number from hexadecimal to binary form you obtain the result:

    0001 0001 0001 0010 0011 0100 0101 0110

    Explanation:

    Hexadecimal -> Binary
          1     ->   0001
          2     ->   0010
          3     ->   0011
          4     ->   0100
          5     ->   0101
          6     ->   0110
               ...