Q1: pthread_mutex_lock(&nextbaselock); base = nextbase; nextbase += nbinc; // unlock pthread_mutex_unlock(&nextbaselock); for (b = base; b < base+nbinc; b += 2) { if (b <= lim) { // don't bother crossing out if base known composite if (prime[b]) { crossout(b); work++; // log work done by this thread } } else return work; } } while (1); Q2: 47 Q3: 6 words, Copy on Write Q4: maxpar <- function(cls,x) { require(parallel) clusterExport(cls,'x',envir=environment()) maxidxgrp <- function(igrp) max(x[igrp]) indexgrps <- splitIndices(length(x),length(cls)) rslts <- clusterApply(cls,indexgrps,maxidxgrp) Reduce(max,rslts) } library(parallel) cls <- makeCluster(2) z <- c(5,2,1,22,6,8,9) maxpar(cls,z)