Thread: An independent path of execution within a process, sharing memory with other threads in the same process. A thread is an independent path of execution inside a process. A process can run several threads at once, and they share the same memory. Shared memory makes threads efficient, because they can work on the same data without copying it. It also makes them risky: two threads changing the same data at the same time cause race conditions unless access is coordinated with locks or other tools.
Traditional PHP sidesteps this. Each request runs in its own process, so your code rarely deals with threads directly. Java, C#, Go and Python use them more openly. In web applications, concurrency is usually handled with multiple processes and queue workers instead, which isolates failures and keeps code simpler. When you do use threads, keep shared mutable state to a minimum.
Use when code runs things at the same time - threads, async/await, queues and workers, parallel requests, cron jobs, webhooks that retry - or when a bug only happens "sometimes" or under load. Covers race conditions, deadlocks, mutexes/locks, atomic operations, idempotency, message queues and backpressure, with Laravel and database examples.
Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.