|
|||||||
| Programming, Coding, (Web)Design Discuss all your programming or design needs with likeminded people. |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
DriverHeaven Lover
Join Date: May 2003
Posts: 200
Rep Power: 0 ![]() |
Real world situation that use threads could lead to a race condition?
Could anyone give me an example of a real world situation where the use of threads could lead to a race condition? thx.
|
|
|
|
|
|
#2 |
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
??? There never can be a RW situation that leads to a race condition as racing is always a bug.
What I think you mean is what causes a race condition? Well, that all depends on the software, but a race is when two threads/processes compete for the same resource
__________________
Gentoo Linux - Developer (baselayout) Read my blog "I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." Stephen Roberts |
|
|
|
|
|
|
|
DriverHeaven Lover
Join Date: May 2003
Posts: 200
Rep Power: 0 ![]() |
iim asking for a real world situation that uses threads that "might" (even though it's already implemented the safety) lead to a race condition
|
|
|
|
|
|
#4 |
|
A Legend in Underwear
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0 ![]() |
OK
A threaded application implements it's save and load settings functions in seperate threads. The user tells the application to save settings to a floppy. Some applications (mine included) automatically reload settings after saving them. Depending on how this is implemented it may cause the threads to race as the "save" thread is saving to the floppy and the "load" thread is trying to read the same bit. Crappy example, but there you go
__________________
Gentoo Linux - Developer (baselayout) Read my blog "I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." Stephen Roberts |
|
|
|
![]() |
| Thread Tools | |
|
|