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

Is single threaded process contains only one thread?

Can someone give more explain for single-threaded and multi-threaded processes Is single threaded process contains only one thread? or it means that that process can contain multiple threads and can run only one thread at a time, then…
Hamreen Ahmad
  • 522
  • 5
  • 21
4
votes
3 answers

Is volatile useful at all in a singlethreaded application in C++?

Like the title says - is there any case in which volatile is useful in the context of singlethreaded programming? I know it's used to make sure the value of the variable is always actually checked in memory so is there any case in which that value…
NPS
  • 6,003
  • 11
  • 53
  • 90
4
votes
3 answers

Can I force C++ library to use single thread?

I am using a proprietary C++ library on linux, compiled through gcc, which uses pthreads (I have to use the -lpthreads flag on gcc). I have a wrapper around it, and I know that the library is using multiple threads. The library uses multiple…
mousomer
  • 2,632
  • 2
  • 24
  • 25
4
votes
1 answer

nodejs single thread? how does it works if there are lots of concurrent requests

I am new to nodejs, currently learning it. I know nodejs is single-threaded, however I am wondering: if I use non-blocking method, for example, there are 20000 concurrent requests, and there is one request need to take a long time, other threads…
adiggo
  • 193
  • 1
  • 3
  • 10
3
votes
0 answers

How can I access the Standard-input with a Socket in C#?

I am trying to manage a client side in a chat program. So the client should get the input from the keyboard and send it to the server. In the meantime, it should be able to recieve masseges from the server. In C, we have the select() function, and…
Niro
  • 43
  • 3
3
votes
1 answer

In Java, is there a way to check if Runnable is completed in single thread?

In Java, I need to get two parameters, Runnable and Delay in milliseconds, and need to run the Runnable in the delay time. This needs to be run in single thread, and if the method is invoked with different parameter values and the previous task has…
pieordie
  • 31
  • 1
  • 3
3
votes
1 answer

sbatch+srun: Large amount of single thread jobs

Hello friendly people, my question is rather specific. For more than a week, I am trying to submit thousands of single thread jobs for a scientific experiment using sbatch and srun. The problem is that these jobs may take different amounts of time…
3
votes
1 answer

Why is the audio executed after the prompt?

function myTimer() { randint= Math.floor(Math.random() * 10)+1; randstimuli=gorilla.stimuliURL(dict[randint]); var audio = new Audio(randstimuli); audio.play(); var start=Date.now(); var ans=prompt("was the last number the…
Borut Flis
  • 15,715
  • 30
  • 92
  • 119
3
votes
1 answer

Handling multiple TcpClient connections without using threads

I've got a C# program with lots (let's say around a thousand) opened TcpClient objects. I want to enter a state which will wait for something to happen for any of those connections. I would rather not launch a thread for each connection. Something…
billpg
  • 3,195
  • 3
  • 30
  • 57
3
votes
1 answer

MariaDB non-blocking with EPOLL

I have single threaded server written in C that accepts TCP/UDP connections based on EPOLL and supports plugins for the multitude of protocol layers we need to support. That bit is fine. Due to the single threaded nature, I wanted to implement a…
dave.zap
  • 491
  • 4
  • 13
3
votes
0 answers

Comparison time- Single Threads vs Multiple Threads differing in results

I wrote this code in purpose to test multi and single threading speeds. Thanks for all the feedback! I rewrote most of it based on the great comments I received. This now functions properly (maybe has a bug here or there), tests multi threads first,…
Eric
  • 444
  • 7
  • 19
3
votes
1 answer

Performance issues of #pragma omp atomic with OMP_NUM_THREADS=1

I have observed an unexpected (for me!) behavior of an openmp code which I am writing. The code structure is the following: #pragma omp parallel for for(int i=0;i
3
votes
1 answer

Is volatile useful at all in a singlethreaded application in C#?

Is there any case in which volatile is useful in the context of single-threaded programming? I know it's used to make sure the value of the variable is always actually checked in memory so is there any case in which that value may change (in a ST…
NPS
  • 6,003
  • 11
  • 53
  • 90
3
votes
6 answers

Semaphores in a single thread

I was wondering whether it would ever make sense to use a mutex or semaphore when there is only one thread?. Thanks for your help.
Umbungu
  • 945
  • 3
  • 10
  • 30
3
votes
3 answers

Is it possible to create a single socket, single thread, TCP/IP packet reader for multiple clients?

A typical server application would create a socket for each incoming connection spawn a new thread. However is it possible to do the demuxing yourself in a single thread? What I want is that the application keeps a state machine for each end point…
GeirGrusom
  • 999
  • 5
  • 18
1 2
3
13 14