title: Redis: Race Condition and Single threaded
body: <p>I'm new to Redis and going through Redis in Action book, which elaborate on Race Conditions and different Locking mechanism to avoid it.(There is one dedicated chapter on it).
  But in some of the StackOverflow Posts it is discussed that Redis is Single Threaded.
  The link is as follows :
  <a href="https://stackoverflow.com/questions/17099222/are-redis-operations-on-data-structures-thread-safe?lq=1">Are redis operations on data structures thread safe</a></p>
  
  <p><strong>In the above Link(in one of the answer) it is explicitly written that When command is executing no other command will run.</strong></p>
  
  <p>Now my question is : If Redis is Single Threaded, then why need Locking mechanism at all.</p>
  
  <p>Please clarify on it and let me know if I'm wrong anywhere in my understanding.</p>
  
  <p>Also it follows optimistic Locking mechanism, where multiple threads may try to update the data and if data is modified it will get notified to other threads trying to update at same time(as their update is failed, they can again retry the same operation).</p>