diff options
-rw-r--r-- | doc/source/devref/index.rst | 1 | ||||
-rw-r--r-- | doc/source/devref/threading.rst | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/doc/source/devref/index.rst b/doc/source/devref/index.rst index 859d4e331..7b12f72a6 100644 --- a/doc/source/devref/index.rst +++ b/doc/source/devref/index.rst @@ -35,6 +35,7 @@ Background Concepts for Nova .. toctree:: :maxdepth: 3 + threading distributed_scheduler multinic zone diff --git a/doc/source/devref/threading.rst b/doc/source/devref/threading.rst new file mode 100644 index 000000000..e499f47e1 --- /dev/null +++ b/doc/source/devref/threading.rst @@ -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. + + |