Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
jiffies and weird behavior
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
zojas
Veteran
Veteran


Joined: 22 Apr 2002
Posts: 1138
Location: Phoenix, AZ

PostPosted: Wed Jul 10, 2002 7:15 am    Post subject: jiffies and weird behavior Reply with quote

I just installed gento-sources 2.4.19-r7 today. (i was using a 2.4.19-pre2 from kernel.org).

First thing I noticed was that two of my dockapps were going crazy fast: wmfire and wmfrontier. wmfire draws some nice flames whose height is proportional to cpu usage. wmfrontier draws a starship with a bunch of stars flying by.

well suddenly the flames were REALLY fast and the stars were flying by way faster than before (I'd say about 10 times faster)

so I pulled up the wmfrontier source, and saw that the event loop had a usleep(3) call in it. I cranked up the amount of time in the sleep and it made little difference.

I remembered seeing a kernel config option to set the value of Hz which controls how many jiffies fire per second. The default was 1000. I was thinking that the normal setting for this was 100, and that you normally don't get to change it at configure time, but have to go hacking in the code. a quick google found that yes, it is normally 100 for x86.

So i set it to 100, recompiled and rebooted, and my starship was doing a nice sedate warp 1 rather than warp 10. back the way it's been for as long as I'd been running the silly thing.

I'm curious: why would one want to tweak the jiffy, and why is the default 1000 instead of 100 like it is in the plain kernel?
Back to top
View user's profile Send private message
duebbert
n00b
n00b


Joined: 10 Jul 2002
Posts: 3

PostPosted: Wed Jul 10, 2002 7:57 am    Post subject: might help... Reply with quote

I read this in LWN (http://lwn.net/Articles/3671/):

Quote:
The current development kernel remains 2.5.24. Linus has not released any kernels - or surfaced on the linux-kernel mailing list - since before OLS and the Kernel Summit. Some patches are beginning to show up in his BitKeeper tree, however; they include some SCSI updates, an NTFS update, and, interestingly, a change of the internal x86 clock frequency to 1000 Hz.


Don't ask me why.
Back to top
View user's profile Send private message
delta407
Bodhisattva
Bodhisattva


Joined: 23 Apr 2002
Posts: 2876
Location: Chicago, IL

PostPosted: Wed Jul 10, 2002 4:23 pm    Post subject: Reply with quote

Tweaking the jiffy is helpful because 100 Hz is a really old number; on 1.0 GHz machine, each process would get roughly 10 million processor cycles before being interrupted. That seems excessive, and the theory was that latency and responsiveness could be improved by taking 100 Hz and making it 1000 Hz. Numbers are still coming in, but it hasn't hurt anything and scheduling processes ten times faster can only increase throughput.

Also, if usleep calls are broken, they're probably coded incorrectly.
_________________
I don't believe in witty sigs.
Back to top
View user's profile Send private message
zojas
Veteran
Veteran


Joined: 22 Apr 2002
Posts: 1138
Location: Phoenix, AZ

PostPosted: Wed Jul 10, 2002 6:51 pm    Post subject: Reply with quote

okay, the scheduling frequency thing makes a lot of sense.

Quote:
Also, if usleep calls are broken, they're probably coded incorrectly.


do you mean in the library (glibc)? or in the kernel? cause in the app it's just

Code:
usleep(80);


I'd like to figure out how to have both 1000 jiffies/sec and a normal functioning usleep :D
Back to top
View user's profile Send private message
delta407
Bodhisattva
Bodhisattva


Joined: 23 Apr 2002
Posts: 2876
Location: Chicago, IL

PostPosted: Wed Jul 10, 2002 6:59 pm    Post subject: Reply with quote

usleep should work regardless of the jiffy setting...?
_________________
I don't believe in witty sigs.
Back to top
View user's profile Send private message
zojas
Veteran
Veteran


Joined: 22 Apr 2002
Posts: 1138
Location: Phoenix, AZ

PostPosted: Wed Jul 10, 2002 7:10 pm    Post subject: Reply with quote

Quote:
usleep should work regardless of the jiffy setting...?


I just realized that since he used an '80' that would make it run about 12500 times per second!! I think the scheduler just didn't have enough resolution to get it to run that often, but with the extra resolution provided by the '1000' it got a lot closer. so I'm compiling the kernel now with '1000' again and i'll try to tweak the usleep until it runs about 30 times per second instead.
Back to top
View user's profile Send private message
zojas
Veteran
Veteran


Joined: 22 Apr 2002
Posts: 1138
Location: Phoenix, AZ

PostPosted: Wed Jul 10, 2002 7:41 pm    Post subject: Reply with quote

now I'm using

Code:
usleep(12000);


and it works good. now to tweak wmfire...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum