Book Image

Extreme C

By : Kamran Amini
5 (1)
Book Image

Extreme C

5 (1)
By: Kamran Amini

Overview of this book

There’s a lot more to C than knowing the language syntax. The industry looks for developers with a rigorous, scientific understanding of the principles and practices. Extreme C will teach you to use C’s advanced low-level power to write effective, efficient systems. This intensive, practical guide will help you become an expert C programmer. Building on your existing C knowledge, you will master preprocessor directives, macros, conditional compilation, pointers, and much more. You will gain new insight into algorithm design, functions, and structures. You will discover how C helps you squeeze maximum performance out of critical, resource-constrained applications. C still plays a critical role in 21st-century programming, remaining the core language for precision engineering, aviations, space research, and more. This book shows how C works with Unix, how to implement OO principles in C, and fully covers multi-processing. In Extreme C, Amini encourages you to think, question, apply, and experiment for yourself. The book is essential for anybody who wants to take their C to the next level.
Table of Contents (23 chapters)


This chapter was our first step towards writing multithreaded programs in C using the POSIX threading library. As part of this chapter:

  • We went through the basics of the POSIX threading library, which is the main tool for writing multithreaded applications in POSIX-compliant systems.
  • We explored the various properties of threads and their memory structure.
  • We gave some insight about the available mechanisms for threads to communicate and share a state.
  • We explained that how the memory regions available to all threads within the same process are the best way to share data and communicate.
  • We talked about the kernel threads and the user-level threads and how they differ.
  • We explained the joinable and detached threads and how they differ from the execution point of view.
  • We demonstrated how to use the pthread_create and pthread_join functions and what arguments they receive.
  • Examples of a race condition and a data race were demonstrated using...