Imported Upstream version 1.72.0
[platform/upstream/boost.git] / doc / html / interprocess.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5 <title>Chapter&#160;18.&#160;Boost.Interprocess</title>
6 <link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css">
7 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8 <link rel="home" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9 <link rel="up" href="libraries.html" title="Part&#160;I.&#160;The Boost C++ Libraries (BoostBook Subset)">
10 <link rel="prev" href="heap/acknowledgements.html" title="Acknowledgements">
11 <link rel="next" href="interprocess/quick_guide.html" title="Quick Guide for the Impatient">
12 </head>
13 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14 <table cellpadding="2" width="100%"><tr>
15 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td>
16 <td align="center"><a href="../../index.html">Home</a></td>
17 <td align="center"><a href="../../libs/libraries.htm">Libraries</a></td>
18 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20 <td align="center"><a href="../../more/index.htm">More</a></td>
21 </tr></table>
22 <hr>
23 <div class="spirit-nav">
24 <a accesskey="p" href="heap/acknowledgements.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="interprocess/quick_guide.html"><img src="../../doc/src/images/next.png" alt="Next"></a>
25 </div>
26 <div class="chapter">
27 <div class="titlepage"><div>
28 <div><h2 class="title">
29 <a name="interprocess"></a>Chapter&#160;18.&#160;Boost.Interprocess</h2></div>
30 <div><div class="author"><h3 class="author">
31 <span class="firstname">Ion</span> <span class="surname">Gaztanaga</span>
32 </h3></div></div>
33 <div><p class="copyright">Copyright &#169; 2005-2015 Ion Gaztanaga</p></div>
34 <div><div class="legalnotice">
35 <a name="interprocess.legal"></a><p>
36         Distributed under the Boost Software License, Version 1.0. (See accompanying
37         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
38       </p>
39 </div></div>
40 </div></div>
41 <div class="toc">
42 <p><b>Table of Contents</b></p>
43 <dl class="toc">
44 <dt><span class="section"><a href="interprocess.html#interprocess.intro">Introduction</a></span></dt>
45 <dd><dl>
46 <dt><span class="section"><a href="interprocess.html#interprocess.intro.introduction_building_interprocess">Building
47       Boost.Interprocess</a></span></dt>
48 <dt><span class="section"><a href="interprocess.html#interprocess.intro.tested_compilers">Tested compilers</a></span></dt>
49 </dl></dd>
50 <dt><span class="section"><a href="interprocess/quick_guide.html">Quick Guide for the Impatient</a></span></dt>
51 <dd><dl>
52 <dt><span class="section"><a href="interprocess/quick_guide.html#interprocess.quick_guide.qg_memory_pool">Using shared
53       memory as a pool of unnamed memory blocks</a></span></dt>
54 <dt><span class="section"><a href="interprocess/quick_guide.html#interprocess.quick_guide.qg_named_interprocess">Creating
55       named shared memory objects</a></span></dt>
56 <dt><span class="section"><a href="interprocess/quick_guide.html#interprocess.quick_guide.qg_offset_ptr">Using an offset
57       smart pointer for shared memory</a></span></dt>
58 <dt><span class="section"><a href="interprocess/quick_guide.html#interprocess.quick_guide.qg_interprocess_container">Creating
59       vectors in shared memory</a></span></dt>
60 <dt><span class="section"><a href="interprocess/quick_guide.html#interprocess.quick_guide.qg_interprocess_map">Creating
61       maps in shared memory</a></span></dt>
62 </dl></dd>
63 <dt><span class="section"><a href="interprocess/some_basic_explanations.html">Some basic explanations</a></span></dt>
64 <dd><dl>
65 <dt><span class="section"><a href="interprocess/some_basic_explanations.html#interprocess.some_basic_explanations.processes_and_threads">Processes
66       And Threads</a></span></dt>
67 <dt><span class="section"><a href="interprocess/some_basic_explanations.html#interprocess.some_basic_explanations.sharing_information">Sharing
68       information between processes</a></span></dt>
69 <dt><span class="section"><a href="interprocess/some_basic_explanations.html#interprocess.some_basic_explanations.persistence">Persistence
70       Of Interprocess Mechanisms</a></span></dt>
71 <dt><span class="section"><a href="interprocess/some_basic_explanations.html#interprocess.some_basic_explanations.names">Names Of
72       Interprocess Mechanisms</a></span></dt>
73 <dt><span class="section"><a href="interprocess/some_basic_explanations.html#interprocess.some_basic_explanations.constructors_destructors_and_resource_lifetime">Constructors,
74       destructors and lifetime of Interprocess named resources</a></span></dt>
75 <dt><span class="section"><a href="interprocess/some_basic_explanations.html#interprocess.some_basic_explanations.permissions">Permissions</a></span></dt>
76 </dl></dd>
77 <dt><span class="section"><a href="interprocess/sharedmemorybetweenprocesses.html">Sharing memory
78     between processes</a></span></dt>
79 <dd><dl>
80 <dt><span class="section"><a href="interprocess/sharedmemorybetweenprocesses.html#interprocess.sharedmemorybetweenprocesses.sharedmemory">Shared
81       memory</a></span></dt>
82 <dt><span class="section"><a href="interprocess/sharedmemorybetweenprocesses.html#interprocess.sharedmemorybetweenprocesses.mapped_file">Memory
83       Mapped Files</a></span></dt>
84 <dt><span class="section"><a href="interprocess/sharedmemorybetweenprocesses.html#interprocess.sharedmemorybetweenprocesses.mapped_region">More
85       About Mapped Regions</a></span></dt>
86 <dt><span class="section"><a href="interprocess/sharedmemorybetweenprocesses.html#interprocess.sharedmemorybetweenprocesses.mapped_region_object_limitations">Limitations
87       When Constructing Objects In Mapped Regions</a></span></dt>
88 </dl></dd>
89 <dt><span class="section"><a href="interprocess/offset_ptr.html">Mapping Address Independent Pointer:
90     offset_ptr</a></span></dt>
91 <dt><span class="section"><a href="interprocess/synchronization_mechanisms.html">Synchronization
92     mechanisms</a></span></dt>
93 <dd><dl>
94 <dt><span class="section"><a href="interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.synchronization_mechanisms_overview">Synchronization
95       mechanisms overview</a></span></dt>
96 <dt><span class="section"><a href="interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.mutexes">Mutexes</a></span></dt>
97 <dt><span class="section"><a href="interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.conditions">Conditions</a></span></dt>
98 <dt><span class="section"><a href="interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.semaphores">Semaphores</a></span></dt>
99 <dt><span class="section"><a href="interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.sharable_upgradable_mutexes">Sharable
100       and Upgradable Mutexes</a></span></dt>
101 <dt><span class="section"><a href="interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.lock_conversions">Lock
102       Transfers Through Move Semantics</a></span></dt>
103 <dt><span class="section"><a href="interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.file_lock">File
104       Locks</a></span></dt>
105 <dt><span class="section"><a href="interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.message_queue">Message
106       Queue</a></span></dt>
107 </dl></dd>
108 <dt><span class="section"><a href="interprocess/managed_memory_segments.html">Managed Memory Segments</a></span></dt>
109 <dd><dl>
110 <dt><span class="section"><a href="interprocess/managed_memory_segments.html#interprocess.managed_memory_segments.making_ipc_easy">Making
111       Interprocess Data Communication Easy</a></span></dt>
112 <dt><span class="section"><a href="interprocess/managed_memory_segments.html#interprocess.managed_memory_segments.managed_shared_memory">Managed
113       Shared Memory</a></span></dt>
114 <dt><span class="section"><a href="interprocess/managed_memory_segments.html#interprocess.managed_memory_segments.managed_mapped_files">Managed
115       Mapped File</a></span></dt>
116 <dt><span class="section"><a href="interprocess/managed_memory_segments.html#interprocess.managed_memory_segments.managed_memory_segment_features">Managed
117       Memory Segment Features</a></span></dt>
118 <dt><span class="section"><a href="interprocess/managed_memory_segments.html#interprocess.managed_memory_segments.managed_memory_segment_advanced_features">Managed
119       Memory Segment Advanced Features</a></span></dt>
120 <dt><span class="section"><a href="interprocess/managed_memory_segments.html#interprocess.managed_memory_segments.managed_heap_memory_external_buffer">Managed
121       Heap Memory And Managed External Buffer</a></span></dt>
122 </dl></dd>
123 <dt><span class="section"><a href="interprocess/allocators_containers.html">Allocators, containers
124     and memory allocation algorithms</a></span></dt>
125 <dd><dl>
126 <dt><span class="section"><a href="interprocess/allocators_containers.html#interprocess.allocators_containers.allocator_introduction">Introduction
127       to Interprocess allocators</a></span></dt>
128 <dt><span class="section"><a href="interprocess/allocators_containers.html#interprocess.allocators_containers.stl_allocators_segregated_storage">Segregated
129       storage node allocators</a></span></dt>
130 <dt><span class="section"><a href="interprocess/allocators_containers.html#interprocess.allocators_containers.stl_allocators_adaptive">Adaptive
131       pool node allocators</a></span></dt>
132 <dt><span class="section"><a href="interprocess/allocators_containers.html#interprocess.allocators_containers.containers_explained">Interprocess
133       and containers in managed memory segments</a></span></dt>
134 <dt><span class="section"><a href="interprocess/allocators_containers.html#interprocess.allocators_containers.additional_containers">Boost
135       containers compatible with Boost.Interprocess</a></span></dt>
136 </dl></dd>
137 <dt><span class="section"><a href="interprocess/memory_algorithms.html">Memory allocation algorithms</a></span></dt>
138 <dd><dl>
139 <dt><span class="section"><a href="interprocess/memory_algorithms.html#interprocess.memory_algorithms.simple_seq_fit">simple_seq_fit:
140       A simple shared memory management algorithm</a></span></dt>
141 <dt><span class="section"><a href="interprocess/memory_algorithms.html#interprocess.memory_algorithms.rbtree_best_fit">rbtree_best_fit:
142       Best-fit logarithmic-time complexity allocation</a></span></dt>
143 </dl></dd>
144 <dt><span class="section"><a href="interprocess/streams.html">Direct iostream formatting: vectorstream
145     and bufferstream</a></span></dt>
146 <dd><dl>
147 <dt><span class="section"><a href="interprocess/streams.html#interprocess.streams.vectorstream">Formatting directly
148       in your character vector: vectorstream</a></span></dt>
149 <dt><span class="section"><a href="interprocess/streams.html#interprocess.streams.bufferstream">Formatting directly
150       in your character buffer: bufferstream</a></span></dt>
151 </dl></dd>
152 <dt><span class="section"><a href="interprocess/interprocess_smart_ptr.html">Ownership smart pointers</a></span></dt>
153 <dd><dl>
154 <dt><span class="section"><a href="interprocess/interprocess_smart_ptr.html#interprocess.interprocess_smart_ptr.intrusive_ptr">Intrusive
155       pointer</a></span></dt>
156 <dt><span class="section"><a href="interprocess/interprocess_smart_ptr.html#interprocess.interprocess_smart_ptr.scoped_ptr">Scoped
157       pointer</a></span></dt>
158 <dt><span class="section"><a href="interprocess/interprocess_smart_ptr.html#interprocess.interprocess_smart_ptr.shared_ptr">Shared
159       pointer and weak pointer</a></span></dt>
160 <dt><span class="section"><a href="interprocess/interprocess_smart_ptr.html#interprocess.interprocess_smart_ptr.unique_ptr">Unique
161       pointer</a></span></dt>
162 </dl></dd>
163 <dt><span class="section"><a href="interprocess/architecture.html">Architecture and internals</a></span></dt>
164 <dd><dl>
165 <dt><span class="section"><a href="interprocess/architecture.html#interprocess.architecture.basic_guidelines">Basic guidelines</a></span></dt>
166 <dt><span class="section"><a href="interprocess/architecture.html#interprocess.architecture.architecture_algorithm_to_managed">From
167       the memory algorithm to the managed segment</a></span></dt>
168 <dt><span class="section"><a href="interprocess/architecture.html#interprocess.architecture.allocators_containers">Allocators
169       and containers</a></span></dt>
170 <dt><span class="section"><a href="interprocess/architecture.html#interprocess.architecture.performance">Performance of
171       Boost.Interprocess</a></span></dt>
172 </dl></dd>
173 <dt><span class="section"><a href="interprocess/customizing_interprocess.html">Customizing Boost.Interprocess</a></span></dt>
174 <dd><dl>
175 <dt><span class="section"><a href="interprocess/customizing_interprocess.html#interprocess.customizing_interprocess.custom_interprocess_alloc">Writing
176       a new shared memory allocation algorithm</a></span></dt>
177 <dt><span class="section"><a href="interprocess/customizing_interprocess.html#interprocess.customizing_interprocess.custom_allocators">Building
178       custom STL compatible allocators for Boost.Interprocess</a></span></dt>
179 <dt><span class="section"><a href="interprocess/customizing_interprocess.html#interprocess.customizing_interprocess.custom_indexes">Building
180       custom indexes</a></span></dt>
181 </dl></dd>
182 <dt><span class="section"><a href="interprocess/acknowledgements_notes.html">Acknowledgements,
183     notes and links</a></span></dt>
184 <dd><dl>
185 <dt><span class="section"><a href="interprocess/acknowledgements_notes.html#interprocess.acknowledgements_notes.notes_windows">Notes
186       for Windows users</a></span></dt>
187 <dt><span class="section"><a href="interprocess/acknowledgements_notes.html#interprocess.acknowledgements_notes.notes_linux">Notes
188       for Linux users</a></span></dt>
189 <dt><span class="section"><a href="interprocess/acknowledgements_notes.html#interprocess.acknowledgements_notes.thanks_to">Thanks
190       to...</a></span></dt>
191 <dt><span class="section"><a href="interprocess/acknowledgements_notes.html#interprocess.acknowledgements_notes.release_notes">Release
192       Notes</a></span></dt>
193 <dt><span class="section"><a href="interprocess/acknowledgements_notes.html#interprocess.acknowledgements_notes.books_and_links">Books
194       and interesting links</a></span></dt>
195 <dt><span class="section"><a href="interprocess/acknowledgements_notes.html#interprocess.acknowledgements_notes.future_improvements">Future
196       improvements...</a></span></dt>
197 </dl></dd>
198 <dt><span class="section"><a href="interprocess/indexes_reference.html">Indexes and Reference</a></span></dt>
199 <dd><dl>
200 <dt><span class="section"><a href="interprocess/indexes_reference.html#interprocess.indexes_reference.index">Indexes</a></span></dt>
201 <dt><span class="section"><a href="interprocess/indexes_reference.html#boost_interprocess_header_reference">Boost.Interprocess Header Reference</a></span></dt>
202 </dl></dd>
203 </dl>
204 </div>
205 <div class="section">
206 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
207 <a name="interprocess.intro"></a><a class="link" href="interprocess.html#interprocess.intro" title="Introduction">Introduction</a>
208 </h2></div></div></div>
209 <div class="toc"><dl class="toc">
210 <dt><span class="section"><a href="interprocess.html#interprocess.intro.introduction_building_interprocess">Building
211       Boost.Interprocess</a></span></dt>
212 <dt><span class="section"><a href="interprocess.html#interprocess.intro.tested_compilers">Tested compilers</a></span></dt>
213 </dl></div>
214 <p>
215       <span class="bold"><strong>Boost.Interprocess</strong></span> simplifies the use of common
216       interprocess communication and synchronization mechanisms and offers a wide
217       range of them:
218     </p>
219 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
220 <li class="listitem">
221           Shared memory.
222         </li>
223 <li class="listitem">
224           Memory-mapped files.
225         </li>
226 <li class="listitem">
227           Semaphores, mutexes, condition variables and upgradable mutex types to
228           place them in shared memory and memory mapped files.
229         </li>
230 <li class="listitem">
231           Named versions of those synchronization objects, similar to UNIX/Windows
232           sem_open/CreateSemaphore API.
233         </li>
234 <li class="listitem">
235           File locking.
236         </li>
237 <li class="listitem">
238           Relative pointers.
239         </li>
240 <li class="listitem">
241           Message queues.
242         </li>
243 </ul></div>
244 <p>
245       <span class="bold"><strong>Boost.Interprocess</strong></span> also offers higher-level
246       interprocess mechanisms to allocate dynamically portions of a shared memory
247       or a memory mapped file (in general, to allocate portions of a fixed size memory
248       segment). Using these mechanisms, <span class="bold"><strong>Boost.Interprocess</strong></span>
249       offers useful tools to construct C++ objects, including STL-like containers,
250       in shared memory and memory mapped files:
251     </p>
252 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
253 <li class="listitem">
254           Dynamic creation of anonymous and named objects in a shared memory or memory
255           mapped file.
256         </li>
257 <li class="listitem">
258           STL-like containers compatible with shared memory/memory-mapped files.
259         </li>
260 <li class="listitem">
261           STL-like allocators ready for shared memory/memory-mapped files implementing
262           several memory allocation patterns (like pooling).
263         </li>
264 </ul></div>
265 <div class="section">
266 <div class="titlepage"><div><div><h3 class="title">
267 <a name="interprocess.intro.introduction_building_interprocess"></a><a class="link" href="interprocess.html#interprocess.intro.introduction_building_interprocess" title="Building Boost.Interprocess">Building
268       Boost.Interprocess</a>
269 </h3></div></div></div>
270 <p>
271         There is no need to compile <span class="bold"><strong>Boost.Interprocess</strong></span>,
272         since it's a header only library. Just include your Boost header directory
273         in your compiler include path.
274       </p>
275 <p>
276         <span class="bold"><strong>Boost.Interprocess</strong></span> depends on <a href="http://www.boost.org/libs/date_time/" target="_top"><span class="bold"><strong>Boost.DateTime</strong></span></a>, which needs separate compilation.
277         However, the subset used by <span class="bold"><strong>Boost.Interprocess</strong></span>
278         does not need any separate compilation so the user can define <code class="computeroutput"><span class="identifier">BOOST_DATE_TIME_NO_LIB</span></code> to avoid Boost from
279         trying to automatically link the <span class="bold"><strong>Boost.DateTime</strong></span>.
280       </p>
281 <p>
282         In POSIX systems, <span class="bold"><strong>Boost.Interprocess</strong></span> uses
283         pthread system calls to implement classes like mutexes, condition variables,
284         etc... In some operating systems, these POSIX calls are implemented in separate
285         libraries that are not automatically linked by the compiler. For example,
286         in some Linux systems POSIX pthread functions are implemented in <code class="computeroutput"><span class="identifier">librt</span><span class="special">.</span><span class="identifier">a</span></code> library, so you might need to add that
287         library when linking an executable or shared library that uses <span class="bold"><strong>Boost.Interprocess</strong></span>. If you obtain linking errors related
288         to those pthread functions, please revise your system's documentation to
289         know which library implements them.
290       </p>
291 </div>
292 <div class="section">
293 <div class="titlepage"><div><div><h3 class="title">
294 <a name="interprocess.intro.tested_compilers"></a><a class="link" href="interprocess.html#interprocess.intro.tested_compilers" title="Tested compilers">Tested compilers</a>
295 </h3></div></div></div>
296 <p>
297         <span class="bold"><strong>Boost.Interprocess</strong></span> has been tested in the
298         following compilers/platforms:
299       </p>
300 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
301 <li class="listitem">
302             Visual C++ &gt;= 7.1.
303           </li>
304 <li class="listitem">
305             GCC &gt;= 4.1.
306           </li>
307 </ul></div>
308 <div class="warning"><table border="0" summary="Warning">
309 <tr>
310 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../doc/src/images/warning.png"></td>
311 <th align="left">Warning</th>
312 </tr>
313 <tr><td align="left" valign="top"><p>
314           GCC &lt; 4.3 and MSVC &lt; 9.0 are deprecated and will be removed in the
315           next version.
316         </p></td></tr>
317 </table></div>
318 </div>
319 </div>
320 </div>
321 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
322 <td align="left"><p><small>Last revised: December 10, 2019 at 00:26:49 GMT</small></p></td>
323 <td align="right"><div class="copyright-footer"></div></td>
324 </tr></table>
325 <hr>
326 <div class="spirit-nav">
327 <a accesskey="p" href="heap/acknowledgements.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><img src="../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="interprocess/quick_guide.html"><img src="../../doc/src/images/next.png" alt="Next"></a>
328 </div>
329 </body>
330 </html>