Most voted "competition" questions
In computer science, simultaneity or concurrency is a property of systems in which multiple calculations can be performed in periods of overlapping time. Calculations can run on multiple cores on the same chip, preventively threaded shared in time on the same processor, or run on physically separate processors.
Learn more…52 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 -
53
votes4
answers2561
viewsWhat’s wrong with gluttonous philosophers?
When it comes to concurrent programming, they always mention 3 classic problems/competition models: producers and consumers readers and writers glutton philosophers (or dinner of philosophers) I…
-
22
votes3
answers10939
viewsHow does the C#lock work?
I was just looking at an article by MSDN, but it was not clear why to use this. class Account { decimal balance; private Object thisLock = new Object(); public void Withdraw(decimal amount) { lock…
-
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…
-
15
votes2
answers410
viewsWhat is competition control?
About the studies I was doing at the time I asked What is a traffic light?, informed me that, in order to better understand this term, I should study about Control of Competition. Could someone…
-
14
votes1
answer12287
viewsConcurrent Programming x Parallel x Distributed
What are, what are the characteristics of each? Problems that each one proposes to solve? Main difference between them?
-
14
votes2
answers3382
viewsWhat are the states of a thread?
I have been researching some places on the Internet but I did not find consistency in the definitions given on the subject of thread in Java. What are the possible states of a thread and what are…
-
12
votes3
answers1090
viewsIn programming, what is the actor model?
I have a co-worker who is an advocate of model actor (model of actors, in Portuguese). In general, it seems to be a software architecture to be applied in distributed systems or in the cloud. From…
software-architecture competition microservices actor-modelasked 7 years, 9 months ago Bruno Costa 5,878 -
11
votes3
answers12452
viewsHow to perform a function after two or more asynchronous events?
I have a jQuery script that starts two or more asynchronous operations at the same time, and would like to run a callback when all they have been completed. An example would be to start an animation…
-
8
votes2
answers321
viewsAre static classes shared by threads?
Static classes, methods and properties are shared between threads of the application? That is, if I modify the static property foo in ThreadA, and then modify the same static property foo in…
-
8
votes3
answers918
viewsParallelism and Simultaneity
Reading a few things on the subject, I realized they are not the same thing, so I would like to find out: What’s the difference between Parallelism and Simultaneity in proceedings?…
-
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
answer4407
viewsWhat is the difference between Traffic Light and Monitor?
I have a doubt in the concept of these two structures. What would be the difference between them? Which is faster? And which is easier to use? Could you give me a basic example of each?…
-
6
votes1
answer394
viewsEfficient data structure for high color concurrent problem
As part of a test I was asked to develop an application to manage high Scores in environments with high competition. This application should not persist on disk or use libraries and frameworks…
-
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
answer863
viewsDeadlock concept in Java
I came across the term deadlock in Java. But, I can’t understand it. So I would like to ask these questions: What is a deadlock? Why and how to avoid a deadlock?
-
6
votes2
answers387
viewsHow to do concurrency control in Hibernate for INSERT in the database
I’m having a competition control problem in entering data in my web application. Context: I have 3 tables (ex: X, Y and Z) that record hospitalizations of patients (already registered). A patient…
-
5
votes2
answers83
viewsWhat is the syncblock?
I received a reply about a syncblock. Why is it necessary? I understand what I researched is about competition control. But why does every object need it if not everyone will have competition?…
-
5
votes1
answer88
viewsHow to make atomic updates with Triemap and Concurrenthashmap?
In Java ConcurrentHashMap has an interesting property. Operations such as putIfAbsent, remove, replace, computeIfAbsent, computeIfPresent, compute and merge are atomic. Example: final Map<String,…
-
4
votes1
answer200
viewsBasic competition in Erlang
Adapted of this issue no stack overflow international, whose answer is my own. The next code was given in a class. We tested the code, but I didn’t really understand how it works. How this code…
-
4
votes2
answers1251
viewsJavafx Threads Update UI and load System in the background
I have a Stage Main that is my Login: In the FXML of that Stage I have a Region and a ProgressIndicator with the property setVisible(false) After successfully logging into the application the…
-
4
votes2
answers907
viewsHow to work with lock in SQL records?
I’m studying best practice to work with lock of records. What I mean is, I have several tables that can be accessed by several users simultaneously, but if any attempt is made to edit the record,…
-
4
votes1
answer742
viewsWhat is the livelock?
The term deadlock is well known in concurrent programming, but I came across the term livelock in my studies, and I wondered what that might be? What is livelock? And could you give some example…
-
4
votes1
answer68
viewsIn Assumptions on Timing - I don’t understand this concept of a book
Cited in the book that a critical region has 4 key points: Progress: Ensures that all threads are entering and leaving the critical region, avoiding deadlocks. Mutually Exclusive: Only one thread…
-
4
votes1
answer58
viewsWhat are Fibers in Ruby and how to use them?
I was trying to do a reverse proxy using Webrick when I discovered that the version I had installed from Webrick did not contain the methods necessary to make a "chunked" worthy reading. So I…
-
4
votes1
answer46
viewsIs there a difference between corroding, fiber and green threads?
According to the title of the question, I see these names being used to describe very similar things. In the Python world we have Greenlets described as corroding and Green Threads. In the Java…
-
3
votes2
answers3573
viewsCompeting transactions in Mysql
I am working on a system that needs to draw multiple data(coupons) from one table and return to the user, but I cannot risk delivering the same coupon to the other user. I thought I’d use the…
-
3
votes1
answer155
viewsUse a Threadpool or just start a new Thread?
Let’s say the software every time creates a new Runnable to perform a basic function at each cycle, at the end of a running day I would have a few hundred Threads of this function created and…
-
2
votes1
answer2831
viewsWhat are Java daemon threads and when to use them?
From the Java documentation I follow the following excerpt: The Java Virtual Machine exits when the only threads running are all daemon threads. But it’s still unclear to me when to set a thread as…
-
2
votes1
answer65
viewsIs it correct to cast an exception within a Synchronized?
In my app there are some threads that access the database and control this competition using the totalcross Lock. My question is: Can I allow exceptions to be thrown into a Synchronized block ? or…
-
2
votes2
answers115
viewsProblem capturing the title of a URL using regular expression
I’m learning Go language in the competition part. I had the challenge of using the Generator standard to get a Channel that reads the title of a URL through a goroutine. Inside this goroutine that I…
-
1
votes0
answers31
viewsHow can I check lock-free (lock-free) algorithms?
Is there any tool/process/methodology available to prove that a competing program but that does not use Locks in its critical regions is correct?
-
1
votes1
answer81
viewsConcurrent.Utures and Class Object
I am trying to create a class (Processor) that runs a series of functions to get results from a State-to-State API. (STATE) 1- READ data from a table. 2-SEND request for the API to process. 3- WAIT…
-
1
votes0
answers40
viewsHow does optimistic competition work?
In an application with pessimistic competition there is data containment usually involving Locking mechanisms. In optimistic competition no. Two clients can try to write but only one can. What are…
-
1
votes1
answer421
viewsReturn to main() after using start()
After executing the command gerenciador.start(), my program does not return to the function main, and does not print the message is over. It simply executes the command I have spoken. Does anyone…
-
1
votes0
answers145
viewsConcurrent programming
Hello, I’m having trouble finding the error in the code below. It is a problem where ideally, having 5 vacancies available, any one of the types of threads (server or trainee) can be sit freely, but…
-
1
votes0
answers43
viewsWhat is a Promise?
Why does it exist? How does it work and how should it be used in the simplest way? Any specific care? When is abuse to adopt this mechanism? Exists only in Javascript?
-
1
votes1
answer66
viewsProblem sending arrays from one method to another using Thread in Java
I’m doing a program that simulates sending a message from the physical layer to another physical layer of the OSI (ISO reference) model of networks. My code has a method that sends "frames"…
-
1
votes0
answers267
viewsRegister certified "https" protocol for SOAP(Axis 2) request
I created a service to register the "https" protocol and inject the certificate into it using the Socketfactory implementation, but it works well only one request at a time, but when using…
-
1
votes0
answers51
viewsHow to block part of a method to be processed only once per request with . net core
i have to increment a column in the database and this increment may depend on the situation, for example increment according to the user, I am using Jmeter to send 100 requests at the same time, but…
-
1
votes1
answer81
viewsJava competition, simple example, multi-threaded hash map not secure
I’m using a hash map to assign the voto at the id of a voter. But the class has several threads operating on top of the method addVote(...) and getVoteCount(...) , and the result returned is always…
-
0
votes3
answers403
viewsLog reading to infer counter
I have a template called Request and this template has a column called Number. This number has the following structure: YEAR + COUNTER. It just so happens that every time I create a new request I…
-
0
votes1
answer158
viewsSimultaneous access API Rest
I have a PHP application that receives json from another application and writes them to the Mysql database. Before recording the data, I check the database to see if the record has already been…
-
0
votes0
answers231
viewsMulti-thread concurrency control
I need to develop a Windows Service with C# that checks a table in the database (Sql Server 2008). This table has the data I need and a Status field(Ready,Processing, Processed, Error). The service…
-
0
votes1
answer84
viewsHow to make Requestcontext thread-safe?
In one project I am using the component "Demoiselle-Scheduler-Quartz". In this project several threads are fired and executed concurrently. The "Demoiselle-Scheduler-Quartz" component injects the…
-
0
votes1
answer321
viewsRunning code snippets in parallel
Hello, I wanted to know how to run one thread after another for a certain time, for example: Thread x = new Thread(() -> { // qualquer código, pode ter até um while(true)... }); Thread x2 = new…
-
0
votes0
answers141
viewsHow does Javascript competition work?
I have a possible problem in javascript. The problem is that an array can have concurrent access because the following script below can be called at the same time several times because I use…
-
0
votes1
answer701
viewsThread - Shared Memory Access Violation
I use a library to retrieve data from an Image (in unsigned char*), and use it to allocate to an Opengl Buffer (Texture). Since the image can be large, Opengl by default creates another thread to…
-
0
votes2
answers92
viewsMy Node js API mixes data from different requests
I developed a private app on Zapier.com. The framework is in Node js. And it is composed of triggers and actions. In one of my actions, when it is desplotted several triggers simultaneously I get…
-
0
votes1
answer306
viewsError in requests with aiohttp in asyncio
import time import urllib.request import asyncio import aiohttp URL = 'https://api.github.com/events' MAX_CLIENTS = 10 def fetch_sync(pid): print('Fetch sync process {} started'.format(pid)) start =…