Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a multithreaded application?

I am looking to learn more about threading and I wanted to know: what is a multithreaded application?

like image 799
Frank Avatar asked Aug 21 '09 16:08

Frank


People also ask

What is an example of a multithreaded application?

Another example of a multithreaded program that we are all familiar with is a word processor. While you are typing, multiple threads are used to display your document, asynchronously check the spelling and grammar of your document, generate a PDF version of the document.

How do you know if an application is multithreaded?

In taskmanager, right-click the game process and set the affinity to one core. Play a little ingame and check your fps. Then change affinity to two cores, if your fps increases then the game is (properly) multithreaded.

What is multithreading in operating system with example?

Example: Playing a video and downloading it at the same time is an example of multithreading. As we have two types of thread i.e. user-level thread and kernel-level thread. So, for these threads to function together there must exist a relationship between them.

What is multithreaded programming process?

In a multithreaded process on a single processor, the processor can switch execution resources between threads, resulting in concurrent execution. Concurrency indicates that more than one thread is making progress, but the threads are not actually running simultaneously.


1 Answers

Multithreading as a widespread programming and execution model allows multiple threads to exist within the context of a single process. These threads share the process' resources but are able to execute independently. The threaded programming model provides developers with a useful abstraction of concurrent execution. However, perhaps the most interesting application of the technology is when it is applied to a single process to enable parallel execution on a multiprocessor system.

That means that a single process can have many different "functions" executing concurrently, allowing the application to better use the available hardware (multiple cores/processors). Threads can communicate between them (they have shared memory), but its a hard problem to have every thread behave well with others when accesing shared objects/memory.

Threading allows an application to remain responsive, without the use of a catch all application loop, when doing lengthy operations.

For example, a non threaded copy program wouldn't allow you to do anything until the copy completes.

Threading helps with complex, lenghty, independent problems, but brings along a lot more complexity, that makes it hard even for seasoned developers.

like image 166
Esteban Küber Avatar answered Oct 16 '22 11:10

Esteban Küber