Home * Programming * Thread
200px-Multithreaded_process.svg.png

A Thread is the smallest unit of processing that can be scheduled by an operating system. One or multiple threads can exist within the same process to share its resources such as memory. Modern operating systems support both time-sliced and multiprocessor threading within a process scheduler. Some operating systems such as Windows distinguish worker threads from GUI-threads, which incorporate a message loop, able to receive messages from worker threads. Threads share global data of the process, but use disjoint stacks for local variables.

Chess programs using threads for a parallel search have to deal with synchronization issues, if multiple threads read and write none atomic global data simultaneously, requiring multiple read and/or write cycles. A good step to make a program thread safe, is to avoid global variables and to keep board and game states as locals on the stack. To minimize context switching, chess programs often implement a thread pooling pattern along with explicitly or implicitly controlling processor affinity, where the number of threads of the chess program is less or equal to the number of physical processor cores. Threads are further versatile to control standard input inside an engine.
Two threads on a single processor [1]

See also


Publications

1994 ...

2000 ...

2010 ...


Forum Posts

1999

2000 ...

2005 ...

2010 ...

2011
2012
2013
2014

2015 ...

2016

External Links

Thread

Multithreading

Posix

Windows

C++

Java

GPU


References

  1. ^ Thread (computing) from Wikipedia
  2. ^ Re: lazy smp using ms vs2015 c++11 std::async by Jon Dart, CCC, July 31, 2016
  3. ^ Information on the C++11 Memory Model by Scott Meyers, April 24, 2012
  4. ^ Georg Hager's Blog | Random thoughts on High Performance Computing
  5. ^ TinyThread++ - Portable thread library for C++
  6. ^ std::async - cppreference.com
  7. ^ pthread-win32_x64.zip - libusb-winusb-wip
  8. ^ TinyThread++ by Alberto Sanjuan, CCC, July 24, 2014

What links here?


Up one Level