[LINUX] (Beginner) What are cores and threads?

Origin

I'm using jobs, tasks, cores, threads, etc., but I don't really understand the relationship between them.

No matter how much I am not a specialist in computers, what happened as a person studying informatics, so I summarized it briefly.

Conclusion

-** Threads, processes, jobs, tasks ** are ** concepts ** and components of the program itself --A process is the execution unit of a program, that is, ** the largest group of programs ** --Thread ⊂ Process --Jobs and tasks seem to be ** ambiguous ** -** Processor, core, CPU ** are ** physically present ** PC components --Processor = CPU --Core ⊂ CPU

In detail

Processes and threads

This is the easiest to understand. One or more threads are created in one process.

The process is the parent and the thread is the child.

Jobs and tasks

How it is used varies depending on the environment, and it seems that it is often ** ambiguous **. Was good. I used it properly, but it wasn't a mistake.

For the time being, if it is a Linux system, --A job is a collection of multiple processes --Task is a general term for processes and threads

It seems.

Processor, core and CPU

The composition that ** CPU (= processor) ** contains ** parts (core) ** that actually perform processing.

In reality, the core is recognized as a CPU and processes and threads are assigned.

[Question] Is the CPU with 6 cores and 12 threads 2 threads per core?

To be honest, I didn't understand this area well, so I looked it up. The answer is No.

Since the core is the place where processes and threads are ** processed **, which thread is assigned to the core is a story after the process or thread is created.

So, first of all, it seems correct that the upper limit of threads that can be run in parallel is 12, and there are 6 cores to allocate it.

In other words. If the thread limit is 12, the process limit will inevitably be 12.

For example, if you use all 12 threads in 3 processes, you can think of an allocation method like this.

Process name Number of threads Example 1 Number of threads Example 2
A 4 6
B 4 4
C 4 2

Reference

  1. [Illustration] Differences / relationships between CPU cores, threads, and processes, simultaneous multithreading, and context switching
  2. Organize processes, threads, fibers, tasks, jobs, differences
  3. Differences between processes and threads-and tasks and jobs-

Recommended Posts

(Beginner) What are cores and threads?
What are "sudo ln -s" and "ln -s"?
[Python] What are @classmethods and decorators?
What are go mod, go get and go mod vendors?
What are Linux POSIX options and GNU options?
Training data and test data (What are X_train and y_train?) ①
Training data and test data (What are X_train and y_train?) ②
[Mathematics] Let's visualize what are eigenvalues and eigenvectors
What are you comparing with Python is and ==?
What are python tuples and * args after all?
What are environment variables?
What are environment variables? (Linux)
[Python] Python and security-① What is Python?
What are the directories such as Linux, / etc and / var / log?