当前位置:网站首页>Difference between thread and process
Difference between thread and process
2022-06-22 06:17:00 【Kuxiaoya】
The difference between thread and process :
Threads 、 process , If you can't use one sentence Technology , Not solid !
process : A program ,QQ.exe Music.exe A collection of programs ;
A process can often contain multiple threads , At least one !
Java There are several threads by default ?2 individual Namely : main、GC
Threads : Started a process Typora, Write , Save automatically ( The thread is responsible for )
about Java for :Thread、Runnable、Callable
Java Is it really possible to start threads ? Can't drive
Concurrent 、 The difference between parallelism :
Concurrent programming : Concurrent 、 parallel
Concurrent ( Multithreading the same resource )
- CPU A nucleus , Simulate multiple threads , Fast alternation
parallel ( Many people walk together )
- CPU Multicore , Multiple threads can execute at the same time
How to view how many processors your computer has ( obtain CPU Check the number ):
The first one is :
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-7SBW5xqi-1654846852629)(C:\Users\38492\AppData\Local\Temp\1654784208964.png)]](/img/b4/301abb50ab0d80a38e844910b9be0a.png)
The second kind :
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-sf0PmuMH-1654846852640)(C:\Users\38492\AppData\Local\Temp\1654784242664.png)]](/img/50/58cc32ecd766de7fba67498e2554b0.png)
The third kind of :

The nature of concurrent programming : make the best of CPU Resources for
All companies value it !
Threads have several States
public enum State {
// Freshmen
NEW,
// function
RUNNABLE,
// Blocking
BLOCKED,
// wait for , Dead, etc
WAITING,
// Overtime waiting
TIMED_WAITING,
// End
TERMINATED;
}
wait/sleep difference
1、 From different classes
wait => Object
sleep => Thread
2、 About the release of the lock
wait Can release the lock ,sleep I went to sleep , Sleep with the lock , Don't release !
3、 The scope of use is different
wait Must be in sync block
sleep You can sleep anywhere
4、 Whether you need to catch exceptions
wait No need to catch exceptions
sleep You have to catch exceptions
边栏推荐
- 从入门到精通之专家系统CLIPS(一)CLIPS初识与概述
- 集合类并发不安全问题
- Expert system clips from introduction to mastery (I) introduction and overview of clips
- W800 chip platform enters openharmony backbone
- 八锁问题详解
- e.hash & oldCap == 0 详细解读
- SQL injection vulnerability (XIV) XFF injection attack
- 【NAND文件系统】UBIFS介绍
- Modeling and Simulation of Radar Seeker Servo System
- 上传文件提示 413 Request Entity Too Large 错误
猜你喜欢

Little bear school bearpi HM micro officially integrated into openharmony trunk

W800 chip platform enters openharmony backbone

MYSQL牛客刷题

Usage of trim, ltrim and rtrim functions of Oracle

Design input of Oracle project management system

pip升级难题(已解决)You are using pip version 19.0.3, however version 22.1.2 is available.

reduce_ Reduction in sum()_ indices

Bathymetry along Jamaica coast based on Satellite Sounding

【自己动手写CPU】异常相关指令的实现

关于jinja2 宏定义的小问题
随机推荐
Machine learning concept sorting (no formula)
从入门到精通之专家系统CLIPS(一)CLIPS初识与概述
Design input of Oracle project management system
Swagger common annotation summary
Geoswath plus technology and data acquisition and processing
Current harmonic suppression strategy of grid connected inverter with PIR controller regulator
分页工具类 pageUtil<T>
性能对比分析
On the definition of jinja2 macro
相干声呐GeoSwath的综述
clickhouse对比两台机器数据
R language observation log (part24) -- writexl package
MySQL-IFNULL处理N/A
SQL injection vulnerability (XIV) XFF injection attack
MiniGUl 1.1.0版本引入的新GDI功能和函数(二)
Single cell literature learning (Part2) -- stplus: a reference based method for the exact enhancement of St
Markdown中插入类图(classDiagram)
linux 链接sqlserver,离线安装
单细胞论文记录(part11)--ClusterMap for multi-scale clustering analysis of spatial gene expression
Mail sending function is realized through SMTP protocol and exchange