1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5 <title>Chapter 18. 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 I. 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">
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>
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>
27 <div class="titlepage"><div>
28 <div><h2 class="title">
29 <a name="interprocess"></a>Chapter 18. Boost.Interprocess</h2></div>
30 <div><div class="author"><h3 class="author">
31 <span class="firstname">Ion</span> <span class="surname">Gaztanaga</span>
33 <div><p class="copyright">Copyright © 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>)
42 <p><b>Table of Contents</b></p>
44 <dt><span class="section"><a href="interprocess.html#interprocess.intro">Introduction</a></span></dt>
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>
50 <dt><span class="section"><a href="interprocess/quick_guide.html">Quick Guide for the Impatient</a></span></dt>
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>
63 <dt><span class="section"><a href="interprocess/some_basic_explanations.html">Some basic explanations</a></span></dt>
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>
77 <dt><span class="section"><a href="interprocess/sharedmemorybetweenprocesses.html">Sharing memory
78 between processes</a></span></dt>
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>
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>
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>
108 <dt><span class="section"><a href="interprocess/managed_memory_segments.html">Managed Memory Segments</a></span></dt>
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>
123 <dt><span class="section"><a href="interprocess/allocators_containers.html">Allocators, containers
124 and memory allocation algorithms</a></span></dt>
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>
137 <dt><span class="section"><a href="interprocess/memory_algorithms.html">Memory allocation algorithms</a></span></dt>
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>
144 <dt><span class="section"><a href="interprocess/streams.html">Direct iostream formatting: vectorstream
145 and bufferstream</a></span></dt>
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>
152 <dt><span class="section"><a href="interprocess/interprocess_smart_ptr.html">Ownership smart pointers</a></span></dt>
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>
163 <dt><span class="section"><a href="interprocess/architecture.html">Architecture and internals</a></span></dt>
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>
173 <dt><span class="section"><a href="interprocess/customizing_interprocess.html">Customizing Boost.Interprocess</a></span></dt>
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>
182 <dt><span class="section"><a href="interprocess/acknowledgements_notes.html">Acknowledgements,
183 notes and links</a></span></dt>
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>
198 <dt><span class="section"><a href="interprocess/indexes_reference.html">Indexes and Reference</a></span></dt>
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>
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>
215 <span class="bold"><strong>Boost.Interprocess</strong></span> simplifies the use of common
216 interprocess communication and synchronization mechanisms and offers a wide
219 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
220 <li class="listitem">
223 <li class="listitem">
226 <li class="listitem">
227 Semaphores, mutexes, condition variables and upgradable mutex types to
228 place them in shared memory and memory mapped files.
230 <li class="listitem">
231 Named versions of those synchronization objects, similar to UNIX/Windows
232 sem_open/CreateSemaphore API.
234 <li class="listitem">
237 <li class="listitem">
240 <li class="listitem">
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:
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
257 <li class="listitem">
258 STL-like containers compatible with shared memory/memory-mapped files.
260 <li class="listitem">
261 STL-like allocators ready for shared memory/memory-mapped files implementing
262 several memory allocation patterns (like pooling).
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>
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.
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>.
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.
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>
297 <span class="bold"><strong>Boost.Interprocess</strong></span> has been tested in the
298 following compilers/platforms:
300 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
301 <li class="listitem">
302 Visual C++ >= 7.1.
304 <li class="listitem">
308 <div class="warning"><table border="0" summary="Warning">
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>
313 <tr><td align="left" valign="top"><p>
314 GCC < 4.3 and MSVC < 9.0 are deprecated and will be removed in the
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>
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>