How does Spotlight work?

jhujhiti

macrumors newbie
Original poster
Feb 8, 2005
24
0
Ledyard, CT, USA
Is Spotlight a filesystem-level addition or a userland process that indexes files as they change? If it's the latter, I'm not so sure it's worth it for my organized self...
 

Logik

macrumors 6502a
Apr 24, 2004
616
0
jhujhiti said:
Is Spotlight a filesystem-level addition or a userland process that indexes files as they change? If it's the latter, I'm not so sure it's worth it for my organized self...
i'm going to take a little guess here and there but someone could correct me if i'm wrong..

it's a userland application daemon that recieves an event if a file on the filesystem changes. spotlight grabs said file information, if there's a plugin to handle said filetype, data is fed through plugin, and input into a database... you click spotlight icon, type search, database is accessed.
 

Bear

macrumors G3
Jul 23, 2002
8,089
4
Sol III - Terra
jhujhiti said:
So it's slow, but easily disabled. Excellent.
I'm not sure how you read that out of the person's answer.

It didn't seem to be that slow in the demos. And rememebr the person was only guessing in how it works.
 

jhujhiti

macrumors newbie
Original poster
Feb 8, 2005
24
0
Ledyard, CT, USA
By slow, I meant it's slower than it "could be." If it were in-kernel or even built into the filesystem (the way ext3 is ext2 with journalling added), it would be much faster.
 

Bear

macrumors G3
Jul 23, 2002
8,089
4
Sol III - Terra
jhujhiti said:
By slow, I meant it's slower than it "could be." If it were in-kernel or even built into the filesystem (the way ext3 is ext2 with journalling added), it would be much faster.
Ahh, but we don't really know where it's built into. And truthfully, it being external to the filesystem drivers would be a good thing.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
24,764
133
Harrogate
jhujhiti said:
By slow, I meant it's slower than it "could be." If it were in-kernel or even built into the filesystem (the way ext3 is ext2 with journalling added), it would be much faster.
This simply is not true! Kernel code does not run faster than non-kernel code. The hooks in the filesystem to detect when new files are created and existing files are modified are in the filesystem (which is not in the kernel, but in a VFS plugin). The dameon is in userland and gets called by the VFS HFS+ plugin.

This is a better solution than a hard coded kernel component as it is more secure (if there is a security problem with the Spotlight indexer it cannot compromise the kernel), is more stable (if the indexer hangs or crashes it does not take out the whole machine) and is extensible which is very important (so your favourite developers can expose their proprietary files to the indexer). The second and third points go hand in hand as if this was running as part of the kernel process then any developer could have code running as the kernel process simply by providing a meta-data importer!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.