Question

Every host in an IPv4 network has a 1-second resolution real-time clock with battery backup. Each host needs to generate up to 1000 unique identifiers per second. Assume that each host has a globally unique IPv4 address. Design a 50-bit globally unique ID for this purpose. After what period (in seconds) will the identifiers generated by a host wrap around?

Official answer and solution
Official answer
256
From
Official GATE 2014 answer key

Solution

Allocate the 50 bits among the host identifier, within-second counter, and timestamp to determine the wrap-around time.

  1. Components of the 50-bit Globally Unique ID:

    • Every host has a globally unique IPv4 address, which occupies 3232 bits.
    • Remaining bits for host-local identification: 50−32=1850 - 32 = 18 bits.
  2. Bit Allocation for Unique IDs per Second:

    • Each host generates up to 10001000 unique identifiers per second.
    • To represent 10001000 distinct counter values within a single second, the required number of bits is:
      ⌈log⁡21000⌉=10 bits(210=1024≥1000).\lceil \log_2 1000 \rceil = 10\text{ bits}\quad (2^{10} = 1024 \ge 1000).
  3. Remaining Bits for the Seconds Timestamp:

    • Bits remaining for the 1-second resolution clock counter:
      18−10=8 bits.18 - 10 = 8\text{ bits}.
  4. Wrap-around Period:

    • An 8-bit timestamp counter can count 28=2562^8 = 256 distinct seconds before wrapping back to zero.
    • Therefore, the identifiers generated by a host will wrap around after 256 seconds.
Final answer

256

Common trap

Allocating 18 bits entirely to the timestamp without reserving 10 bits for distinguishing 1000 IDs per second.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2014 Computer Science and Information Technology (CS) Session 3
Question
37 of 65, printed as CS Q.27
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.