# Re: [PATCH v5 03/15] index-helper: new daemon for caching index and related stuff

3 messages from 2016-04-20 to 2016-04-20. Participants: Duy Nguyen, David Turner, Johannes Schindelin.
Thread: https://gitlist.dev/t/42081

## Duy Nguyen, 2016-04-20 00:31

Subject: Re: [PATCH v5 03/15] index-helper: new daemon for caching index and related stuff
Message-ID: <CACsJy8D_4KFjz6HefvzmWw-6Qqg0uguq8MXL6kLY0oMyVhPS0w@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8D_4KFjz6HefvzmWw-6Qqg0uguq8MXL6kLY0oMyVhPS0w%40mail.gmail.com

```
On Wed, Apr 20, 2016 at 6:27 AM, David Turner <dturner@twopensource.com> wrote:
> Shared memory is done by storing files in a per-repository temporary
> directory.  This is more portable than shm (which requires
> posix-realtime and has various quirks on OS X).  It might even work on
> Windows, although this has not been tested.

There's another option, but I'm not sure if it's too clever/tricky to
do. Anyway, on *nix we can send file descriptors over unix socket [2],
then mmap them back to access content. On Windows, it looks like
DuplicateHandle [1] can do nearly the same thing. This keeps
everything in memory and we don't have to worry about cleaning up
shm-* files.

[1] http://lackingrhoticity.blogspot.com/2015/05/passing-fds-handles-between-processes.html
[2] http://www.normalesup.org/~george/comp/libancillary/
-- 
Duy

```

## David Turner, 2016-04-20 00:44

Subject: Re: [PATCH v5 03/15] index-helper: new daemon for caching index and related stuff
Message-ID: <1461113092.5540.147.camel@twopensource.com>
URL: https://gitlist.dev/e/1461113092.5540.147.camel%40twopensource.com
In-Reply-To: <CACsJy8D_4KFjz6HefvzmWw-6Qqg0uguq8MXL6kLY0oMyVhPS0w@mail.gmail.com>

```
On Wed, 2016-04-20 at 07:31 +0700, Duy Nguyen wrote:
> On Wed, Apr 20, 2016 at 6:27 AM, David Turner <
> dturner@twopensource.com> wrote:
> > Shared memory is done by storing files in a per-repository
> > temporary
> > directory.  This is more portable than shm (which requires
> > posix-realtime and has various quirks on OS X).  It might even work
> > on
> > Windows, although this has not been tested.
> 
> There's another option, but I'm not sure if it's too clever/tricky to
> do. Anyway, on *nix we can send file descriptors over unix socket
> [2],
> then mmap them back to access content. On Windows, it looks like
> DuplicateHandle [1] can do nearly the same thing. This keeps
> everything in memory and we don't have to worry about cleaning up
> shm-* files.
> 
> [1] http://lackingrhoticity.blogspot.com/2015/05/passing-fds-handles-
> between-processes.html
> [2] http://www.normalesup.org/~george/comp/libancillary/

It's possibly a bit simpler for the index, although more complex
overall since we still need to write temp files for the watchman data.

Will consider/try.

```

## Johannes Schindelin, 2016-04-20 12:19

Subject: Re: [PATCH v5 03/15] index-helper: new daemon for caching index and related stuff
Message-ID: <alpine.DEB.2.20.1604201418550.2826@virtualbox>
URL: https://gitlist.dev/e/alpine.DEB.2.20.1604201418550.2826%40virtualbox
In-Reply-To: <CACsJy8D_4KFjz6HefvzmWw-6Qqg0uguq8MXL6kLY0oMyVhPS0w@mail.gmail.com>

```
Hi Duy,

On Wed, 20 Apr 2016, Duy Nguyen wrote:

> On Wed, Apr 20, 2016 at 6:27 AM, David Turner <dturner@twopensource.com> wrote:
> > Shared memory is done by storing files in a per-repository temporary
> > directory.  This is more portable than shm (which requires
> > posix-realtime and has various quirks on OS X).  It might even work on
> > Windows, although this has not been tested.
> 
> There's another option, but I'm not sure if it's too clever/tricky to
> do. Anyway, on *nix we can send file descriptors over unix socket [2],
> then mmap them back to access content.

This sounds too clever to me ;-)

Ciao,
Dscho

```
