Updated rst docs to include threading model.

Change-Id: Id12cd6584dfd22fe32097cfddf0247c0cc115ac0
This commit is contained in:
Lorin Hochstein
2011-11-02 10:50:54 -04:00
parent d3e0cfcc7f
commit 743b36dcac
2 changed files with 18 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ Background Concepts for Nova
.. toctree::
:maxdepth: 3
threading
distributed_scheduler
multinic
zone

View File

@@ -0,0 +1,17 @@
Threading model
===============
All OpenStack services use *green thread* model of threading, implemented
through using the Python `eventlet <http://eventlet.net/>`_ and
`greenlet <http://packages.python.org/greenlet/>`_ libraries.
Green threads use a cooperative model of threading: thread context
switches can only occur when specific eventlet or greenlet library calls are
made (e.g., sleep, certain I/O calls). From the operating system's point of
view, each OpenStack service runs in a single thread.
The use of green threads reduces the likelihood of race conditions, but does
not completely eliminate them. In some cases, you may need to use the
``@utils.synchronized(...)`` decorator to avoid races.