1<h2>vm_behavior_set</h2>
2<hr>
3<p>
4<strong>Function</strong> - Specify expected access patterns for the target VM region.
5<h3>SYNOPSIS</h3>
6<pre>
7<strong>kern_return_t   vm_behavior_set</strong>
8                <strong>(vm_task_t</strong>                          <var>target_task</var>,
9                 <strong>vm_address_t</strong>                           <var>address</var>,
10                 <strong>vm_size_t</strong>                                 <var>size</var>,
11                 <strong>vm_behavior_t</strong>                         <var>behavior</var><strong>);</strong>
12</pre>
13<h3>PARAMETERS</h3>
14<dl>
15<p>
16<dt> <var>target_task</var> 
17<dd>
18[in task send right]
19The port for the task in whose address space the 
20memory object behavior is to be set.
21<p>
22<dt> <var>address</var> 
23<dd>
24[in scalar]
25The starting address for the memory region.
26<p>
27<dt> <var>size</var> 
28<dd>
29[in scalar]
30The number of bytes in the region.
31<p>
32<dt> <var>behavior</var> 
33<dd>
34[in scalar]
35The expected reference pattern for the memory.  Possible
36values are:
37<dl>
38<p>
39<dt> <strong>VM_BEHAVIOR_DEFAULT</strong>
40<dd>
41The system's default behavior.  Assumes strong locality of
42reference, so LRU page replacement, possibly with pre-fetch, 
43would be appropriate.
44<p>
45<dt> <strong>VM_BEHAVIOR_RANDOM</strong>
46<dd>
47No particular order expected.  Assumes weak locality of
48reference, so LRU page replacement may be ineffective.
49<p>
50<dt> <strong>VM_BEHAVIOR_SEQUENTIAL</strong>
51<dd>
52Forward sequential order.
53<p>
54<dt> <strong>VM_BEHAVIOR_RSEQNTL</strong>
55<dd>
56Reverse sequential order.
57</dl>
58</dl>
59<h3>DESCRIPTION</h3>
60<p>
61The <strong>vm_behavior_set</strong> function informs the kernel of
62the expected access
63pattern for a region of memory.  The kernel uses this information
64to bias its prefetch and page
65replacement algorithms.
66<p>
67The region starts at the beginning of the virtual page containing
68<var>address</var>; it ends at the end of the virtual page containing 
69<var>address</var> + <var>size</var> - 1.  Because of this 
70rounding to virtual page boundaries, the amount of memory affected may be 
71greater than <var>size</var>.  Use <strong>host_page_size</strong>
72to find the current virtual page size.
73<h3>NOTES</h3>
74<p>
75This interface is machine word length specific because of the virtual address
76parameter.
77<h3>RETURN VALUES</h3>
78<dl>
79<p>
80<dt> <strong>KERN_INVALID_ADDRESS</strong>
81<dd>
82The specified address is illegal or reserved.
83</dl>
84<h3>RELATED INFORMATION</h3>
85<p>
86Functions:
87<a href="vm_region.html"><strong>vm_region</strong></a>,
88<a href="host_page_size.html"><strong>host_page_size</strong></a>.
89