O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

20Multithreading

Multithreading is another method for achieving concurrency in your application. While multiprocessing uses multiple independent processes with their own address spaces and resources, threads are multiple execution streams that all run within a single application, with a single address space, all sharing the available resources.

Multithreading, like multiprocessing, can take advantage of multiple CPUs. You can also use it to simplify some kinds of programming. Each thread can go on its merry way, computing values and calling functions that block, while other threads can run independently and are unaffected. One very common use of threads is handling requests in a network server (like a web server). A new connection is accept() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required