Questions tagged [multithreading]
156 questions
38
votes
7 answers
Why using more threads makes it slower than using less threads
Tried to run program X using 8 threads and it was over in n minutes.
Tried to run same program using 50 threads and it was over in n*10 minutes.
Why does this happen and how can I get optimal number of threads I can use?

pogibas
- 651
7
votes
1 answer
How do I specify which core a pthread is spawned on
I am running a cluster where each node has an Intel Xeon E5430. /proc/cpuinfo reports 8 cores. I am using C/C++ compiled with gcc ver 5.3.1 on an Ubuntu 16.04LTS.
Distributing my work to each node was the easy part.
My question pertains to the…

Steve S
- 71
2
votes
1 answer
All processes running on the same core
I found all processes on my machine to only run on a single core and their core affinity set to 0.
Here is a small python script which reproduces this for me:
import multiprocessing
import numpy as np
def do_a_lot_of_compute(a):
for i in…

Roofkiller
- 21
2
votes
0 answers
Multithreading repartition in *nix system
How the reparation of threads per CPU is handle on *nix system?
For example, one process uses 37 threads, machine has 4 cores. Usually all threads are placed on 2 cores. Sometimes at 3 cores. And almost never on 4 cores.
Is there a way to see what…

Andrei Gusan
- 21
2
votes
2 answers
How to run bash script via multithreading
I have bash script which creates high energy collision events, if one event takes around 2 minutes then for 100000 events it takes 200000 minutes, which is too much. so if I have 50 cores in a node, I want to have one event on each core, so in this…

Sudhir Rode
- 21
1
vote
1 answer
Threads to process a million files
How many threads should be used to process a million files? How yould you justify your answer? This is a question from an OS exam from last year and I'm courious how you guys think. I think that 10.000 threads and each one of them to process 100…

Andrei Gabor
- 15
- 3
1
vote
0 answers
What are scheduler Activations?
I am reading about multi-threading in Peter Baer Galvin's Operating System Concepts; I don't understand the following topics:
How LWP (virtual processor) works and schedules threads or maps to kernel threads
Why LWP are important
Many-to-many…

Navneet Srivastava
- 131
- 5
0
votes
2 answers
Parallel tasks and killing process
I have 3 tasks in a script which have to run as follow.
#1 and 2 need to run in parallel
task1 &
task2
#when task 1 is complete, task 3 is launched
task3
My problem is that task 2 being a continous process it prevents task 3 to be launched. Either…

Bispen
- 1
0
votes
1 answer
Why an LWP (Light Weight Process) is required for each concurrent system call in many to many thread model?
A LWP is a data structure placed between user thread and kernel thread, and appears as a virtual processor to user thread library. So, the minimum number of LWP required in many to many model of threading is the number of concurrent blocking system…

Navneet Srivastava
- 131
- 5