Home
Fractals
Tutorials
Books
My blog
My LinkedIn Profile

BOOKS i'm reading

Napoleon Hill Keys to Success: The 17 Principles of Personal Achievement, Napoleon Hill, ISBN: 978-0452272811
The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich (Expanded and Updated), Timothy Ferriss, ISBN: 978-0307465351
The Fountainhead, Ayn Rand, ISBN: 0452273331
Web Hosting Canada

mailto:olivier@olivierlanglois.net

Category: Multithreading

10/25/07

Permalink 08:08:16 pm, by lano1106, 197 words, 3133 views   English (CA)
Categories: Linux/UNIX, Linux/UNIX, Multithreading, Multithreading

Programming with POSIX Threads

Programming with POSIX Threads, David R. Butenhof, ISBN: 0201633922

In my opinion, this book is better than Pthreads Programming because it goes way beyond just presenting the pthreads API. One critic I had on all the other multithreading books that I have read is that they are not covering issues with multithread programs on a SMP system. This book is actually discussing some of these issues on several pages! Beside this quality, it also covers high-level design patterns on how you can use threads such as pipelines, work crew and client/server. There is also a chapter showing how to program with thread cancellation and a section explaining how to create new synchronization objects from the primitives.

This brings me to the only problem that I can think of this book: its age. It is not totally up to date. Learning how you can build new synchronization objects by itself is a very interesting exercise but the problem is that the new synchronization objects built are the barrier and the read/write lock which have been added to the pthreads API since the book publication. Also, except for a small section describing the futur of pthreads, the newest additions to the pthread API are not described.

08/15/07

Permalink 09:26:37 pm, by lano1106, 336 words, 3554 views   English (CA)
Categories: Linux/UNIX, Multithreading

Pthreads Programming: A POSIX Standard for Better Multiprocessing

Pthreads Programming: A POSIX Standard for Better Multiprocessing, Bradford Nichols, Dick Buttlar, Jacqueline Proulx Farrell, ISBN: 1565921151

This book does a nice job for describing the pthread API. When I have read this book, my multithread programming experience was mainly with Win32 threads and reading this book was my first exposure to the condition synchronization objects. With the help of this book, it has been a breeze to learn how to use conditions. What is missing from this book written 10 years ago, which is also missing in all multithread books that I have read of that era, is coverage on issues with parallel processing. If all you have to do with threads is to launch a background job while keeping UI responsive or asynchronous I/O on a single core processor, you will be fine with this book.

However, if you try to crunch an array of data with multiple threads each processing their own chunk of the array, you could fall into cache line alignment problems even if your threads does not access the same memory locations. Those problems are platform dependant. I have written such a program that was working wonderfully well with a Sparc station and a PowerPC based station but once ported to a x86 architecture, the program was actually becoming slower than the single thread version. It is very hard to get it right. You have to be careful about the array alignment in memory and where the boundaries of the chunks of data that you assign to threads are. What will happen if 2 threads located on 2 different processors access to the same cache line is that one processor will have to flush that cache line back to the main memory and the other processor will have to fetch the values back from the main memory to its cache. The overhead of this is so huge that processing the array from a single thread could be faster.

I still have to find a book that addresses these problems. I expect it to come soon with dual and quad core processors becoming mainstream but this is not this book.

06/02/07

Permalink 02:45:18 pm, by lano1106, 129 words, 2557 views   English (CA)
Categories: Windows programming, Windows programming, Multithreading, Multithreading

Multithreading Applications in Win32: The Complete Guide to Threads

Multithreading Applications in Win32: The Complete Guide to Threads, Jim Beveridge, Robert Wiener, ISBN: 0201442345

It does a very good job at describing the Win32 API for multithreading but the applications of multithreading assumed is strictly I/O related (Networking, printing, writing/reading files). The set of techniques for parallel processing on the same data is completely absent such as data organization in memory to optimize its parallel access. This is probably due to the age of the book as when it has been written, single core processor system was the norm. Parallel processing will become very important with the growing popularity of the multi core systems. Despite this weakness, this book is still my best recommendation for learning multithreaded programming on Windows since, to my knowledge, there is not yet any book tackling the subject of parallel processing on a Windows/x86 platform.

Olivier Langlois's blog

I want you to find in this blog informations about C++ programming that I had a hard time to find in the first place on the web.

November 2024
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Search

Custom Search

Misc

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 7

powered by
b2evolution