• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

thread and deadlock

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having trouble with threading model. I dont understand the difference between deadlock and when thread stop executing. What are condition which stop thread executing?
Pervez
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A thread normally stops executing when it has completed what it set out to do. When a thread has finished like this it is in a dead state.
Deadlock stops a thread from executing. For example if a thread blocks beacuse it is waiting for a condition, and something else in the program makes it impossible for the condition to arise, then the thread is said to be deadlocked. In this case the state if the thread is not dead because it has not completed it's execution, rather it is constantly waiting for something that will never happen.
I hope this explains it a little.
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I 'd rather give practical example.
Say, me and you are two threads. we want to decide upon a meeting time but everyone of us sticks to the idea that the other will start suggesting venue and time for the meeting. we are in deadlock!!! but if we being practical decide upon to resolve the initiating issue then we will be able to arrange some venue and time for the meeting.
in deadlock, none finishes the COMPLETE execution and still none can proceed further due to the problem that persist,
in stop state, everbody has COMPLETED the full execution.
-regards,
maulin
 
reply
    Bookmark Topic Watch Topic
  • New Topic