amigan_99
asked on
Python proc vs thread
In python - what is the difference between a process, a child process (that has been forked), the output of a fork-exec and a thread? Actually I get the difference between the first two - (I think) that when forking you wind up with a new process that is a virtual copy of an existing parent process only running separately with a new PID. But I lost the trail when they got into fork-exec and then the thread concept.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OK: atomic operation in computer science means something like
"non interruptable by another thread." so an atomic operation would either not be executed or it wouild be completely executed.
Under no circujmstance it would be possible, that another thread interrupts an atomic operation while 'half'of the work is done.
you can refer to http://en.wikipedia.org/wiki/Atomic_operation
By the way it seems, that my above statement is wrong. some googling seems to indicate, that Python variable assignments are atomic operations.
However commands like
a += 1
a, b = b, a
would not be and modifying several members of an object wouldn't thus normally
Locks should be used in order to avoid, that an object is in an inconsistent state before being accessed by another thread.
"non interruptable by another thread." so an atomic operation would either not be executed or it wouild be completely executed.
Under no circujmstance it would be possible, that another thread interrupts an atomic operation while 'half'of the work is done.
you can refer to http://en.wikipedia.org/wiki/Atomic_operation
By the way it seems, that my above statement is wrong. some googling seems to indicate, that Python variable assignments are atomic operations.
However commands like
a += 1
a, b = b, a
would not be and modifying several members of an object wouldn't thus normally
Locks should be used in order to avoid, that an object is in an inconsistent state before being accessed by another thread.
ASKER
Thank you again very much.
ASKER