Questions tagged [concurrency]

In the field of computer science, concurrency refers to the ability of systems to execute multiple tasks simultaneously in overlapping time intervals. These tasks can be running on different cores within the same chip, shared threads on a single processor, or on separate physical processors.

Synchronizing tasks with fs.writeFileSync in NodeJS and ExpressJS

I recently wrote some code using NodeJS and ExpressJS: const express = require("express"); const fs = require("fs"); const bodyParser = require("body-parser"); const jsonParser = bodyParser.json(); const hostname = "127 ...

Boost the efficiency of my code by implementing multithreading/multiprocessing to speed up the scraping process

Is there a way to optimize my scrapy code using multithreading or multiprocessing? I'm not well-versed in threading with Python and would appreciate any guidance on how to implement it. import scrapy import logging domain = 'https://www.spdigit ...

Executing Express "get" commands simultaneously

I currently have a function that looks like this app.get('/requestItems', function(req, res){ //Check if Bots are online if(botQueue.length == 0){ //If there are no bots in the queue to take the order, then we can't process it. console. ...

Managing multiple email configurations in Laravel for multiple users simultaneously

As a Laravel 5.3 user, I have a query about using multiple mailers. In my configuration, the default mailer is set. Following advice from other sources, I would implement this code to switch the default mailer when sending an email from another server. // ...

What is the mechanism by which nodes handle multiple requests simultaneously?

Lately, I've delved into the world of NodeJs, trying to grasp how it handles multiple concurrent requests. It's fascinating that NodeJs operates on a single-threaded event loop architecture, where only one statement executes at a time on the main ...

How to prevent ConcurrentModificationException while converting to Json format?

In our project, we have a custom class called Document that utilizes a private member of type Map<String, Object> to store data. These objects are stored in memory and often modified by multiple threads. Additionally, these objects, particularly the ...

What is the ideal number of child processes to fork() in a node.js application?

I have a simple question that may require different variables to answer. Currently, I am exploring node.js and considering how to implement it in a multi-core architecture. The latest version of node.js offers child_process.fork() and child.spawn() metho ...

Is there a recommended method for utilizing multiple selenium webdrivers at the same time?

My objective is to create a Python script that can open a specific website, fill out some inputs, and submit the form. The challenge lies in performing these actions with different inputs on the same website simultaneously. I initially attempted using Thr ...

Managing simultaneous access to a variable in NodeJS: Best practices

For instance: var i = 0; while(true) http.request('a url', callback_f); function **callback_f**(){ **i++**; } In this straightforward scenario, multiple requests could unintentionally increase the value of i simultaneously. How can I create thread-s ...