Python: Using Threads
Developing concurrent applications is a difficult subject and threads are the root of many nasty bugs, so you should try to make your applications as simple as possible. However, threads allow you to use your CPU, including its various cores, to its full potential. How processes, threads and variabl...
Saved in:
Published in | Linux format no. 215; p. 88 |
---|---|
Main Author | |
Format | Magazine Article |
Language | English |
Published |
Bath
Future Publishing Ltd
01.09.2016
|
Subjects | |
Online Access | Get full text |
Cover
Loading…
Summary: | Developing concurrent applications is a difficult subject and threads are the root of many nasty bugs, so you should try to make your applications as simple as possible. However, threads allow you to use your CPU, including its various cores, to its full potential. How processes, threads and variables are related can be seen in the diagram. As you'll see a thread can access two kinds of variables: local and global ones. This article will use both Python versions -- you can find out which Python version is used by looking at the first line of a Python script; for Python version 2.7.x the first line of a script will be /usr/bin/python and for Python version 3.x it will be /usr/bin/python3. Please bear in mind that the methodology used is more important than the version. The thread module is available in Python 2.7.x but not in Python 3.x. Additionally, Python 2 users are advised to use the threading module instead. |
---|---|
Bibliography: | ObjectType-Article-1 ObjectType-Feature-2 content type line 24 SourceType-Magazines-1 SourceType-Scholarly Journals-1 content type line 23 |
ISSN: | 1470-4234 |