LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-26-2005, 08:18 AM   #1
kuldeep_kap
LQ Newbie
 
Registered: Sep 2005
Posts: 8

Rep: Reputation: 0
Prefetching in Linux


Can anyone tell me whether prefetching of pages during booting and application initialization is implemented? If not, why has it not been implemented in Linux, especially since it has been done in Windows XP. What about run time prefetching?
 
Old 09-27-2005, 12:32 AM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
Linux prefetching API is defined in the asm/processor.h include file
is most likely implemented in the file systems and virtual memory
you tell us
the source code is right there for you to read.
as to why this or that perhaps because what windows XP does is NOT why either way
there are some patches around for swap prefetching and a compiler switch for compiler based loop array prefetching
and many universities have done lots of expermentation with many different prefetching models.

actually how do you know MS implements this or that kind of prefetching
did you read the source code
must work for MS then.
is it implemented well
describe the way it is implements by MS
and what are the overhead costs for the way they have done it ?


why did you ask this stupid question ?
shark bait i guess and i bit
arrrrrrrrr good shark bait

Last edited by foo_bar_foo; 09-27-2005 at 12:36 AM.
 
Old 09-27-2005, 04:07 AM   #3
addy86
Member
 
Registered: Nov 2004
Location: Germany
Distribution: Debian Testing
Posts: 332

Rep: Reputation: 31
Quote:
Originally posted by foo_bar_foo
why did you ask this stupid question ?
Why do you think this question is stupid?
 
Old 09-27-2005, 11:06 AM   #4
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,884
Blog Entries: 28

Rep: Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533
Re: Prefetching in Linux

Quote:
Originally posted by kuldeep_kap
Can anyone tell me whether prefetching of pages during booting and application initialization is implemented? If not, why has it not been implemented in Linux, especially since it has been done in Windows XP. What about run time prefetching?

Windows XP? Wouldn't know how it works as I never ran it, same for 2000. I stopped using windows at winme. How do you really know what windows does, everything is hidden from the user.

Most Linux distros parallel boot apps making Linux boot times generally faster than windows. There is an app called "prelink" that links libraries/apps making start up times of most apps quicker. OpenOffice starts in about 5 seconds for me, Firefox almost instantly.
 
Old 09-27-2005, 01:35 PM   #5
kuldeep_kap
LQ Newbie
 
Registered: Sep 2005
Posts: 8

Original Poster
Rep: Reputation: 0
|||||||||||Windows XP? Wouldn't know how it works as I never ran it, same for 2000. I stopped using windows at winme. How do you really know what windows does, everything is hidden from the user.|||||||||||----by craigevil

Yes windows xp takes log of 3 days of that process run of initial 10 secs and then use this stats to prefetch pages for that process at application startup and hence process startup is faster in winxp. stats are stored in windows\prefetch directory with .pf extension.

so, this is the basic thing and works well for winxp. so, i wanted to know is there anything related to this prefetch thing is provided or attempted in linux for better application performance, if not why?
 
Old 09-27-2005, 04:09 PM   #6
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
Quote:
Originally posted by addy86
Why do you think this question is stupid?
it's a "if Linux doesn't do it like i think windows does it then why not" question

the bottom line is yes Linux uses adaptive read ahead prefetching

you say Windows reads what blocks to prefetch from a file ?
how much time does that take ?
It's like saying I will prefetch where i put the car keys by writing it down and rather than getting the car keys next time i will first have to look for, find, and read a piece of paper with the directions to where i put the car keys and that will be faster than just getting the keys in the first place.
 
Old 09-27-2005, 04:35 PM   #7
kuldeep_kap
LQ Newbie
 
Registered: Sep 2005
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by foo_bar_foo
Linux uses adaptive read ahead prefetching
Linux uses page prefetching.....i didnt knew that.
then tell me more that how does it do it(in brief) and how it improves performance? and is it significantly achieved?

It would be gr8 if you can provide me related links
 
Old 09-27-2005, 04:50 PM   #8
-X-
Member
 
Registered: Oct 2003
Location: Tx,USA
Distribution: Slackware, Red Hat, CentOS
Posts: 495

Rep: Reputation: 30
Hate to butt in, but... like damn, your not asking for much... are ya. There's this thing like google that does wonders.
 
Old 09-27-2005, 04:54 PM   #9
addy86
Member
 
Registered: Nov 2004
Location: Germany
Distribution: Debian Testing
Posts: 332

