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 a web server.

Am I correctly understanding the following?

  1. Each web server worker is its own process. It has an individual listing in the Linux process list (ps aux) PCB.

  2. Each worker has multiple threads. These threads share memory and another context because it's all really one process, but simulate the process doing multiple things at once.

  3. 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

  4. 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.

closed as too broad by Robert Harvey Mar 27 at 19:34

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.