Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Parallel Programming with Python

You're reading from  Parallel Programming with Python

Product type Book
Published in Jun 2014
Publisher
ISBN-13 9781783288397
Pages 124 pages
Edition 1st Edition
Languages

Table of Contents (16) Chapters

Parallel Programming with Python
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. Contextualizing Parallel, Concurrent, and Distributed Programming 2. Designing Parallel Algorithms 3. Identifying a Parallelizable Problem 4. Using the threading and concurrent.futures Modules 5. Using Multiprocessing and ProcessPoolExecutor 6. Utilizing Parallel Python 7. Distributing Tasks with Celery 8. Doing Things Asynchronously Index

Defining threads


Threads are different execution lines in a process. Let us picture a program as if it was a hive, and there is a process of collecting pollen inside this hive. This collection process is carried out by several worker bees who work simultaneously in order to solve the problem of lack of pollen. The worker bees play the role of threads, acting inside a process and sharing resources to perform their tasks.

Threads belong to the same process and share the same memory space. Hence, the developer's task is to control and access these areas of memory.

Advantages and disadvantages of using threads

Some advantages and disadvantages have to be taken into account when deciding on the use of threads, and it depends on the language and operating system used to implement a solution.

The advantages of using threads are as follows:

  • The speed of communication of the threads in the same process, data location, and shared information is fast

  • The creation of threads is less costly than the creation...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}