Rep: Reputation: 31
Quote:
Originally posted by foo_bar_foo
it's a "if Linux doesn't do it like i think windows does it then why not" question
This makes it a valid and justified question. Why shouldn't he ask it? Suppose a certain technique (which is considered performance-improving) is implemented in Windows but not Linux, then there is usually a reason why it hasn't been implemented in Linux yet (either it's useless, not appropriate, or simply not done yet). What is so bad about asking for that reason?

Quote:
you say Windows reads what blocks to prefetch from a file ?
how much time does that take ?
It's like saying I will prefetch where i put the car keys by writing it down and rather than getting the car keys next time i will first have to look for, find, and read a piece of paper with the directions to where i put the car keys and that will be faster than just getting the keys in the first place.
It is implemented in Linux, so there is a reason for it.
Now you claim that it's not reasonable to do this. Judging from your above posts, I don't think that you know much about "prefetching of pages during booting and application initialization" and thus you should be careful what conclusions you draw.

Last edited by addy86; 09-27-2005 at 04:57 PM.
 
Old 09-27-2005, 09:47 PM   #10
TruckStuff
Member
 
Registered: Apr 2002
Posts: 498

Rep: Reputation: 30
Re: Re: Prefetching in Linux

Quote:
Originally posted by craigevil
Most Linux distros parallel boot apps making Linux boot times generally faster than windows. There is an app called "prelink" that links libraries/apps making start up times of most apps quicker. OpenOffice starts in about 5 seconds for me, Firefox almost instantly.
Damn... which desktop environment are you using? I *wish* I had load times like that, even with prelink installed.
 
Old 09-27-2005, 11:19 PM   #11
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
Quote:
Originally posted by addy86
Suppose a certain technique (which is considered performance-improving) is implemented in Windows but not Linux
Suppose -- No one that I know knows how Windows works which is what I and others have said
This is a discussion about Linux not Windows. A more apropriate question would be I have been studying the algorithms used in Linux and i was wondering .........

Quote:
Originally posted by addy86

It is implemented in Linux, so there is a reason for it.
Now you claim that it's not reasonable to do this. Judging from your above posts, I don't think that you know much about "prefetching of pages during booting and application initialization" and thus you should be careful what conclusions you draw.
I certainly never said Linux reads prefetch data from files !
This is becoming an argument that sounds like evangelicles arguing about evolution.
hardware prefetch or adaptive read ahead or compiler based prefetch in or outside the Linux kernel or built directly into the binary executable is a very complex subject and yes my knowledge is limited as is everyone elses here. Certainly this issue is larger than the notion of how one OS should have some .pf files we can see like the "other one" does. If we want to discuss in detail what happens at boot in the function paging_init() or init_bootmem() then we can and should do that.

I personally think reading prefetch information from a file is an odd idea and while it is what WindowsXP CLAIMS to be doing with those .pf files (.pf stands for prefetch -- see how cleaver those guys are ) untill someone can produce the exact algorithms used the idea is meaningless.
If all it's doing is resolving dependency addresses for the platform's dynamic linker I don't think that's prefetching at all. It is in fact prelinking.
Someone else mentioned the program prelink which is most likely closer to what Windows is doing. Prelink used to improve Linux performance during 2.4 days and yes it held linking information in a binary file /etc/prelink.cache as well as in the executables themselves but with the new kernels and the new way it use Rik van Riel's new reverse mapping algorithms prelink no longer offers any performnce improvement at all and might even slow the system down.

By the way as I said earlier I think actual prefetching is implemented as part of the filesystems and related to the block device drivers and the physical block device cache and also something implemented at the compiler level for determinate size loop arrays that fit so nicely in solid chunks in your CPUs MMU. but I'm not sure as addy86 so cleaverly pointed out. But no I will NOT be carefull about what conclusions I draw especially when I simple say we don't actually know the facts enough to have an "intelligent design" discussion about wheather Linux has "evolved" or is just "miraculously created" to be superiour to Windows. Perhaps Pat Robinson can tell us. Or we can get zelda the tarro card reader (now unemployed) from New Orleans to help us determine the mysterious answer.

Last edited by foo_bar_foo; 09-27-2005 at 11:26 PM.
 
Old 09-28-2005, 10:38 AM   #12
kuldeep_kap
LQ Newbie
 
Registered: Sep 2005
Posts: 8

Original Poster
Rep: Reputation: 0
i found there is prefetching is used in buffer cache which is a cache for disk blocks. But, the prefetching algo is so basic i.e. it prefetches adjacent 3 blocks(which is conservatine strategy) and then adapted to aggressive strat at success and there is slow performance cause this method produces more misses and increases prefetching load. More interestingly more work is going on to improve prefetch strategy and replace algo for blocks in buffer cache.

There is one more problem (as pointed out by my senior guides) with buffer cache i.e. it gets full imediatly and its flushing method is not good which again reduces performance.

Can anybody actually care to point out what exaclty the problem is, i am interested to deal with it?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
link dies intermittently-seemingly at random- between win<->linux not linux<->linux?? takahaya Linux - Networking 10 03-09-2007 10:37 PM
triple boot linux/linux/linux No Windows involved toastermaker Linux - Newbie 12 03-02-2006 10:40 PM
Redhat (rhel v2.1) bootup problem with linux (linux vs linux-up) namgor Linux - Software 2 06-24-2004 02:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration