title: Global variable on multiprocessing
body: <p>it seems I just cant wrap my head around how this works, I know it might be a stupid question, but I didnt understand how to do that even tho I looked after similar questions, in essence I just want the processes to use the same variable and change its value on the fly, output I am getting is</p>
  <pre><code>carl
  10
  bob
  10
  </code></pre>
  <p>when it should be</p>
  <pre><code>carl
  10
  bob
  5
  </code></pre>
  <pre><code>from multiprocessing import Process, Manager, Value
  import os
  import time
  
  xVal = Value('i', 0)
  xVal.value = 10
  
  def subtract(x):
    xVal.value -= x
  
  def name1(title):
    time.sleep(5)
    x = xVal.value
    print(title)
    print(x)
    subtract(5)
  
  def name2(name):
    time.sleep(10)
    x = xVal.value
    print(name)
    print(x)
  
  if __name__ == '__main__':
      #info('main line')
      d = Process(target=name1, args=('carl',))
      p = Process(target=name2, args=('bob',))
      d.start()
      p.start()
  </code></pre>