Race Condition
✅ Race Condition
when several processes need shared resource at the same time, can affect the result value
when accessed at concurrent time, data integrity ⬇️
- several process attempt shared resource
- timing, order can affect result
✅ When Race Condition occurs
1. Interrupt while kernel
- using data in kernel mode
- interrupt
- alter data
- global variable in kernel is shared resource
prone to race condition
- 💊 while working in kernel mode, disable interrupt
- interrupt cannot take CPU control
2. System call
- process makes system call
- enter kernel mode
context switching occurs
- Process 1 in kernel mode, modifying data
- CPU timeout
CPU control goes over to Process 2
- 💊 If process is working in kernel mode, even if timeout, CPU control should not go over to next process
3. Multi Process environment, while accessing shared memory kernel data
- In multi processing environment
two CPUs enter kernel for shared data, alter data
- 💊 lock data when shared data is accessed
This post is licensed under CC BY 4.0 by the author.