access its contents using the standard python indexingslicingand iteration operationseach of which are synchronized by the lock for byte stringsa will also have an value attribute to access the entire array as single string rawarray(typecodeinitializerthe same as array except that there is no locking if you are writing programs that must manipulate large number of array items all at oncethe performance will be significantly better if you use this datatype along with separate lock for synchronization (if neededin addition to shared values created using value(and array()the multiprocessing module provides shared versions of the following synchronization primitivesprimitive description lock rlock mutual exclusion lock reentrant mutual exclusion lock (can be acquired multiple times by the same process without blockingsemaphore bounded semaphore event condition variable semaphore boundedsemaphore event condition the behavior of these objects mimics the synchronization primitives defined in the threading module with identical names please refer to the threading documentation for further details it should be noted that with multiprocessingit is not normally necessary to worry about low-level synchronization with lockssemaphoresor similar constructs to the same degree as with threads in partsend(and receive(operations on pipes and put(and get(operations on queues already provide synchronization howevershared values and locks can have uses in certain specialized settings here is an example that sends python list of floats to another process using shared array instead of pipeimport multiprocessing class floatchannel(object)def _init_ (selfmaxsize)self buffer multiprocessing rawarray(' ',maxsizeself buffer_len multiprocessing value(' 'self empty multiprocessing semaphore( self full multiprocessing semaphore( def send(self,values)self empty acquire(only proceed if buffer empty nitems len(valuesself buffer_len nitems set the buffer size self buffer[:nitemsvalues copy values into the buffer self full release(signal that buffer is full def recv(self)self full acquire(only proceed if buffer full values self buffer[:self buffer_len valuecopy values self empty release(signal that buffer is empty return values lib fl ff