当前位置:网站首页>Advanced API (multithreading)
Advanced API (multithreading)
2022-07-03 07:01:00 【Bugxiu_ fu】
Not all programming languages support multithreading
Multithreading is actually equivalent to a robot ( Automatically handle things )
A few key words
1. multitasking
Self righteous to deal with multiple things at the same time
2. Program
Still , Example ---QQ installation is complete
3. process
Dynamic , When the program is opened by double clicking , The process will appear .
4. Threads
A thread is an execution unit path in a process .( The process of doing something )
summary :
A program has one or more processes
A process has at least one thread or multiple threads .
Program closed --- The process will shut down
Thread shutdown --- The process will not shut down
1. One Java The program has at least 2 Threads Customize
(1) The main thread --- effect --- Perform the operation
(2)gc Threads --- effect --- Recycling waste
The core of multithreading : Automatically complete things .
Multithreading comes from lang package
Multithreaded objects :Thread
stay Java There are ways to implement multithreading in the program 2 Kind of
1. Inherit Thread
rewrite run Method
Custom thread inheritance Thread after , If you want to implement some operations -- Must be in the run Method to perform these so-called operations .
2. Realization Runnable Interface
Custom class implementation Runnable Interface must override all abstract methods in the interface
implements Runnable{
@Override
public void run() {
for (int i = 0; i < 100; i++) {
System.out.println(i+"---- Custom thread "+Thread.currentThread().getName());
}
}
matters needing attention : If the thread is implemented Runnable Interface To open, you must use Thread Class call start.
MyF mf = new MyF();
Thread t = new Thread(mf);
t.setPriority(10);// Priority
t.start();// Start the custom thread manually
边栏推荐
- 如何迁移或复制VMware虚拟机系统
- 这两种驱蚊成份对宝宝有害,有宝宝的家庭,选购驱蚊产品要注意
- Stream stream
- [vscode - vehicle plug-in reports an error] cannot find module 'xxx' or its corresponding type declarations Vetur(2307)
- How can the server set up multiple interfaces and install IIS? Tiantian gives you the answer!
- My 2020 summary "don't love the past, indulge in moving forward"
- crontab定时任务
- Book recommendation~
- 10000小时定律不会让你成为编程大师,但至少是个好的起点
- Golang operation redis: write and read hash type data
猜你喜欢

IC_EDA_ALL虚拟机(丰富版):questasim、vivado、vcs、verdi、dc、pt、spyglass、icc2、synplify、INCISIVE、IC617、MMSIM、工艺库

如何迁移或复制VMware虚拟机系统

2022-06-23 VGMP-OSPF-域間安全策略-NAT策略(更新中)

机器学习 | 简单但是能提升模型效果的特征标准化方法(RobustScaler、MinMaxScaler、StandardScaler 比较和解析)

Inno Setup 制作安装包

golang操作redis:写入、读取kv数据

Golang operation redis: write and read kV data

Journal quotidien des questions (11)

Software testing learning - day 3
![[set theory] partition (partition | partition example | partition and equivalence relationship)](/img/f0/c3c82de52d563f3b81d731ba74e3a2.jpg)
[set theory] partition (partition | partition example | partition and equivalence relationship)
随机推荐
The dynamic analysis and calculation of expressions are really delicious for flee
Jmeter+influxdb+grafana of performance tools to create visual real-time monitoring of pressure measurement -- problem record
Specified interval inversion in the linked list
Integration test practice (1) theoretical basis
Class and object summary
Reading notes of "learn to ask questions"
Shim and Polyfill in [concept collection]
HMS core helps baby bus show high-quality children's digital content to global developers
熊市里的大机构压力倍增,灰度、Tether、微策略等巨鲸会不会成为'巨雷'?
Thoughts in Starbucks
The education of a value investor
golang操作redis:写入、读取hash类型数据
In depth analysis of reentrantlock fair lock and unfair lock source code implementation
Software testing assignment - the next day
centos php7.2.24升级到php7.3
JS date comparison
UTC time, GMT time, CST time
Gridome + strapi + vercel + PM2 deployment case of [static site (3)]
The 10000 hour rule won't make you a master programmer, but at least it's a good starting point
IC_ EDA_ All virtual machine (rich Edition): questasim, vivado, VCs, Verdi, DC, Pt, spyglass, icc2, synthesize, innovative, ic617, mmsim, process library