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
8
votes
2 answers

Getting the exit code from a process submitted with qsub on Sun Grid Engine

I would like to submit jobs via qsub on Sun Grid Engine (now: Oracle Grid Engine?). I do not wish to use the -sync yes option or qrsh, because I want my controlling program to be single-threaded and able to launch many jobs at a time. These…
Brian
  • 690
  • 1
  • 7
  • 18
7
votes
3 answers

In javascript, why doesn't the below code exit the loop?

let a = true; setTimeout(() => {a = false}, 1000) while(a){console.log(a)}
c137
  • 65
  • 5
7
votes
5 answers

Deadlock in Single threaded application

Can a single threaded application have a deadlock? If so, please provide an example.
swetha
  • 71
  • 1
  • 2
6
votes
4 answers

Is it a bad idea to use async/await in a Node/Express server?

I have a NodeJS/Express web app, where TypeOrm is used for many database functions. To avoid callback hell I usually use async/await to call and wait for database actions from my endpoint methods. I've heard, however, that methods like…
6
votes
4 answers

Can I force the browser to render DOM changes during javascript execution

Is there a way to force the browser to render DOM changes during the execution of JavaScript? In the following example, only the '1000' will be displayed and I do understand that this is caused by having only a single thread processing the…
doberkofler
  • 9,511
  • 18
  • 74
  • 126
6
votes
3 answers

Understanding JavaScript's single-threaded nature

I've been reading John Resig's "Secrets of a JavaScript Ninja" and it explains that JavaScript is single-threaded. However, I tried testing this and I'm not sure what to take away from here: // executing this in browser (function () { // throw…
wmock
  • 5,382
  • 4
  • 40
  • 62
5
votes
1 answer

Node.js multithreading: What are Worker threads and how does it work?

I always believed that JS was a single threaded language which makes it inefficient for CPU intensive tasks. I recently came across worker threads and how it solves this inefficiency problem by creating "multiple worker threads under one process".…
5
votes
2 answers

If Redis is single Threaded, how can it be so fast?

I'm currently trying to understand some basic implementation things of Redis. I know that redis is single-threaded and I have already stumbled upon the following Question: Redis is single-threaded, then how does it do concurrent I/O? But I still…
Alexander Mayr
  • 119
  • 1
  • 7
5
votes
2 answers

How can you have parallelism without concurrency?

I read that it is possible to have parallelism without concurrency. Is this correct? Suppose you have two tasks, A and B, and each require two steps to complete: A1, A2, B1, B2. Also, a process is composed of threads. Here I how I think of…
5
votes
2 answers

Asynchronous processing with a single thread

Even after reading http://krondo.com/?p=1209 or Does an asynchronous call always create/call a new thread? I am still confused about how to provide asynchronous calls on an inherently single-threaded system. I will explain my understanding so far…
Bober02
  • 15,034
  • 31
  • 92
  • 178
4
votes
4 answers

Why is this OpenMP program slower than single-thread?

Please look at this code. Single-threaded program: http://pastebin.com/KAx4RmSJ. Compiled with: g++ -lrt -O2 main.cpp -o nnlv2 Multithread with openMP: http://pastebin.com/fbe4gZSn Compiled with: g++ -lrt -fopenmp -O2 main_openmp.cpp -o…
Robotex
  • 1,064
  • 6
  • 17
  • 41
4
votes
3 answers

Node JS multiple concurrent requests to backend API

This is my node js backend API method. apiRouter.route('/makeComment') .post((req, res) => { consoleLogger.info("Inside makeComment API.."); logger.info("Inside makeComment"); let timestamp = new…
DukeLover
  • 2,184
  • 2
  • 19
  • 27
4
votes
2 answers

How to implement a full duplex channel over TCP with a single thread?

The network lib I'm writing needs to send and receive messages through a TCP socket. Messages can be sent or received any time, i.e should work as a full duplex channel. I was able to implement such scenario using two threads: main thread calling…
Igor Gatis
  • 4,648
  • 10
  • 43
  • 66
4
votes
1 answer

Are databases single-threaded?

Let's say there is a hospital that runs a simple database. In this database is a table called "patients" with 1,000,000 records--each record being a patient whose status is either "active" or "discharged". Bob runs the following query that will take…
user3163495
  • 2,425
  • 2
  • 26
  • 43
4
votes
0 answers

What is a single thread of execution and runtime in Javascript?

I'm learning about the event loop from this blog but seems like the author goes into general computer program concepts I'm not too familiar with - This includes HTTP requests, database operations and disk reads and writes; the single thread of…
akantoword
  • 2,824
  • 8
  • 26
  • 43
1
2
3
13 14