Blocking, Polling, Pipes, Queues in multiprocessing and how they are affected by the OS's time-slicing schedule

Category: Python - Miscellaneous

This short code demonstrates how blocking calls to a Queue, while consuming less CPU, are limited in their response time by the minimum time slice the OS is willing to allocate (typically 10ms for Mac OS X and Linux). Non-blocking calls to Pipe, using poll() to check if there is data, on the other hand, give us millisecond or less response times, though they consume more CPU. In this respect doing a blocking call to a CPU is no different than adding sleep(.01) statements to a polling loop. In a way, if you execute a sleep(.01) only when you have no events in your poll you will be more efficient than if you had a blocking call pull events off your Queue one by one - because each call to Queue.get() consumes a time-slice, whereas the sleep(.01) only occurs once. Date: 17 February, 2012


Events - Multiprocessing - Multitasking - Polling - Timeslice

Homepage: http://code.activestate.com/recipes/577223-blocking-polling-pipes-queues-in-multiprocessing-a/?in=lang-python

Developer: Kaushik Ghose

License: Freeware

Operating System: Windows

Add a Comment

all are required fields

     
What do you think of this resource?

Select Your Rate:

Votes:0

 

Related Scripts Download

EZ_Sneezy-Cal is a free and simple online calendar writen in PHP and MySQL.

developer Developer: Dave Torres
license License: GNU General Public License (GPL)
operating systems Operating System: All


Web2Calendar makes it very easy to mimic outlook style or google style calendar on your website or applications.

developer Developer: Suresh Solomon
license License: Common Public License
operating systems Operating System: Not Available


dhtmlxScheduler is a web-based JavaScript event calendar that provides rich and intuitive scheduling solution similar to MS Outlook or Google Calendar.

developer Developer: Ivan Petrenko
license License: GNU General Public License (GPL)
operating systems Operating System: Cross-platform


Countdown class displays (and updates) time left provided by user.

developer Developer: Arturs Sosins
license License: BSD License
operating systems Operating System: Not Available


Highlighter class can be used emphasize, highlight specific words or word combination in website.

developer Developer: Arturs Sosins
license License: BSD License
operating systems Operating System: Not Available


Canvas Events class extends canvas object to help to attach mouse events to different shapes with minimal javascript code modifications

It supports all native canvas context methods.

developer Developer: Arturs Sosins
license License: BSD License
operating systems Operating System: Not Available


This is a stylish web calendar with events written in classic ASP.

developer Developer: TH
license License: Freeware
operating systems Operating System: Linux, Unix, Windows


An incremental PCA algorithm in python.

developer Developer: Micha Kalfon
license License: Freeware
operating systems Operating System: Windows


For small dirty hacks in Perl has a module File::Slurp.

developer Developer: Denis Barmenkov
license License: Freeware
operating systems Operating System: Windows