In
computer science, a
thread of execution is the smallest sequence of programmed instructions that can be managed independently by a
scheduler, which is typically a part of the
operating system. The implementation of threads and
processes differs between operating systems, but in most cases a thread is a component of a process. Multiple threads can exist within the same process, executing
concurrently (one starting before others finish) and share resources such as
memory, while different processes do not share these resources. In particular, the threads of a process share its instructions (executable code) and its context (the values of its variables at any given moment).