Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


What's Multithread Programming?

This topic is 6494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
A thread is a path of execution. In Windows, when you start an application, a thread is started to execute that application''s code. That allows multiple applications to appear to be running at the same time since the OS ''timeslices'' the CPU, switching back and forth between threads very quickly.

They are not ''fast'', and they can be a headache. Generally speaking, you shouldn''t use them unless you have to. Server applications are normally where multithreaded programming is found since multiple threads allow servers to work with more than 1 client at a time.

Share this post

Link to post
Share on other sites
One of the benefits of a multithreaded application is that all threads in the application share the same address space. This makes sharing data between the threads much easier and faster than sharing data between applications in different address spaces. (But global sections can be used to make sharing data between applications relatively easy.)

Another one of the benefits of a multithreaded application is that it can take advantage of a multiprocessor computer.

However, one of the primary reasons you should use a multithreaded application is if your threads can operate mostly independent of each other and are required to wait on resources. (i.e. disk I/O) Even on a single CPU system, multithreading can be a great benefit since while one thread is waiting a resource, the application can still continue executing in another thread. For example, early in development of Windows NT, the programmers realized they could improve the performance of copying files by having one thread doing the reading and another thread doing the writing. This change improved the performance by around 30%.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!