HardwareHeaven.com

HardwareHeaven.com

Looking for the skin chooser?
 
 
  • Home

  • Hardware reviews

  • Articles

  • News

  • Tools

  • Gaming at HardwareHeaven

  • Forums

 

Go Back   HardwareHeaven.com > Forums > Software / Tools > Programming, Coding, (Web)Design


Programming, Coding, (Web)Design Discuss all your programming or design needs with likeminded people.

Reply
 
Thread Tools
Old Oct 5, 2003, 05:55 AM   #1
DriverHeaven Lover
 
Join Date: May 2003
Posts: 200
Rep Power: 0
Jincuteguy is on a distinguished road

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.
Jincuteguy is offline   Reply With Quote


Old Oct 6, 2003, 11:16 AM   #2
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

??? 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
UberLord is offline   Reply With Quote
Old Oct 6, 2003, 04:33 PM Threadstarter Thread Starter   #3
DriverHeaven Lover
 
Join Date: May 2003
Posts: 200
Rep Power: 0
Jincuteguy is on a distinguished road

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
Jincuteguy is offline   Reply With Quote
Old Oct 6, 2003, 06:01 PM   #4
A Legend in Underwear
 
UberLord's Avatar
 
Join Date: May 2002
Location: Unknown
Posts: 5,255
Rep Power: 0
UberLord will become famous soon enough

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
UberLord is offline   Reply With Quote
Reply

Thread Tools