Date: 08 Aug 2001 15:39:54 +0100 From: Rolf Neugebauer <neugebar@dcs.gla.ac.uk> To: "Weiguang SHI" <weiguang_shi@hotmail.com> Cc: bright@mu.org, jeff@expertcity.com, freebsd-hackers@freebsd.org Subject: Re: timing question Message-ID: <ysqae1ad39h.fsf@therese.dcs.gla.ac.uk> In-Reply-To: "Weiguang SHI"'s message of "Tue, 07 Aug 2001 10:11:11 -0600" References: <F4977bieLYCT4aJ6pkN00000e1b@hotmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
"Weiguang SHI" <weiguang_shi@hotmail.com> writes: > >From: Alfred Perlstein <bright@mu.org> > >To: Jeff Behl <jeff@expertcity.com> > >CC: "'freebsd-hackers@freebsd.org'" <freebsd-hackers@freebsd.org> > >Subject: Re: timing question > >Date: Mon, 6 Aug 2001 14:49:55 -0500 > > > >* Jeff Behl <jeff@expertcity.com> [010806 12:48] wrote: > > > please excuse and direct me to the right place if this isn't the > > appropriate > > > place to post this sort of question.... > > > > > > we're looking into moving to freebsd (yea!), but found the following > > > problem. It seems that the shortest amount of time the below code will > > > sleep for is 20 seconds! any call to nanosleep for 5,10, etc miliseconds > > > returns a 20 ms delay. are we doing something wrong? > > > >You may have to increase the kernel value for HZ so that you get > >more fine grained clock interrupts. > > I didn't look at the code but if increasing the value of 'hz' will > result in more clock-interrupts/sec thus more overhead, wouldn't it be > better to auto-adjust the clock-interrupt rate somewhere in the OS > to clock-interrupt at big strides in the beginning but at > finer-grained interval as the actual timeout event approaches? The overhead for increasing the hz value to say 1000 is not too severe. I used the simple benchmark from the Loadable Scheduler Modules for Linux project [1] to measure the scheduling overhead on a 4.3-stable box. Increasing hz from 100 to 1000 incurs an overhead of .4 % on a PIII 450MHz. NB. for achieving higher timer resolutions you might find it interesting to look at Soft-Timers at Rice [2]. Events are scheduled at the usual timer interrupt frequency but the time wheels are also checked at system-call and other interrupt times, thus, depending on load, achieving finer grained timer resolutions. The TOCS paper, referenced on that site, also describes a mixed approach between Soft-Timers and hardware timers to achieve tighter delay bounds. Rolf [1] http://resourcemanagement.unixsolutions.hp.com/WaRM/docs/loadable_sched.html#Performance Measurement [2] http://www.cs.rice.edu/CS/Systems/Soft-timers/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ysqae1ad39h.fsf>