Deleted Added
full compact
a.t (21673) a.t (22818)
1.\" Copyright (c) 1986 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)a.t 5.1 (Berkeley) 4/16/91
1.\" Copyright (c) 1986 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)a.t 5.1 (Berkeley) 4/16/91
33.\" $FreeBSD: head/share/doc/papers/newvm/a.t 21673 1997-01-14 07:20:47Z jkh $
33.\" $FreeBSD: head/share/doc/papers/newvm/a.t 22818 1997-02-17 00:07:54Z wosch $
34.\"
35.sp 2
36.ne 2i
37.NH
38Appendix A \- Virtual Memory Interface
34.\"
35.sp 2
36.ne 2i
37.NH
38Appendix A \- Virtual Memory Interface
39.SH
39.NH 2
40Mapping pages
41.PP
42The system supports sharing of data between processes
43by allowing pages to be mapped into memory. These mapped
44pages may be \fIshared\fP with other processes or \fIprivate\fP
45to the process.
46Protection and sharing options are defined in \fI<sys/mman.h>\fP as:
47.DS

--- 95 unchanged lines hidden (view full) ---

143A mapping can be removed by the call
144.DS
145munmap(addr, len);
146caddr_t addr; int len;
147.DE
148This call deletes the mappings for the specified address range,
149and causes further references to addresses within the range
150to generate invalid memory references.
40Mapping pages
41.PP
42The system supports sharing of data between processes
43by allowing pages to be mapped into memory. These mapped
44pages may be \fIshared\fP with other processes or \fIprivate\fP
45to the process.
46Protection and sharing options are defined in \fI<sys/mman.h>\fP as:
47.DS

--- 95 unchanged lines hidden (view full) ---

143A mapping can be removed by the call
144.DS
145munmap(addr, len);
146caddr_t addr; int len;
147.DE
148This call deletes the mappings for the specified address range,
149and causes further references to addresses within the range
150to generate invalid memory references.
151.SH
151.NH 2
152Page protection control
153.PP
154A process can control the protection of pages using the call
155.DS
156mprotect(addr, len, prot);
157caddr_t addr; int len, prot;
158.DE
159This call changes the specified pages to have protection \fIprot\fP\|.
160Not all implementations will guarantee protection on a page basis;
161the granularity of protection changes may be as large as an entire region.
152Page protection control
153.PP
154A process can control the protection of pages using the call
155.DS
156mprotect(addr, len, prot);
157caddr_t addr; int len, prot;
158.DE
159This call changes the specified pages to have protection \fIprot\fP\|.
160Not all implementations will guarantee protection on a page basis;
161the granularity of protection changes may be as large as an entire region.
162.SH
162.NH 2
163Giving and getting advice
164.PP
165A process that has knowledge of its memory behavior may
166use the \fImadvise\fP call:
167.DS
168madvise(addr, len, behav);
169caddr_t addr; int len, behav;
170.DE

--- 12 unchanged lines hidden (view full) ---

183core resident by using the call
184.DS
185mincore(addr, len, vec)
186caddr_t addr; int len; result char *vec;
187.DE
188Here the current core residency of the pages is returned
189in the character array \fIvec\fP, with a value of 1 meaning
190that the page is in-core.
163Giving and getting advice
164.PP
165A process that has knowledge of its memory behavior may
166use the \fImadvise\fP call:
167.DS
168madvise(addr, len, behav);
169caddr_t addr; int len, behav;
170.DE

--- 12 unchanged lines hidden (view full) ---

183core resident by using the call
184.DS
185mincore(addr, len, vec)
186caddr_t addr; int len; result char *vec;
187.DE
188Here the current core residency of the pages is returned
189in the character array \fIvec\fP, with a value of 1 meaning
190that the page is in-core.
191.SH
191.NH 2
192Synchronization primitives
193.PP
194Primitives are provided for synchronization using semaphores in shared memory.
195Semaphores must lie within a MAP_SHARED region with at least modes
196PROT_READ and PROT_WRITE.
197The MAP_HASSEMAPHORE flag must have been specified when the region was created.
198To acquire a lock a process calls:
199.DS

--- 41 unchanged lines hidden ---
192Synchronization primitives
193.PP
194Primitives are provided for synchronization using semaphores in shared memory.
195Semaphores must lie within a MAP_SHARED region with at least modes
196PROT_READ and PROT_WRITE.
197The MAP_HASSEMAPHORE flag must have been specified when the region was created.
198To acquire a lock a process calls:
199.DS

--- 41 unchanged lines hidden ---