API Guide > Multithreading plug-ins >

# Threads

This following describes the lowest level threading concepts. An understanding of these concepts is essential for any developer working with threaded code.

## What is a thread?

A thread is a new execution space, created and managed by the operating system, which contains the following resources that are private to the thread:

- A new stack
- A copy of the processor registers
- An instruction pointer to the first instruction to be executed.

Threads do not duplicate the following resources, which remain process global and visible to all threads:

- Code
- Data created prior to thread launch

## OS-specific threading libraries

These are the lowest level threading implementations available to a user on an operating system. Maya uses the following threading libraries:

- Windows: Win32 threads
- Linux: pthreads
- Mac OS X: pthreads

## Thread management

Thread creation is a relatively expensive operation; therefore, it is often useful to create threads at the beginning of an application and keep them alive but sleeping in a thread pool. Threads can be activated, run and put back to sleep in the pool at a much lower overhead than continually creating new threads when required.

## Thread properties

Individual threads have properties that can be controlled by the user. For example, thread priority determines how a thread is scheduled by the OS. A thread with higher priority will be given preference by the OS scheduler.

Thread affinity defines what physical processor the thread runs on. Sometimes it might be useful to bind a thread to a core so behavior is more deterministic. However, usually OS providers recommend allowing the OS to manage processor affinity rather than have the user do so.