Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 2014 16:03:04 +0400
From:      Dmitry Sivachenko <trtrmitya@gmail.com>
To:        =?utf-8?Q?Trond_Endrest=C3=B8l?= <Trond.Endrestol@fagskolen.gjovik.no>
Cc:        hackers@freebsd.org
Subject:   Re: madvise() vs posix_fadvise()
Message-ID:  <C5489EF2-34D8-412C-88AC-476120D3F1F4@gmail.com>
In-Reply-To: <alpine.BSF.2.00.1403211725140.56113@mail.fig.ol.no>
References:  <D6BD48AF-9522-495D-8D54-37854E53C272@gmail.com> <alpine.BSF.2.00.1403211725140.56113@mail.fig.ol.no>

next in thread | previous in thread | raw e-mail | index | archive | help


On 21 марта 2014 г., at 20:27, Trond Endrestøl <Trond.Endrestol@fagskolen.gjovik.no> wrote:

> On Fri, 21 Mar 2014 18:56+0400, Dmitry Sivachenko wrote:
> 
>> Hello!
>> 
>> I have a program which uses large data files (read-only, via mmap()).
>> 
>> These machines have a bit more RAM that these files occupy, so it is 
>> possible to have all these data in memory.
>> 
>> What techniques should I use to promote this data not to be purged 
>> from RAM:
>> 
>> -- madvise(MADV_WILLNEED)
>> -- posix_fadvise(POSIX_FADV_WILLNEED)
>> -- both?
> 
> Although a bit dangerous, mlock(2) might be your ticket. That system 
> call prevents your memory region from being swapped/paged away from 
> physical memory.
> 


I know about mlock(2), it is a bit overkill.
Can someone please explain the difference between madvise(MADV_WILLNEED) and posix_fadvise(POSIX_FADV_WILLNEED)?





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C5489EF2-34D8-412C-88AC-476120D3F1F4>