[Tutor] socket communications and threading
Alan Gauld
alan.gauld at btinternet.com
Tue Oct 27 20:16:24 EDT 2015
On 27/10/15 23:58, Alan Gauld wrote:
> that enable multiple tasks to run in parallel on a single computer. Each
> thread is a sub-process of the parent process.
I should add that this is a bit of a simplification because threading
varies in implementation depending on OS and language. Threads are
conceptual subprocesses but may in fact be a part of the parent
process from the OS perspective. In general threads are more efficient
(less memory, faster to start/stop) than true sub-processes but it
all depends on the implementation. Python threading in particular
is not especially efficient.
Threading is notoriously tricky to get right although the simpler
you keep the design (ideally, stateless processing, with no
shared data) the easier it is.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list