Questions tagged [single-threaded]

Single threaded as opposed to multithreading defines a code section, object or application that can run only using and allowing a single thread.

Single threaded as opposed to multithreading defines a code section, object or application that can run only using and allowing a single thread.

References

209 questions
75
votes
6 answers

Why isn't setTimeout cancelling my loop?

I wondered how many times can a JavaScript while statement (in Chrome's console) can increment a variable in a millisecond, so I quickly wrote this snippet directly into console: var run = true, i = 0; setTimeout(function(){ run = false; },…
rev
  • 1,861
  • 17
  • 27
73
votes
4 answers

Single-threaded apartment - cannot instantiate ActiveX control

I need to get information about applied CSS styles in HTML page. I used AxWebBrowser and iterate IHTMLDOMNode. I'm able to get all the data I need and move the code into my application. The problem is that this part is running inside of the…
martin.malek
  • 2,166
  • 2
  • 19
  • 31
52
votes
2 answers

What happens if an alert window is shown during an ajax call?

I was just wondering what could happen if, while an ajax call is being executed, an alert is prompted to the user, in the browser window. Let's say, for example, that I have an ajax call $.ajax({ url: ..., type: GET/POST, ... …
BeNdErR
  • 17,471
  • 21
  • 72
  • 103
24
votes
1 answer

Node.js server with multiple concurrent requests, how does it work?

I know node.js is a single threaded, asynchronous, non blocking i/o. I've read a lot about that. e.g PHP uses one thread per request but node uses only one thread for all, like that. Suppose there are three requests a, b, c arriving at same time at…
Siddharth
  • 505
  • 2
  • 4
  • 9
24
votes
1 answer

How are the Event Loop, Callback Queue, and Javascript’s single thread connected?

GENERAL GOAL I’d like to know how the following pieces of a javascript environment interconnect as a system. Javascript Engine Event Loop Event Queue We can limit this to a browser environment since node has been covered in another article…
16
votes
2 answers

Windows service OnStop wait for finished processing

I actually develop a Windows service in VS 2012 / .NET 4.5. The service is following the scheme of the code snippet below: Using a timer Executes some desired operation every couple of minutes. The process takes about 10 minutes to complete I use…
crisjax
  • 227
  • 1
  • 3
  • 7
15
votes
3 answers

Single- vs. multi-threaded programming on a single core processor

Can someone please explain if there's really any advantage to writing a multi-threaded piece of code that runs on a single processor with a single core? E.g., a method that processes document pages such that the pages are mutually exclusive w/r/t…
icfantv
  • 4,523
  • 7
  • 36
  • 53
12
votes
3 answers

why Redis is single threaded(event driven)

I am trying to understanding basics of Redis. One that that keep coming everywhere is, Redis is single threaded that makes things atomic.But I am unable to imagine how this is working internally.I have below doubt. Don't we design a server Single…
Nishat
  • 881
  • 1
  • 17
  • 30
12
votes
3 answers

When NOT to use database connection pooling in Java?

I can find a lot of questions about how to use connection pooling and why it's a good idea, but I'm wondering if I actually need it. I'm creating a server application and although it is multi-threaded, I've been careful that only a single thread…
11
votes
1 answer

Nodejs callback mechanism - which thread handles the callback?

I'm new to nodeJS and was wondering about the single-instance model of Node. In a simple nodeJs application, when some blocking operation is asynchronously handled with callbacks, does the main thread running the nodeJs handle the callback as…
Some guy
  • 1,210
  • 1
  • 17
  • 39
9
votes
4 answers

Animations under single threaded JavaScript

JavaScript is a single threaded language and therefore it executes one command at a time. Asynchronous programming is being implemented via Web APIs (DOM for event handling, XMLHttpRequest for AJAX calls, WindowTimers for setTimeout) and the Event…
Unknown developer
  • 5,414
  • 13
  • 52
  • 100
9
votes
2 answers

How vert.x is single threaded?

From my understanding, each vert.x instance will be assigned an event loop. Event loop handles all the request an other task for that particular instance. Event loop is a thread, I think. When there are multiple vert.x instance deployed, each…
9
votes
1 answer

Why does my activity monitor show Node.js using multiple threads?

I opened my activity monitory in OSX to to see how Node was getting along and to my surprise it's using 8 threads. How can in be!!?
jwerre
  • 9,179
  • 9
  • 60
  • 69
8
votes
1 answer

Can having multiple threads on a single core system still improve performance?

I just learned the basics of parallel-processing in Java. I read this question: Multiple threads and performance on a single CPU and wondered if there is not another reason why multiple threads might be faster than single thread on a single-core…
8
votes
2 answers

What events specify when a tick ends in node.js?

I've read that a tick is a unit of execution where the nodejs event loop decides to run everything in its queue, but other than explicitly saying process.nextTick() what events cause the node.js event loop to start processing a new tick? Is it…
oibe
  • 1,047
  • 1
  • 7
  • 10
1
2 3
13 14