[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Jiffies
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, 16 May 2003 10:45:12 +0200
"Joeri Belis" <joeri.belis@nollekens.be> wrote:
>I looked at our timer and it is at : 1577504985
>
>And if i understand correctly, this is a 32bit value and it can go
>to: 4294967295. What will happen when we hit this limit?
As you correctly said, jiffies is defined as unsigned long (which is a
32 bit value on x86 platforms) and it is incremented by one by
do_timer() function every tick. In particular, you have HZ ticks per
second with HZ = 100 on Intel x86 - kernel 2.4.x. This means you can
experience a jiffy overflow. Kernel code is aware of this situation
and so it handles it properly. If you write a device driver, probably
sometimes you could be forced to do some checks even if it's rarely
adopted. F.e. if you are measuring time intervals you could just
think about a solution in which you evaluate the sign of
delta = time_2 - time_1
If it is lesser than 0, jiffies has wrapped around and so in this case
you can avoid problems doing this
delta = (MAX_JIFFIES_VALUE - time_1) + time_2
thus obtaining something similar
[..]
delta = time_2 - time_1;
if (delta < 0)
delta += MAX_JIFFIES_VALUE;
[..]
Regards.
- --
Angelo Dell'Aera 'buffer'
Antifork Research, Inc. http://buffer.antifork.org
PGP information in e-mail header
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+xQ2gpONIzxnBXKIRAoHlAJ98TWYuTB1p12PhZVDZKaeJnrjJ4ACfUEMa
5Un8zC71YOrjNinaxRlnXTo=
=IZQA
-----END PGP SIGNATURE-----
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
- References:
- Jiffies
- From: "Joeri Belis" <joeri.belis@nollekens.be>