User space / Kernel space HZ difference?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I read this thread :
http://article.gmane.org/gmane.linux.kernel.kernelnewbies/31239 and
have a question about it that I hope somebody will answer :)

1) What exactly does it mean to say that "User space sees value x for
HZ?" I mean, for kernel space, I can understand that if I do things
like nanosleep() etc then the resolution with which I can sleep is
determined by the value of HZ inside the kernel. (or so I think). But
what does the value of HZ in user space mean?

2) I tried the following program at the end of the above message I get
the following values :

#include <unistd.h>
#include <time.h>
#include <stdio.h>

int main()
{
	struct timespec res;
	double resolution;

	printf("UserHZ   %ld\n", sysconf(_SC_CLK_TCK));

	clock_getres(CLOCK_REALTIME, &res);
	resolution = res.tv_sec + (((double)res.tv_nsec)/1.0e9);

	printf("SystemHZ %ld\n", (unsigned long)(1/resolution + 0.5));
	return 0;
}

I get the values:

UserHZ 100
SystemHZ 1000000000

This looks a bit too high to me?
(My kernel version is 2.6.27/fedora core 10 , /usr/include/asm/param.h
says that HZ is 100 )



Thanks a lot in advance :)


----------------------------------------------------------------------------------------------------------------------------------------
Primate evolution is the ultimate revenge of the nerds.
(How the mind works, Steven Pinker)
----------------------------------------------------------------------------------------------------------------------------------------

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux