Re: SoC idea: desktop file cache

On Fri, Mar 25, 2011 at 6:11 AM, Alan Cox <alan lxorguk ukuu org uk> wrote:
>> There are multiple ways to approach this, but I think by far the
>> simplest is just an mmap'able file containing all .desktop files found
>> in the desktop paths.
> This depends. First comment on the shell is "man pthreads",

Yeah, it probably wouldn't be hard to make gnome-menus threadsafe,
there's no good excuse, I just never did it and kept dreaming of a
non-band-aid fix.

> In both cases a single file cures most of the latency not mmap. In fact
> read() is often faster unless lots of apps will be sharing a cache.

Any application that wants to launch another app needs to read all of
them, so yeah, I think there is an argument for mmap.  Just from the
core, Firefox lets you right click and pick an app to launch a file.
Firefox lets you choose an app in the same way, etc.

> In
> the read case the OS gets a single unambiguous indication of what you
> want. In the mmap case it has to guess and you can end up with a lot of
> fault latency - which can be even worse as it can sometimes clog up all
> the threads of an app, and which is more SMP load.

Your suggestion of telling the OS we are going to read the whole thing
would fix that, and it makes sense.

> mmap MAP_SHARED also makes dealing with external updating really
> interesting because if the file shrinks you need to handle signal
> exceptions from touching pages that no longer exist.

Not if the cache is replaced with rename(), no?

Thanks for the other hints.

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