当前位置:网站首页>^25 processes and threads

^25 processes and threads

2022-06-09 04:49:00 sanda_ nd

1、 process : An execution of a program , It has a unique memory space ( Can pass window Task manager Check the process )


2、 Threads

- An independent unit within a process

- A complete process of program execution

- CPU Minimum scheduling unit of


3、 Related content :

- The application must run on a process of a process

- There is at least one running thread in a process : The main thread , Automatically created after the process starts

- Multiple threads can be run simultaneously in a process , We would say that programs are multithreaded

- Data in a process can be shared by multiple threads

- Data between multiple processes cannot be shared directly

- Thread pool : A container that holds multiple thread objects , Realize the reuse of Thread objects


4、 Related issues :

- What is multiprocessing and multithreading ?

                    many process : A program can start multiple instances to run at the same time

                    many Threads : In a process , There are multiple threads running at the same time

- Compare single and multithreaded ?

                    single Threads :( advantage : Sequential programming is easy to understand )( shortcoming : Low efficiency )

                    many Threads :( advantage : Can effectively improve CPU Utilization ratio )( shortcoming : Creating multithreading overhead 、 Switching overhead between threads 、 Deadlock and state synchronization )

- JS Single thread or multi thread ?

                    JS It's single threaded

                    But use HTML5 Medium Web Worker It can be multithreaded

- Is the browser running single threaded or multi-threaded ?

                    All are many Thread running

- Is the browser running in a single process or multiple processes ?

                    There are plenty of them single process , There are plenty of them many process


原网站

版权声明
本文为[sanda_ nd]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206090448578779.html