• retagged by
37,498 views
122 122 votes
Every host in an $\textsf{IPv4}$ network has a $1\text{-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 $\textsf{IPv4}$ address. Design a $50\text{-bit}$ globally unique ID for this purpose. After what period (in seconds) will the identifiers generated by a host wrap around?

16 Answers

Best answer
53 53 votes
Each host needs to generate $1000$ unique identifiers per second which requires $\left \lceil \lg 1000 \right \rceil= 10$ bits.

Now, these $10$ bits along with $32$ bit globally unique IP address will give a globally unique $42$ bit IDs which stays constant.

Since we are allowed $50$ bits we can use the next $8$ bits using the clock which changes every second. Thus our IDs will wrap around once in $2^{8}=256$ seconds.
1 flag:
✌ Low quality (Yash..M “gate official answer key is wrong , so this is also wrong , answer will be 262 sec”)
168 168 votes
Worst case scenario can be that all $2^{32}$ host are present on the network each generating $1000$ packets simultaneously in $1$ second.

So, total packet produced in $1$ second $= 2^{32}\times  2^{10}$ $ \text{(assuming 1024 = 1000)}= 2^{42}$

Now, we can distinguish $2^{50}$ packets, after that wrap around (so wrap around time will be when $2^{50}$ identifiers are used)

$2^{42}$ takes $1$ second,

$2^{50}$ will take $=\dfrac{2^{50}}{2^{42}}=2^8=256\text{ seconds.}$
• edited by
1 flag:
✌ Low quality (leo_t “answer wrong 262 seconds”)
55 55 votes

STEP 1:
IPv4 has size of 32 bits. so total hosts possible with 2^32
Each host can produce 1000 unique Ids(sequence numbers) per seconds
Therefore, total unique sequence number that can be produced in 1 second = (2^32)*1000
and 1 sequence number can be produced in = 1/((2^32)*1000) seconds.

STEP 2: 
Design a 50-bit globally unique ID means that total possible unique sequence number can be produced using 50-bits.Therefore total unique sequence numbers that can generate using 50-bits  =  2^50

CONCLUSION: 
From step 1 and step 2  we conclude that total 2^50 sequence numbers an be generated in (2^50)/((2^32)*1000) seconds = 262.14seconds = 262 seconds

ANSWER :
Wrap around time = 262 seconds

• edited by
38 38 votes
in question given that
Identification No. (unique ID) field is 50 bit long..
.
We can make 50 bit Unique ID No. in combination with 32-bit source IP Address and 18-bit no.
.
50-bit unique Id no. = Concat(32-Bit source IP, 18-bit no.)
.
Now we need to generate only 18-bit no. at each host.
.
1000 No. are generated per sec.
.
so 2^18 numbers are generated in (2^18/1000)sec
(after that ID no. will repeat   at that host)
=2^8 (1000 approximately equal to 2^10)
19 19 votes
this is very strange that answer given is 256..ideally it should be 262 as 2^50/(2^32x1000)...for some reason they have considered 1000 as 2^10...don't why?
17 17 votes

Answer: 256 seconds.

Let's get the gist of the question first, breaking it down bit by bit.

Every host in an IPV4 network has a 1−second resolution real-time clock with battery backup.

 It tells that hosts have a cycle of 1 sec each and the "battery backup" part is given that so that it is assumed that there is no concept of the clock going off before the sequences wrap. (Quite irrelevant actually!)

Each host needs to generate up to 1000 unique identifiers per second.

 This pertains to the unique ID field of the IPv4 packet which is used to identify a packet over the whole global internet. 

So, this means that a host on the internet has the capability of creating 1000 such nos. and due to that each host over the internet has the capability of sending a max of 1000 packets per second.

Design a 50−bit globally unique ID for this purpose.

Now, these nos. need be designed in such a way that they are unique throughout the world, i.e. there may be chances that all the hosts over the internet are sending out packets simultaneously and it may create confusion if all are not working in tandem with each other.

And it's assumed that this ID being generated ( by all the hosts simultaneously, in the worst case) is 50 bit long.

So, they are asking that is such a scenario where all hosts work together, how long will it take for them to consume all the nos. and wrap around back to 0.

 

Now, the calculation part.

Total hosts present globally in IPv4 = $2^{32}$

In 1 sec, each host generates = 1000 IDs

In 1 sec, $2^{32}$ host genetate  = $2^{32} \times 1000$

                                                    = $2^{32} \times 2^{10}$  (approximating 1000 as 1024 to make calculations easy)

                                                    = $2^{42}$

 

Nos. of possible IDs with 50 bits= $2^{50}$

 

Time to generate 1 ID = $\frac{1}{2^{42}}$ sec

Time to generate $2^{50}$ IDs = $\frac{2^{50}}{2^{42}}$

                                                 = 256 Seconds.

 

 

• edited by
Answer:
Position:
Show:

Related questions

9 9 votes
5 answers 5 answers
8.9k
8.9k views
go_editor asked Sep 28, 2014
8,889 views
In the context of modular software design, which one of the following combinations is desirable?High cohesion and high couplingHigh cohesion and low couplingLow cohesion ...
73 73 votes
7 answers 7 answers
27.6k
27.6k views
go_editor asked Sep 28, 2014
27,596 views
An IP router implementing Classless Inter-domain Routing (CIDR) receives a packet with address $131.23.151.76$. The router's routing table has the following entries:$$\be...
67 67 votes
9 answers 9 answers
39.9k
39.9k views
gatecse asked Feb 14, 2018
39,886 views
Consider a long-lived $\text{TCP}$ session with an end-to-end bandwidth of $1\; \text{Gbps}\; (=10^9$ bits-per-second$).$ The session starts with a sequence number of $12...
66 66 votes
12 answers 12 answers
33.8k
33.8k views
go_editor asked Sep 28, 2014
33,803 views
An $IP$ router with a $\text{Maximum Transmission Unit (MTU)}$ of $1500$ bytes has received an $IP$ packet of size $4404\text{ bytes}$ with an $IP$ header of length $20\t...