Cargando…

Learning concurrency in Python : speed up your Python code with clean, readable, and advanced concurrency techniques /

Detalles Bibliográficos
Clasificación:Libro Electrónico
Autor principal: Forbes, Elliot (Autor)
Formato: Electrónico eBook
Idioma:Inglés
Publicado: Birmingham, UK : Packt Publishing, 2017.
Temas:
Acceso en línea:Texto completo
Texto completo
Tabla de Contenidos:
  • Cover; Copyright; Credits; About the Author; About the Reviewer; www.PacktPub.com; Customer Feedback; Table of Contents; Preface; Chapter 1: Speed It Up!; History of concurrency; Threads and multithreading; What is a thread?; Types of threads; What is multithreading?; Processes; Properties of processes; Multiprocessing; Event-driven programming; Turtle; Breaking it down; Reactive programming; ReactiveX
  • RxPy; Breaking it down; GPU programming; PyCUDA; OpenCL; Theano; The limitations of Python; Jython; IronPython; Why should we use Python?; Concurrent image download; Sequential download.
  • Breaking it downConcurrent download; Breaking it down; Improving number crunching with multiprocessing; Sequential prime factorization; Breaking it down; Concurrent prime factorization; Breaking it down; Summary; Chapter 2: Parallelize It; Understanding concurrency; Properties of concurrent systems; I/O bottlenecks; Understanding parallelism; CPU-bound bottlenecks; How do they work on a CPU?; Single-core CPUs; Clock rate; Martelli model of scalability; Time-sharing
  • the task scheduler; Multi-core processors; System architecture styles; SISD; SIMD; MISD; MIMD.
  • Computer memory architecture stylesUMA; NUMA; Summary; Chapter 3: Life of a Thread; Threads in Python; Thread state; State flow chart; Python example of thread state; Breaking it down; Different types of threads; POSIX threads; Windows threads; The ways to start a thread; Starting a thread; Inheriting from the thread class; Breaking it down; Forking; Example; Breaking it down; Daemonizing a thread; Example; Breaking it down; Handling threads in Python; Starting loads of threads; Example; Breaking it down; Slowing down programs using threads; Example; Breaking it down.
  • Getting the total number of active threadsExample; Breaking it down; Getting the current thread; Example; Breaking it down; Main thread; Example; Breaking it down; Enumerating all threads; Example; Breaking it down; Identifying threads; Example; Breakdown; Ending a thread; Best practice in stopping threads; Example; Output; Orphan processes; How does the operating system handle threads; Creating processes versus threads; Example; Breaking it down; Multithreading models; One-to-one thread mapping; Many-to-one; Many-to-many; Summary; Chapter 4: Synchronization between Threads.
  • Synchronization between threadsThe Dining Philosophers; Example; Output; Race conditions; Process execution sequence; The solution; Critical sections; Filesystem; Life-critical systems; Shared resources and data races; The join method; Breaking it down; Putting it together; Locks; Example; Breaking it down; RLocks; Example; Breaking it down; Output; RLocks versus regular locks; Condition; Definition; Example; Our publisher; Our subscriber; Kicking it off; The results; Semaphores; Class definition; Example; The TicketSeller class; Output; Thread race; Bounded semaphores; Events; Example.