Results 1 to 5 of 5

Thread: interview question on deal lock

  1. #1
    Join Date
    Jul 2003
    Posts
    421

    interview question on deal lock

    Hi all,
    Today , I wan to interview, one of the questions is
    ho wto schedule can avoid dead lock.
    1) a read lock on tabe T
    2) opear a read lock on table T
    3) write lock on table T
    4) operate a write lock on table T

    for my understand deal lock is two process, 1)lock table a , 2)also lock a, 1) wait 2 to release lock inorder to finish the job. and 2 wait 1 to realease to lock to finish his job. do read and write will has any deal lock.

    how shoul dI answer this question?
    Thnak you
    ________
    Starcraft ii replays
    Last edited by sql; 03-06-2011 at 01:51 AM.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    In SQL Server read and write can get into deadlock. A read puts shared lock on a row during select (or during the whole transaction if serializable isolation level is used)

  3. #3
    Join Date
    Sep 2002
    Posts
    5,938
    And deadlock can happen when two processes put lock on different tables that involved in both processes.

  4. #4
    Join Date
    Jul 2003
    Posts
    421
    Hi, thank you . How to set aschedule to avoid deal lock.

  5. #5
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You make sure that conflicting locks do not happen at the same time. So if you have batch jobs run them in the middle of the night when there are no online activities.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •