Questions tagged [thread]
The thread tag has no usage guidance.
118
questions
1
vote
1
answer
36
views
Why does Linux needs both pid_max and threads-max?
I understand the difference between /proc/sys/kernel/pid_max and /proc/sys/kernel/threads-max. There's a good explanation at the answer to
Understanding the differences between pid_max, ulimit -u and ...
1
vote
1
answer
82
views
Does the definition of a thread in Linux depend on a system call?
Clone
In the manual page for clone()/clone3() system call I find:
CLONE_THREAD (since Linux 2.4.0).
If CLONE_THREAD is set, the child is placed in the same thread group as the calling process.
To ...
0
votes
2
answers
55
views
How to find PID of all processes related to a given process?
How can I go about finding the PID or other information about a process that is doing the work of another process? I'm talking about kworker threads, for example, or any other threads/processes that ...
-2
votes
2
answers
195
views
Difference between cores and logical processors
I have a question about core and logical processors. So, my computer has 1 CPU with 2 cores and 4 logical processors. Does this mean that my computer has 4 threads, 2 threads for every core? Than why ...
2
votes
0
answers
231
views
How do you fetch a large file over http in parallel?
Question:
Since HTTP supports resuming at an offset, are there any tools (or existing options for commands like wget or curl) that will launch multiple threads to fetch the file in parallel with ...
2
votes
0
answers
253
views
nvidia (proprietary) drivers : What are these kernel threads?
Running some 340 driver (with an nvidia.ko module loaded at init time) I moved to a 470 driver and discover half a dozen of kernel threads I failed to find any information about :
2 [nv_queue] : What ...
0
votes
1
answer
153
views
History process
Is there a command line to retrieve all information like pid tid of threads in Linux? For instance if one process has dead before the command ps runs. The command does not find the process
2
votes
0
answers
113
views
Java threads and /proc/ directory on linux
I have a Java program that uses a pool of worker threads, that execute the work. These threads are dynamic, so the program creates and removes threads dynamically.
The thread is running while a ...
1
vote
1
answer
528
views
Meaning of the term "process", "thread" and "task_struct" in Linux
In my knowing, a thread is an execution flow of a process and all the threads of a process share some common structures. Furthermore, in modern PC the CPU executes only threads, not processes.
What I ...
3
votes
0
answers
309
views
Linux: Is there a limit for the number of fork() calls one process goup can issue? (Not per user!)
We have a strange problem on a SuSE Linux Enterprise Server 12.5 system (kernel 4.12.14-122.60), which is the only KVM guest in a simliar KVM host:
One service started by systemd starts one program -&...
0
votes
1
answer
68
views
Process status logic
How can a process have a status when only threads are being scheduled (Windows and Linux)?
Let’s say we create process P
Thread T1 is now allocated as well
T1 is now in runnable state
Scheduler picks ...
1
vote
1
answer
554
views
How does a spinlock prevents context switching?
I am using this code in order to visualize how a spinlock would prevent context switching:
pthread_spinlock_t lock;
void pp()
{
pthread_spin_lock(&lock);
char d = 'D';
...
0
votes
2
answers
784
views
if a device driver is called multiple times, does the kernel create multiple processes?
what happens if a device driver is called open("/dev/mydrievr") multiple times by multiple programs?
is a process created for each call?
is it possible to instantiate a thread instead of a ...
0
votes
1
answer
150
views
What starts threads in Linux OS?
I am currently investigate a question related to threads in the Linux OS. I know that processes are started by the scheduler in Linux Kernel, but what starts threads inside a process - Linux Kernel ...
1
vote
0
answers
255
views
Is it possible to get each thread's `comm` from a core dump with gdb?
I wrote a C program that uses multiple threads.
For convenience I set the threads comm to some individual value for each thread, and that even might change depending on the state of the thread (a bit ...
0
votes
1
answer
1k
views
top shows different pid for threads of same process. How to fix it?
when i do a ps -efT (where -T = Show threads, possibly with SPID column.), i see all the threads have the same PID, which is as expected.
myroot 24958 24958 7942 0 20:20 pts/12 00:00:00 java -...
1
vote
0
answers
134
views
does pthread_setschedparam can change the priority on the fly once the thread is running? how can I change the thread priority for a running thread
I want to change a thread priority and I have found many examples using pthread_setschedparam, but I need to confirm if the priority can be changed on the fly if the thread is already running. In the ...
2
votes
1
answer
4k
views
How do I do "ps" command on a thread?
The ps command can be done in terminal to view information about a process. For example,
#list processes
ps aux
#with executable paths
ps -ef
#path for a specific process
ps -p [pid]
However, if a ...
0
votes
1
answer
629
views
Process I\O vs CPU bound?
I saw this question online preparing for a job interview:
Given a Non-Preemptive kernel which type of process will get effected more
in terms of performance and why?
I\O bound
CPU bound
I know ...
2
votes
0
answers
659
views
htop not showing threads of processes on Mac
I am running a java program from inside IntelliJ IDEA (an IDE) on a Mac. The program spawns 2 threads.
I have installed htop and I am trying to see the process along with the spawned threads (they are ...
0
votes
1
answer
327
views
thread profiling and monitoring
how can I get lock time values specifically of the threads of any process? in linux..
I was using the command /proc/pid/stat but I am unable to determine which values are of lock time.
0
votes
1
answer
884
views
How to solve All threads core not showing
I want ask issue regarding the number of cpu threads that can be read from the os. This question is how to resolve core not showing and not ask how to check core threads.
Server spec
Hpe dl360p gen8
...
0
votes
2
answers
42
views
Will "$!" reliably return the correct ID with "&"?
In my tests, I always get the correct result so far with this:
[fabian@manjaro ~]$ sleep 10 & echo $!
[1] 302657
302657
But sleep and echo are getting executed simultaneously here, so I would ...
-1
votes
1
answer
2k
views
How to find out on which core a thread is running on?
Let's say we have a CPU-intensive application called multi-threaded-application.out that is running on top of Ubuntu with a PID of 10000. It has 4 threads with tid 10001, 10002, 10003, and 10004. I ...
-1
votes
1
answer
1k
views
How to get number of threads/tasks per core in Linux?
As you may know, in Linux, each CPU core has its own run queue. How can I get the number of threads currently running on each core in Linux (Ubuntu)?
1
vote
2
answers
1k
views
Is it possible for a kernel space thread or process to be child of a userspace process?
I am kind of a newbie when it comes to the Linux Kernel, but I was reading this article about fibrils where it mentions that they are (or were? not sure if they were ultimately kept in the Kernel) ...
0
votes
1
answer
361
views
Could thread be counted as a CPU? [duplicate]
So I typed in lscpu into my terminal and saw this:
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
The no. of CPU(s) is 4 here ...
9
votes
3
answers
862
views
Should I attempt to 'balance' my threads or does linux do this?
A simple example. I'm running a process that serves http request using TCP sockets. It might A) calculate something which means CPU will be the bottleneck B) Send a large file which may cause the ...
1
vote
1
answer
246
views
Process VS Thread in commands Which runs first?
I am wondering which would run or be created first on Linux if I were to run a command which uses both a process and a thread. I know they both use clone() to run and by definition a thread is ...
2
votes
1
answer
756
views
Are there any tools to view a process' thread control blocks?
Process Control Blocks expose the /proc file system which allows PCBs to be read by users. Is there a similar file system for Thread Control Blocks? If not, is there a tool to read their contents (...
1
vote
2
answers
1k
views
Naming convention of worker threads
I started reading about worker threads. Old Legacy worker threads is replaced with worker pools.
$ ps -ef | grep 'kworker'
root 6 2 0 04:41 ? 00:00:00 [kworker/0:0H-kb]
root ...
1
vote
1
answer
923
views
What data structure is the stack using in Linux?
I have looked in several places such as here but none explain in detail the structs used for implementing the stack itself (the place where "tasks" (processes/threads) store their nested call ...
-3
votes
1
answer
669
views
Reasons that may cause a running process to voluntarily or involuntarily give-up the CPU?
What are the reasons that may cause a running process to voluntarily or involuntarily give-up the CPU? As only one process can be running in the CPU/Core at any one time.
1
vote
1
answer
2k
views
What types of threads does Java/JVM use from Linux OS's perspective?
A developer friend of mine recently asked the question: On a Linux system when a Java application runs which has threads, how do these threads appear to the underlying Linux OS?
So what are Java ...
2
votes
1
answer
625
views
How do I display the thread / child process count of a process in top?
I know there is a one-line-per-thread view (-H), but the particular threads are not grouped by master process. In fact, I would be completely satisfied with the sole thread count per process (= how ...
2
votes
0
answers
225
views
Read per thread network statistics from C/C++
I have a Linux process with let's say 10 threads. Some of them make network traffic. From another thread or it can be even within another process I need to find out which threads have network activity....
0
votes
1
answer
156
views
Why does gunicorn w/ workers as a daemon kill MySQL?
So, I've recently deployed my first Flask app with gunicorn. During deployment, I encountered the most peculiar issue. I had created a systemd unit file (the following is the working, functional ...
1
vote
0
answers
37
views
Deterministic thread cancelation
Is there a way to deterministicly cancel threads (Light-weight process) in linux. Let say I want to cancel a thread because it is possible in an infinite loop or my scheduler requires it. How would ...
0
votes
1
answer
826
views
Information on values in /proc/pid/task/tid/sched
can someone help me out with the meanings of the following terms in the output of /proc/pid/task/tid/sched?
avg_per_cpu
se.avg.util.sum
se.avg.load.sum
ravg.demand
Do any of these values point to ...
1
vote
0
answers
40
views
How to find the number of threads in a OpenVZ containers
A am running a Spark application, it is possible to specify some parameters like the number of threads.
My question : how I can find the number of threads in my container OpenVZ.
Some details :
$...
0
votes
0
answers
784
views
Can two threads in the same process belong to different namespaces?
The task_struct structure has an entry nsproxy which points to namespaces associated with the task_struct.
My understanding is that task_struct can be used to represent both process and threads in ...
1
vote
2
answers
8k
views
How can I list information about a thread/LWP by `ps`?
How can I list information about a thread/LWP by ps?
Why can't I do that simply by:
$ ps 10173
PID TTY STAT TIME COMMAND
$ ps -L 10173
PID LWP TTY STAT TIME COMMAND
The best I ...
2
votes
1
answer
313
views
Look up a string in a log to set an alert and generate thread dumps
I need to write a script to create and alert and get thread dumps if a string (Related string is found) in a log file - /tmp/area.log. I am able to do this in 2 separate scripts so far but would like ...
1
vote
1
answer
3k
views
How to set the SCHED_RR time slice or time quantum per process / thread?
The time slice (also called time quantum) for threads with SCHED_RR policy can, according to the sched_rr_get_interval man page be obtained using
int sched_rr_get_interval(pid_t pid, struct timespec *...
1
vote
0
answers
491
views
Is it possible to create a thread without sharing memory space?
The http://www.man7.org/linux/man-pages/man2/clone.2.html write
Since Linux 2.5.35, flags must also include CLONE_SIGHAND if CLONE_THREAD is specified (and note that, since Linux 2.6.0-test6, ...
1
vote
1
answer
508
views
Distribution of threads among CPUs?
lscpu gives:
Thread(s) per core: 2
Core(s) per socket: 32
When running an intensive 32-threads process, why does htop show almost 100% CPU activity on #1-32, but very little activity on #33-64? ...
4
votes
1
answer
547
views
Is there a file that associates a thread to its network namespace?
/proc/[pid]/ns/net contains a link to the inode representing the network namespace of the process with PID [pid]. Is there something similar for threads?
My use case is a multi-threaded application, ...
0
votes
1
answer
862
views
SLES 11 SP4 'Resource temporarily unavailable' after upgrade from SP3
After upgrade from SLES 11 sp3 to sp4 I've met the problem while creating threads. Message I got was 'Resource temporarily unavailable'. Is it possible that upgrade changed limits somehow or maybe ...
3
votes
2
answers
3k
views
Are tgid and pid ever different for a process or lightweight process?
tgid and pid are the same concept for any process or for any lightweight process.
In /proc/${pid}/status, tgid and pid are distinct fields. Are tgid and pid ever different for a process or ...
7
votes
2
answers
3k
views
Does Linux not distinguish between processes and threads?
As far as I know in Linux kernel,
the structure task_struct represents threads i.e. light weight processes, but not processes.
processes are not represented by any structure, but by groups of ...