Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

Using Threads within a UNIX Process

  • Print
  • + Share This
This chapter from the third edition of the highly-regarded Advanced Programming in the UNIX Environment looks inside a UNIX process to see how multiple threads can be used to perform multiple tasks within the environment of a single process. It also examines the synchronization mechanisms available to prevent multiple threads from viewing inconsistencies in their shared resources.

Read Advanced Programming in the UNIX Environment, Third Edition or more than 24,000 other books and videos on Safari Books Online. Start a free trial today.



This chapter is from the book

11.1. Introduction

We discussed processes in earlier chapters. We learned about the environment of a UNIX process, the relationships between processes, and ways to control processes. We saw that a limited amount of sharing can occur between related processes.

In this chapter, we’ll look inside a process further to see how we can use multiple threads of control (or simply threads) to perform multiple tasks within the environment of a single process. All threads within a single process have access to the same process components, such as file descriptors and memory.

Any time you try to share a single resource among multiple users, you have to deal with consistency. We’ll conclude this chapter with a look at the synchronization mechanisms available to prevent multiple threads from viewing inconsistencies in their shared resources.

  • + Share This
  • 🔖 Save To Your Account