Re: Multi threading with ODBC



If you're getting deadlocks, then it probably is an architecture
thing. This happens when two different processes are contending for
the same resource in order to complete a transaction, so one process
is arbitrarily picked as a deadlock victim. When coding your
transactions, make sure you're accessing resources in the same order.
For example, process 1 locks table A and needs B, and process 2 locks
B and needs A. If both processes access A first and then B, the second
process just goes into the wait queue until the first process
completes, which is usually in sub-second response time, unless you've
committed other transactional sins such as using pessimistic locking
or cursors.

--Mary

On Tue, 8 Aug 2006 06:21:26 -0700, Munish
<Munish@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I am writing a multi threaded Client Server application. I have written a dll
in .Net to perform the database related operations. I am using connection
pooling. Now I have a function in the database dll. When multiple threads
enter in that function , I am getting the imporper results.

So , I thought of using transactions in that particualr function. But it is
causing the deadlock in the application.

Can anyone help me ? Is my desgin/architecture wrong > or there is something
else i m missing >

Regards
.



Relevant Pages

  • Re: How to programmatically avoid deadlock?
    ... before the wait for the 'other' resource is resolved. ... splitting computation in a vat into "turns" which occur in response to ... versatile parallel programming technique helps me to ... understand that deadlock situation is fully natural, ...
    (comp.programming.threads)
  • Re: Deadlock im Recht
    ... Schön, mal wieder davon zu hören, kenn ich noch aus den Vorlesungen. ... Deadlock: ... Conditions for Resource Deadlock ... At most 1 KLT is in its CS ...
    (de.soc.recht.misc)
  • Re: lock/ deadlock questions
    ... example, the normal Share to Exclusive lock conversion will happen, if the ... a deadlock could be avoided: ... This assumes you have autocommit transactions turned on. ... If you have implicit transactions on (see SET IMPLICIT_TRANSACTIONS in BOL), a transaction is automatically started for you on the first statement. ...
    (microsoft.public.sqlserver.server)
  • Re: Theoretical Basis for SELECT FOR UPDATE
    ... > Roy Hann wrote: ... >> crystal clear, linear code can deadlock. ... > author, have no clue where you transactions start and end, and what ... that you do not know how to structure SQL ...
    (comp.databases.theory)
  • Re: Prevents Events From Interrupting Events
    ... But since that's pretty obvious and since you're still asking the question, I'm assuming you don't have complete control over the events. ... it cannot move and I get a deadlock. ... then you also need to design your architecture so that you don't have one thread trying to get a resource another already has while that other thread is trying to get the resource the first thread already has. ... The delegate type does in fact make this potentially easier, since you can either create your own queue of delegates with an object array for the parameters and process it yourself, or take advantage of the Control.BeginInvokemethod to queue execution of delegates on a very specific thread. ...
    (microsoft.public.dotnet.languages.csharp)