(continued from previous pagedef run(self) zipfile zipfile(self outfile' 'zipfile zip_deflatedf write(self infilef close(print('finished background zip of:'self infilebackground asynczip('mydata txt''myarchive zip'background start(print('the main program continues to run in foreground 'background join(wait for the background task to finish print('main program waited until background was done 'the principal challenge of multi-threaded applications is coordinating threads that share data or other resources to that endthe threading module provides number of synchronization primitives including lockseventscondition variablesand semaphores while those tools are powerfulminor design errors can result in problems that are difficult to reproduce sothe preferred approach to task coordination is to concentrate all access to resource in single thread and then use the queue module to feed that thread with requests from other threads applications using queue objects for inter-thread communication and coordination are easier to designmore readableand more reliable logging the logging module offers full featured and flexible logging system at its simplestlog messages are sent to file or to sys stderrimport logging logging debug('debugging information'logging info('informational message'logging warning('warning:config file % not found''server conf'logging error('error occurred'logging critical('critical error -shutting down'this produces the following outputwarning:root:warning:config file server conf not found error:root:error occurred critical:root:critical error -shutting down by defaultinformational and debugging messages are suppressed and the output is sent to standard error other output options include routing messages through emaildatagramssocketsor to an http server new filters can select different routing based on message prioritydebuginfowarningerrorand critical the logging system can be configured directly from python or can be loaded from user editable configuration file for customized logging without altering the application brief tour of the standard library -part ii