Book Image

Parallel Programming with Python

By : Jan Palach, Jan Palach V Cruz da Silva
Book Image

Parallel Programming with Python

By: Jan Palach, Jan Palach V Cruz da Silva

Overview of this book

Table of Contents (16 chapters)
Parallel Programming with Python
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding event loop


In order to understand the concept of event loop, we need to understand the elements that form its inner structure.

We will use the term resource descriptor to refer to the socket descriptor as well as file descriptor.

Polling functions

The polling technique is implemented by different operating systems aiming to monitor the status of one or more resource descriptors. Systems implement this technique by means of functions. Polling functions form the basis of event loops. We can often find these models being referred to as readiness notification scheme due to the fact that the polling function notifies the one interested in the event, that the resource descriptor is ready for interaction; the one interested, however, might/might not accomplish the desired operation.

In terms of Linux, for instance, we have the following polling functions:

  • select(): This POSIX implementation presents some disadvantages, which are as follows:

    • Limitation in the number of resource descriptors...