当前位置:网站首页>Chapter 9 introduction to kernel synchronization
Chapter 9 introduction to kernel synchronization
2022-04-22 03:12:00 【weixin_ forty-five million ninety thousand seven hundred and tw】
The first 9 Chapter Introduction to kernel synchronization
Critical zones and competitive conditions
Critical areas are snippets of code that access and manipulate shared data . It is usually unsafe for multiple threads to access the same resource concurrently , It must be ensured that these operations are atomic . If two execution threads are in a critical area, they may execute at the same time , So this is a bug, Call it a competitive condition (race conditions). Mistakes caused by competition are very difficult to reproduce , So debugging is very difficult . Avoiding concurrency and preventing race conditions is called synchronization (synchronization).
Causes of concurrent execution
User space , The user program will be preempted and rescheduled by the scheduler .
Kernel space , For a similar reason :
- interrupt
- Soft interrupt and tasklet
- Kernel preemption
- Sleep and synchronization with user space
- Symmetric multiprocessing
What data needs to be locked
- overall situation ? Whether other threads can access ?
- Will share in context ? Will it be shared between two different interrupt handlers ?
- Can it be preempted ? Will the scheduled new program access the same data ?
- Will it block some resources , Processing of shared data ?
…
Deadlock
There should be one or more execution threads and one or more resources , Each thread is waiting for one of the resources , But all resources are occupied . But the thread will not release the resources already occupied , A deadlock occurs .
The prevention of :
- Lock in sequence
- Prevent hunger
- Do not repeatedly request the same lock
- The design is simple
Contention and scalability
Lock contention (lock contention), The lock is held frequently or for a long time , Will degrade the performance of the system .
Extensibility (scalability) Is a measure of system scalability .
Lock granularity is used to describe the data scale of lock protection . It is between too large and too small when used .
summary
Protect data from concurrent access !
版权声明
本文为[weixin_ forty-five million ninety thousand seven hundred and tw]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220310424313.html
边栏推荐
- Wordpress blog Building Guide
- Ros2 learning notes (V) -- Summary of common instructions for ros2 command line operation (I)
- [laravel series 4.7] connect redis and cache applications
- Dynatrace grabs the parameter value of any method in the system
- 嘉戎技术深交所上市破发:公司市值41亿 应收账款2.8亿
- How to run collabora office in openshift
- Apple watch theme picture crawl!
- Decomposing temporary variables in code refactoring
- Code refactoring removes the assignment of parameters
- 二十七.包(import)
猜你喜欢
![[wustctf2020] plain](/img/7f/db81436e898dd2e5af08e57a5024bf.png)
[wustctf2020] plain

The original test engineers who were promoted and raised were good at interface testing
![[NCTF2019]Fake XML cookbook](/img/55/b0f996fd1db2792c14444bcba39377.png)
[NCTF2019]Fake XML cookbook

golang依赖注入wire使用 执行wire命令时报错:bash: wire: command not found

二十五.模块/内置模块/模块的安装

go语言实战-----31-----流媒体架构设计之直播架构、音视频通话(常见 流媒体协议 解释)

500错误,提交响应后无法转发

Pytest automated testing framework (2)

Use xamarin to write a beautiful app login and registration interface

使用Xamarin编写一个精美的APP登录注册界面
随机推荐
Source code encryption Product Guide
Word input formula shortcut key
[7:00 pm tonight] discussion on the development and application scenarios of metartc
Allegro gerber文件路径设定
leetcode:297. 二叉树的序列化与反序列化
使用Xamarin编写一个精美的APP登录注册界面
Driverless virtual simulation (14) -- traffic sign recognition in image processing 2
Oracle的联合主键和复合主键创建
Interview with those stereotyped and boring interviewers
kerberos認證協議
【经验】tf1.x迁移到tf2.x教程
Technology sharing | selenium ide use case recording
Sword finger offer special breakthrough version 91. Painting the house
Kerberos authentication protocol
Built in functions 123
go语言实战-----31-----流媒体架构设计之直播架构、音视频通话(常见 流媒体协议 解释)
微信H5支付(报跨域问题)
JS table sorting
Performance test and comparison of oceanbase and MariaDB using dbt-3
Unmanned virtual simulation (XV) -- obstacle detection and recognition 1