diff --git a/doc/source/devref/index.rst b/doc/source/devref/index.rst index 859d4e3313c8..7b12f72a6671 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 000000000000..e499f47e1f9f --- /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 `_ and +`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. + +