title: Async tasks and locks
body: <p>I have a list of elements that should be updated by two processes. First one is the UI thread (controlled by the user), second one is a background process that retrieves information from a web service.</p>
  
  <p>Since this second process is I/O bound, it seems suitable for async tasks. This leads me to a few questions:</p>
  
  <ol>
  <li><p>Since async tasks don't run on separate threads, it seems I don't need any kind of lock when updating this list, right?</p></li>
  <li><p>On the other hand, can we assume that async tasks will never run on separate threads?</p></li>
  <li><p>I'm talking about a Windows Forms application. Maybe in the future I want it to run it as a console application. AFAIK, in console applications Async tasks run on separate threads. What's the preferred idiom to ask a task if it's running on a separate thread? This way I can establish a lock when necessary.</p></li>
  <li><p>The fact that I don't know if I really need a lock makes me wonder wether this is the best design or not. Would it make sense to stick to <code>Task.Run()</code> even for this kind of IO bound code?</p></li>
  </ol>