So I've been reading on concurrency and have some questions on the way (my guide - though I'm not sure if its the best source):
  1. Processes vs. Threads: Is the difference basically that a process is the program as a whole while a thread can be a (small) part of a program?
  2. I am not exactly sure why there is a interrupted() method and a InterruptedException. Why should the interrupted() method even be used? It just seems to me that Java just adds an extra layer of indirection.
  3. For synchronization (and specifically about the one in that link), how does adding the synchronize keyword even fix the problem? I mean, if Thread A gives back its incremented c and Thread B gives back the decremented c and store it to some other variable, I am not exactly sure how the problem is solved. I mean this may be answering my own question, but is it supposed to be assumed that after one of the threads return an answer, terminate? And if that is the case, why would adding synchronize make a difference?
  4. I read (from some random PDF) that if you have two Threads start() subsequently, you cannot guarantee that the first thread will occur before the second thread. How would you guarantee it, though?
  5. In synchronization statements, I am not completely sure whats the point of adding synchronized within the method. What is wrong with leaving it out? Is it because one expects both to mutate separately, but to be obtained together? Why not just have the two non-synchronized?
  6. Is volatile just a keyword for variables and is synonymous with synchronized?
  7. In the deadlock problem, how does synchronize even help the situation? What makes this situation different from starting two threads that change a variable?
  8. Moreover, where is the "wait"/lock for the other person to bowBack? I would have thought that bow() was blocked, not bowBack.


I'll stop here because I think if I went any further without these questions answered, I will not be able to understand the later lessons.