Module 11 of 11

Debugging, Testing & Concurrency

Lessons

About This Module

Writing C that compiles is only half the job. This final module covers how to find bugs and run work in parallel without breaking it.

It starts with GDB, the standard debugger, which lets you set breakpoints, step through code, and inspect variables. It then moves to Valgrind for catching memory leaks and invalid memory access. It ends with concurrency: creating threads with pthreads and protecting shared data with mutexes to avoid race conditions.

Watch the lessons in order, then put everything together in the Projects section.

Lessons

6 videos
01

GDB: How to Debug a C Program

What a debugger is and how to use GDB in the Linux terminal: add breakpoints, watch variables, and pause and resume execution to find a function returning the wrong value.

02

Debugging C Programs with GDB

NeuralNine walks through debugging a C program with GDB, from compiling with debug symbols to stepping through code and inspecting state.

03

Detecting Memory Leaks with Valgrind

Use Valgrind on a simple program to find two memory leaks, then patch them. Essential practice after the pointers and memory module.

04

Short Introduction to Threads (pthreads)

CodeVault introduces threads in C with the POSIX pthread library: what a thread is and how to create and wait for one.

05

Mutex Introduction (pthreads)

How to use a mutex to prevent race conditions in a multi-threaded C program using the POSIX pthread library.

06

Multithreading with POSIX Threads (pthreads)

A longer walkthrough: why use threads, creating and ending them, running several at once, and preventing race conditions with mutexes and condition variables.