当前位置:网站首页>多线程(简介)
多线程(简介)
2022-08-11 11:54:00 【hqhe260】
并行:多个事件在同一时间发生,
并发:两个或多个事件在同一时间段发生。
单核CPU:只能并发
多盒cpu:并行+并发
线程:线程是进程中一个执行单元,负责当前进程中程序的执行
一个进程至少一个线程,可以有多个线程
什么是线程安全?
既然是线程安全问题,那么毫无疑问,所有的隐患都是在多个线程访问的情况下产生的,也就是我们要确保在多条线程访问的时候,我们的程序还能按照我们预期的行为去执行
有两种创建多线程方法:继承Thread 实现Runable接口
线程同步:两个或两个以上的线程需要共享资源
必须使用某种方法在某一时刻仅被一种线程使用
synchronized
边栏推荐
猜你喜欢
音频分享系统(类听书系统)
Distributed timing task technology selection
From Douyin to Volcano Engine——Seeing the Evolution and Opportunities of Streaming Media Technology
分布式定时任务技术选型
TX12 + ExpressLRS RC configuration and control link problem summary 915 MHZ
【医学统计学】二项分布
[Deep Learning] Note 2 - The accuracy of the model in the test set is greater than that in the training set
Grid 布局介绍
Network Security - nmap
继承和多态的总结
随机推荐
【数学】几何在线画图
EastWave Application: Live Demonstration of Negative Refraction Phenomenon
2022 OceanBase 年度发布会:发布四大策略,迈入4.0时代
公共经济学(开卷)期末复习题
instanceof实现原理
13-盒子模型
HM升压IC芯片代理商
Tool_RE_IDA基础字符串修改
PlutoSDR学习指南【1】环境搭建+资料分享
Five minutes to teach you intranet penetration
After pip installation, there is still ImportError No module named XX problem solved
7月月更开奖啦!快来看看你中奖了吗?
观视界Grandvision EDI项目案例
全网最全的权限系统设计方案(图解)
金九银十面试复习回顾及总结:算法+框架+Redis+分布式+JVM
Jmeter性能测试
[Deep Learning] Summary 1-Two weeks of learning experience
音频分享系统(类听书系统)
【数字赛道命题三】基于复旦微FPGA平台实现H.264视频解码
初始化块(父类优先于子类)