The relationship between processes and threads (1)

Suddenly want to talk about my initial understanding of processes and threads

process:

A process is the basic unit of resource allocation by the operating system

A process is a resource allocated by the operating system for the execution of an application

A process is a container, and the operating system completes various functions in the application process by running the threads in the process container

for example:

For example, after the desktop icon is double-clicked, the application starts running.

Notice:

The creation of a process needs to consume computer resources, and the destruction means releasing resources

When many processes are executed at the same time, the consumption of computer resources is large and the execution efficiency is low

thread:

Thread is the smallest unit of execution and scheduling by the operating system

Threads exist depending on processes, that is, threads and processes are dependencies

Every process has at least one thread, this thread is the main thread

for example:

After the listening software is running, the function of starting to play music is a thread, that is, the thread of playing music

Downloading music is another thread. At this time, the music listening software corresponds to one process, two threads,

After running this way, you can download music and listen to songs at the same time

Summarize:

The operating system must first allocate resources to the application software and create a process before it can execute and schedule the application

In short, the operating system creates processes before executing threads

The above is a personal talk about the relationship between processes and threads, I hope it can help everyone

Guess you like

Origin blog.csdn.net/Ai1114/article/details/125256776