IBM developerWorks: POSIX threads explained - A simple and nimble tool for memory sharing | Linux Today

IBM developerWorks: POSIX threads explained – A simple and nimble tool for memory sharing

Written By
Web Webster
Web Webster
Aug 6, 2000

[ Thanks to Braveheart for
this link. ]

POSIX (Portable Operating System Interface) threads are a
great way to increase the responsiveness and performance of your
code.
In this series, Daniel Robbins shows you exactly how to
use threads in your code. A lot of behind-the-scenes details are
covered, so by the end of this series you’ll really be ready to
create your own multithreaded programs.”

“Knowing how to properly use threads should be part of every
good programmer’s repertoire. Threads are similar to processes.
Threads, like processes, are time-sliced by the kernel. On
uniprocessor systems the kernel uses time slicing to simulate
simultaneous execution of threads in much the same way it uses time
slicing with processes. And, on multiprocessor systems, threads are
actually able to run simultaneously, just like two or more
processes can.”

“So why is multithreading preferable to multiple independent
processes for most cooperative tasks? Well, threads share the same
memory space. Independent threads can access the same variables in
memory. So all of your program’s threads can read or write the
declared global integers. If you’ve ever programmed any non-trivial
code that uses fork(), you’ll recognize the importance of this
tool. Why? While fork() allows you to create multiple processes, it
also creates the following communication problem: how to get
multiple processes, each with their own independent memory space,
to communicate. There is no one simple answer to this problem.
While there are many different kinds of local IPC (inter-process
communication), they all suffer from two important
drawbacks….”


Complete Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.