Multitreading
Multitreading
For the sieve algorithm, we do have to share the sieve array among all the
parallel sieving calls, since the final sieve array is the result of striking out all
multiples of 2 and all multiples of 3 and so on. For the processes to share the
sieve array, it must be global, as in the matrix multiplication program, but the we
need multiprocessing.sharedctypes.RawArray to create the array. If
you read the Python documentation on this class (and obviously, you should),
you’ll find that the values produced by this class are shared across processes.
The smallest unit of array data you can use are signed and unsigned characters.
You’ll need to pick one of these types and decide on values you want to use to
represent true and false.