Tuesday, February 7, 2012

Counter Overflow.

You have a 64bit interger counter set to 0. How long it will take to overflow the counter given that you are incrementing it at 4Ghz speed.


Ans:
4gig ~= 2^32, assuming each instruction sent to cpu increments the counter by 1, it will take 2^64/2^32, ie..2^32 seconds (136 years) to increment it.

No comments:

Post a Comment