the chief benefit of the multiprocessing version is that it can potentially run faster on multicore machines than the threaded version since it can run its processes on as many cores as are available compare this with the standard python interpreter (written in csometimes called cpythonwhich has gil (global interpreter lockthat means that only one thread can execute python code at any one time this restriction is an implementation detail and does not necessarily apply to other python interpreters such as jython examplea threaded find duplicate files program |the second threading example has similar structure to the firstbut is more sophisticated in several ways it uses two queuesone for work and one for resultsand has separate results processing thread to output results as soon as they are available it also shows both threading thread subclass and calling threading thread(with functionand also uses lock to serialize access to shared data ( dictthe findduplicates- py program is more advanced version of the finddup py program from it iterates over all the files in the current directory (or the specified path)recursively going into subdirectories it compares the lengths of all the files with the same name (just like finddup py)and for those files that have the same name and the same size it then uses the md (message digestalgorithm to check whether the files are the samereporting any that are we will start by looking at the main(functionsplit into four parts def main()optspath parse_options(data collections defaultdict(listfor rootdirsfiles in os walk(path)for filename in filesfullname os path join(rootfilenametrykey (os path getsize(fullname)filenameexcept environmenterrorcontinue if key[ = continue data[keyappend(fullnamefor brief explanation of why cpython uses gil see www python org/doc/faq/library/#can- -weget-rid-of-the-global-interpreter-lock and docs python org/api/threads html