Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Concurrency options: Optimistic/Pessimistic/Last-Win

Concurrency options: Optimistic/Pessimistic/Last-Win

Scheduled Pinned Locked Moved C#
questionhtmlcom
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    devvvy
    wrote on last edited by
    #1

    Hi. A philosophical question cooncerning concurrency: Optimistic/Pessimistic/Last-Win I understand the difference among the three options. It's well explained in MSDN: Reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskperformingoptimisticconcurrencychecking.asp But I can't quite relate the three options to real life situations - so, examples welcomed. Anyway, for my experience, "Last-Win", and "Pessimistic", concurrency is sufficient for most circumstances I encountered. When do we need optimistic concurrency? Thanks! norm

    M S 2 Replies Last reply
    0
    • D devvvy

      Hi. A philosophical question cooncerning concurrency: Optimistic/Pessimistic/Last-Win I understand the difference among the three options. It's well explained in MSDN: Reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskperformingoptimisticconcurrencychecking.asp But I can't quite relate the three options to real life situations - so, examples welcomed. Anyway, for my experience, "Last-Win", and "Pessimistic", concurrency is sufficient for most circumstances I encountered. When do we need optimistic concurrency? Thanks! norm

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      If I understand the three correctly: Pessimistic concurrency control - a row is unavailable to users from the time the record is fetched until it is updated in the database. Doesn't this mean that there's an assumption that the record is being fetched so that it can be updated? That would imply that during the time the client is hanging on to the record, nothing else can get done? Or is this referring only to the "fetch-change-put" time of the server, say, when an UPDATE command is executed? And isn't this method not really very usable in situations where the records are fetched and the connection closed? These assumptions would seem to be correct based on what the site says. It's funny they use inventory as an example. I've written an inventory management system that uses optimistic concurrency. The connection is always open, and the only time there's violation is when someone is updating a record that is simultaneously being accessed. This hardly ever happens. 90% or more of the transactions are fetches--part look up, reporting, price lookup, qty look up, etc. Only when a part is received or sold is there a write transaction. It would be impossible for me to run this system in a pessimistic mode, because records are always being fetched on a continuously open connection. And they're being fetched simply for read, not update, purposes. Does that help, or am I misunderstanding something? Marc Latest AAL Article My blog Join my forum!

      1 Reply Last reply
      0
      • D devvvy

        Hi. A philosophical question cooncerning concurrency: Optimistic/Pessimistic/Last-Win I understand the difference among the three options. It's well explained in MSDN: Reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskperformingoptimisticconcurrencychecking.asp But I can't quite relate the three options to real life situations - so, examples welcomed. Anyway, for my experience, "Last-Win", and "Pessimistic", concurrency is sufficient for most circumstances I encountered. When do we need optimistic concurrency? Thanks! norm

        S Offline
        S Offline
        Saikat Sen
        wrote on last edited by
        #3

        How about an airlines telling you that you can get a seat NOW, but then when you actually try it a second later they say someone's already taken it?

        D 1 Reply Last reply
        0
        • S Saikat Sen

          How about an airlines telling you that you can get a seat NOW, but then when you actually try it a second later they say someone's already taken it?

          D Offline
          D Offline
          devvvy
          wrote on last edited by
          #4

          Thanks for the response first of all. Makes sense and I think the concept is beginning to sink in and take hold a little more. Now, responding to saikatsen: "How about an airlines telling you that you can get a seat NOW, but then when you actually try it a second later they say someone's already taken it? " In that case: 1. Check for seat: "Last Win" 2. Book a seat: "pessimistic concurrency" norm

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups