Most voted "multithreading" questions
Multithreading is a popular programming model that allows multiple line execution within a simple context, sharing process resources, and capable of running independently.
Learn more…199 questions
Sort by count of
-
124
votes8
answers5920
viewsIs it always guaranteed that a multi-threaded application runs faster than using a single thread?
It is possible to observe in some cases that the separation of tasks into multiple threads does not give gain and even makes an application slower than the use in thread unique. It should not always…
competition performance multithreading parallelism optimizingasked 10 years, 10 months ago Maniero 444,682 -
31
votes1
answer5828
viewsDifference between Task and Thread
I need to create an executable c# and the question was: Do with thread or do with task? In practice there is some difference between using Task and the "traditional" multi-thread?? It is true that a…
-
31
votes2
answers1602
viewsWhat is Inter Process Communication (IPC)?
In a discussion with experienced programmers here on the site regarding competition control, the terms arose traffic lights, mutex, shared memory, monitor, and still others, which I’m beginning to…
-
29
votes3
answers19104
viewsUnderstanding threads in C#
I’m trying to figure out how to use Tasks and asynchronous methods in C#, but every place I see about it in internet mentions a "usual multithreading" form that would be different from the use of…
-
23
votes3
answers2439
viewsWhat is the real advantage of using a Callback and what is thread/multithread?
There is a lot of explanation of what callback is on the net and even a few scant examples, but nothing that explains in practice and in detail a really important use (I did not find). I already…
-
20
votes3
answers2015
viewsWhat is the difference between async, multithreading, parallelism and competition?
What is the difference between async, multithreading, etc..? They depend on the amount of processor cores? If I do a program in Visual Basic and open 33 instances of it, would it be running in…
-
16
votes4
answers724
viewsJava: When to use Interrupt vs flags?
To indicate to a thread that it must "interrupt" its work Java provides a mechanism known as Interrupts: public void run() { while(!Thread.interrupted()) { // Fazer algo } } // para interromper…
-
12
votes2
answers235
viewsHow to avoid an Illegalstateexception: The content of the Adapter has changed but Listview Did not receive a notification?
I have a Activity that displays a ListView, to which a Adapter "backed by" a ArrayList global. If I add an element to that ArrayList, ideal is to do it in the main thread and immediately call…
-
10
votes5
answers2656
viewsHow to manage a Sqlite connection between multiple simultaneous threads?
So I’m facing some problems with my Sqlite connection, where I’m not finding a skilled solution. Setting My scenario is this:: I synchronize the data of my application with a legacy system, through…
-
10
votes2
answers932
viewsBest practices when working with Multithread
Is the pseudo-code below following the good practices for an asynchronous code? It should: Synchronously start several tasks; After starting tasks, wait for all tasks to complete a post-processing;…
-
9
votes2
answers1921
viewsAsync operations on ASP.NET
When it is advantageous to use asynchronous operations in an application ASP.NET (classic, MVC, MVC Web API)? When do I use the ThreadPool to perform some operations may be useful?…
-
9
votes1
answer519
viewsSynchronized in static methods, and in nonstatic methods
If I have a class, where I have two methods one static and the other not. Is the lock the same or not? How to do for the two sharing methods, the same synchronization mechanism, ie the same lock?…
-
9
votes1
answer388
viewsThread control to avoid lock
I’m starting a Crawler and his idea is to download all the content of a given website. It already has some "usable" features. What’s killing me is, I’m doing it multithreaded, but the threads in a…
-
9
votes2
answers1801
viewsAsync/Await with threads (C# 7.2)
I have this code and as you can see I created two examples, Parallel and Notparallel. I expected both to return me 3000ms, because both should run async (2000 and 3000) and the total time would be…
-
8
votes2
answers1879
viewsWhat are the differences between background and foreground threads?
What are the differences between these two types of threads: background and foreground?
-
8
votes6
answers1481
viewsLog system losing data, how to use Threads?
Currently I have a medium level system where I need to record detailed log of everything that happens in the system, the Company that is divided into Departments does audit of everything that…
-
8
votes1
answer517
viewsParallelize python Odd-Even Sort sorting algorithm
I have developed the following serial code to perform the Odd-Even Sort sorting, which first sorts even/odd and then odd/even. import time def oddevenSort(x): sorted = False while not sorted: sorted…
-
8
votes0
answers77
viewsWhat is a Memory Model?
Reading the Wikipedia article in English discovered that Java was the first popular language to have a memory model in the presence of well-defined threads, followed by C++11. Reading the article in…
-
7
votes1
answer135
viewsUse of Waitall in C#
I have the following problem: A program generates two types of A and B threads through clicks on their respective buttons. The two types cannot run at the same time. If I have 10 A threads, B can…
-
7
votes2
answers1244
viewsHow to employ multithreading with Rduino
I’m making a bell with Andy. This bell shall be composed of: 01 Arduino UNO, 01 Buzzer, 01 Transmitter 433 Mhz, 01 Receptor 433 Mhz. My doubt revolves around how I can treat the listener who will be…
-
7
votes1
answer589
viewsModify visual element by another thread
I want to define by a Thread the content in a Richtextbox but I get an error saying Cannot make calls from another thread distinguished from the same Textbox I have heard that it is possible to use…
-
7
votes2
answers5722
viewsWhat is the difference between Wait() and Sleep()?
The meaning of the two words seems very similar. What’s the difference between wait() and sleep()? When to use each?
-
7
votes1
answer480
viewsSleepy barber problem with traffic lights
I found this code online while studying and I couldn’t understand two things: What the traffic light "seatbelt" does? Why isn’t the barber checking the waiting room after finishing a cut? (It goes…
-
6
votes2
answers257
viewsAsynctask x Multithreading
When it is most advantageous to use Asynctask, and when to use Threads. For example: Download a file (e.g., JSON). Which would be more advantageous in this case and why??…
-
6
votes1
answer374
viewsThreads running problem, using flags
I am having some problems in the complete understanding of the code because I am new to using java in thread. What code will do is control the flow, doing 55 iterations dividing between the thread…
-
6
votes1
answer1253
viewsThread Control in Java
I have a multi thread Java system that uses the class ThreadGroup which is deprecated. With my current implementation I can’t "kill" a thread in lock either. How to implement efficient code for…
-
6
votes1
answer226
viewsWhy a loop FOR faster than 10 FOR together
I made a for alone count up to 1000000 (sending 1 message each loop) and it took 14 seconds. public class main { public static void main(String[] args) throws InterruptedException { long init =…
-
6
votes3
answers3964
viewsWhat is Threadpool all about?
I’m studying Threads in Java, and came across the following code: ExecutorService threadPool = Executors.newFixedThreadPool(10); for (int i = 0; i < 10; i++) threadPool.submit(new…
-
6
votes1
answer360
viewsC# Parallel.Foreach Javascript equivalent
I’m trying to write methods with behavior similar to Array.prototype.forEach and the Array.prototype.map, but using multiple threads. In the case of Array.prototype.parallelMap, I did the following:…
-
6
votes2
answers202
viewsWhy do we pass an object to the statement lock?
I’m working with multithreading and fell in a competition case. More than one thread accessed an I/O operation on the same file and so an exception was triggered. To solve the problem, I did so:…
-
6
votes1
answer144
viewsWhat is the Join() function for in the threading module?
I’ve seen the function join() for the module threading, but I didn’t quite understand what she does.
-
6
votes1
answer342
viewsDifference in thread execution in Java
See the execution of two similar programs in Java. One inherits from Thread and another implements the interface Runnable: Program1: public class PingPong extends Thread{ private String msg; private…
-
5
votes4
answers2064
viewsWhat are the main differences between Handler, Thread and Asynctask?
The Android documentation can end up being a little confusing for those who are starting to understand better what are the differences between a Handler, one Thread and a AsyncTask. Handlers sane…
-
5
votes2
answers718
viewsWhat is the most threads supported by Java EE?
I’m analyzing how to rewrite the architecture of a Java program I’d like to know how many threads the scheduler (Scheduler) supports? or how can I infer this amount based on the processing power of…
-
5
votes1
answer349
viewsDoes Task.Run always start a new Thread?
When executing a list of tasks initiated through Task.Run, it is ensured that each one is executed in a different Thread? When reading the documentation, it seems to me that this is the default…
-
5
votes2
answers651
viewsDifference is between Backgroundworker and Task.Run()?
Usually when I had to do some operation on background, mainly involving progress bar update or Labels I used to use the BackgroundWorker, with your events WorkerReportsProgressand DoWork. I recently…
-
5
votes2
answers1906
viewsawait Task.Whenall how to run multiple processes?
I am trying to create several task (async) they will perform the following logic: Parse an Html based on a received url with Htmlagilitypack Return a product model after parse Insert the Product…
-
5
votes1
answer1242
viewsAre there differences between the terms Thread, Multithread, Async and Await?
I asked that question here at Stack Ooverflow: What is the solution for asynchronous PHP processes? I did it because I wanted that in the middle of a process execution, I wanted to have a certain…
terminology thread multithreading async asynchronousasked 7 years, 5 months ago Wallace Maxters 102,340 -
5
votes2
answers960
viewsHow to make a Scheduledexecutorservice launch a new task while the previous one has not yet finished?
I am implementing a Scheduler to run some threads on my system at x time intervals. The big problem is that if thread 1 has not yet finished running, 2 does not start, even though its time has come.…
-
5
votes1
answer456
viewsUsing C# Threads for the First Time
I’m trying to make use of C# Threads for the first time, I’m a beginner in the subject, so I’m sorry for the question if it’s too basic. I am using the code below to use such procedure: private…
-
5
votes1
answer351
viewsSecondary thread on flutter
Hello, I have the following problem in flutter: I currently have an application with the plugin flutter_background_geolocation based on the example that is provided by the plugin. While performing…
-
4
votes1
answer2247
viewsHow to stop a Thread for a certain time without using a Timer?
Explanation: Next, I have a TThread running parallel to Main Thread. And I have a routine to give fade image. Well, the important thing is that I realize this fade in a given time in milliseconds,…
-
4
votes1
answer616
viewsThread problem
public class ThreadTest implements Runnable { private String word; private long time; public ThreadTest(String word,long time){ this.word = word; this.time = time; } public void run() { try {…
-
4
votes1
answer747
viewsHow to implement a process queue in Delphi 6?
How to implement a process queue in Delphi 6 as the TThread.Queue of the newer versions? What I need is to implement a queue for recording logs with Delphi 6. In the newer versions I have the…
-
4
votes1
answer876
viewsEncapsulate Tclientsocket connections in Multithreads
I have a variable number X of electronic equipment (Weather stations) in my local network, each equipment provides a Serversocket connection with an IP and a specific Port, I have an application…
-
4
votes1
answer614
viewsSeeking Active Threads
I have the following problem, where I have one for() that opens 17 threads and needs to recover, in another thread ( 18ª ) the active threads that I opened earlier and verify which of the 17 are…
-
4
votes1
answer149
viewsCustomers do not communicate in the same multiplayer game in Java
I’m trying to make a simple tank multiplayer game by implementing chat. The game and the chat are all ok! However, I can’t get 2 customers to view the same object Arena. In this case, each customer…
-
4
votes1
answer1544
viewsMulti-threading in PHP applications
There is some Pattern design to perform the execution of multiple processes and the collection of results in it? Scenario: I have a large volume of data (> 200000 entries), have to perform…
-
4
votes1
answer225
viewsRatio of threads to number of processors
In the image below my task manager there are 3058 Threads. My processor has 4 threads. This means that of these 3058 it will run 4 in 4 threads? My processor has 4 cores and 4 threads, that means…
-
4
votes0
answers37
viewsWhat are the differences between Asymchronism, Parallelism and Multithread?
Sometimes the terms Asynchronous, Multithread and Parallelism appears whenever I do a search related to multiprocessing or something related. However, I have a hard time understanding the…