I've been working more with concurrency in Ruby recently, and I keep seeing various articles using "threads" and "process" interchangeably.
What are the actual definitions of these terms? Is a process composed of multiple threads?
Let's say I use Unicorn/Puma/etc.. as a web server.
Am I correctly understanding the following?
Each Unicorn (or whatever) worker is its own process. It has an individual listing in the Linux process list (
Each worker has multiple threads. These threads share memory and other context because it's all really one process, but simulate the process doing multiple things at once.
Each thread has (at most) one connection to a Database which it uses to query or write data. It checks this connection out from a Connection Pool, which is a collection of connections available for use
Each connection pool applies to one process. So if my background job processor (e.g. Resque, Delayed Job, etc...) has a concurrency of "25" it means that each worker process gets up to 25 connections to distribute among its threads.