Skip to main content

Questions tagged [thread]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
90 views

Why can't Linux provide lighter/green threads?

I often hear that linux threads are heavy (requiring 8mb stack size) and this is why languages like golang implement their own green threads in userspace (allocating to the heap). This then allows ...
flippanthomework's user avatar
3 votes
2 answers
1k views

Are there any benefits in setting a HDD's logical sector size to 4Kn?

Modern HDDs all are "Advanced Format" ones, e.g. by default they report a logical/physical sector size of 512/4096. By default, most Linux formatting tools use a block size of 4096 bytes (at ...
ChennyStar's user avatar
  • 1,795
0 votes
1 answer
56 views

why ulimit restriction is affect by other processes?

I have some processes creating large amount of threads (using python ray module), like 32 (proc) * 120 (thread per proc). Then I found other processes would fail on creating threads while their nTH is ...
beantowel's user avatar
2 votes
1 answer
271 views

How can I locate the stacks of child tasks (threads) using /proc/<pid>/maps?

PURPOSE: I am theorising as to how one would go about creating a pointer scanner in a Linux environment. DISCLAIMER: My findings have been tested on Debian Bookworm (current stable) and a Gentoo ...
vykt's user avatar
  • 21
2 votes
1 answer
482 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 ...
aviro's user avatar
  • 5,922
1 vote
1 answer
186 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 ...
Kolay.Ne's user avatar
  • 166
0 votes
2 answers
192 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 ...
stochasticlover1's user avatar
-2 votes
2 answers
3k 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 ...
elvis's user avatar
  • 105
2 votes
0 answers
479 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 ...
KJ7LNW's user avatar
  • 495
2 votes
0 answers
479 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 ...
MC68020's user avatar
  • 8,249
0 votes
1 answer
288 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
Gregor's user avatar
  • 1
2 votes
0 answers
227 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 ...
Tom Eeraerts's user avatar
1 vote
1 answer
746 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 ...
Bender's user avatar
  • 121
3 votes
0 answers
433 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 -&...
Stefan Brunthaler's user avatar
0 votes
1 answer
74 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 ...
X XXX X's user avatar
1 vote
1 answer
823 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'; ...
Aramya's user avatar
  • 37
0 votes
2 answers
1k 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 ...
Lkaf Temravet's user avatar
0 votes
1 answer
228 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 ...
Evil JuniorCplusplus's user avatar
1 vote
0 answers
334 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 ...
U. Windl's user avatar
  • 1,493
1 vote
1 answer
2k 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 -...
samshers's user avatar
  • 688
1 vote
0 answers
180 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 ...
alejandro mendoza's user avatar
2 votes
1 answer
6k 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 ...
Aboeme Ajaubalu's user avatar
0 votes
1 answer
843 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 ...
Sor's user avatar
  • 1
2 votes
0 answers
871 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 ...
Jim's user avatar
  • 1,421
0 votes
1 answer
458 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.
I192100 Mayra Ahmad's user avatar
0 votes
1 answer
1k 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 ...
Trweb's user avatar
  • 21
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 ...
Fabian Röling's user avatar
2 votes
2 answers
3k 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 ...
Michel Gokan Khan's user avatar
-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)?
Michel Gokan Khan's user avatar
1 vote
2 answers
2k 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) ...
memememe's user avatar
  • 175
0 votes
1 answer
395 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 ...
stagee's user avatar
  • 1
9 votes
3 answers
1k 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 ...
Eric Stotch's user avatar
1 vote
1 answer
280 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 ...
bobo123's user avatar
  • 11
2 votes
1 answer
949 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 (...
Justin Borromeo's user avatar
1 vote
2 answers
2k 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 ...
md.jamal's user avatar
  • 291
1 vote
1 answer
1k 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 ...
Lance's user avatar
  • 447
-3 votes
1 answer
729 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.
Ayush's user avatar
  • 3
1 vote
1 answer
3k 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 ...
slm's user avatar
  • 372k
2 votes
1 answer
772 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 ...
Neppomuk's user avatar
  • 346
2 votes
0 answers
246 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....
mdaniel's user avatar
  • 141
0 votes
1 answer
187 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 ...
m-flak's user avatar
  • 1
1 vote
0 answers
43 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 ...
Marko Bencik's user avatar
0 votes
1 answer
979 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 ...
Trishla Verma's user avatar
1 vote
0 answers
47 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 : $...
Hayat Bellafkih's user avatar
0 votes
0 answers
884 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 ...
Jake's user avatar
  • 1,373
1 vote
2 answers
9k 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 ...
Tim's user avatar
  • 103k
2 votes
1 answer
338 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 ...
Karthik's user avatar
  • 33
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 *...
Dirk Herrmann's user avatar
1 vote
0 answers
587 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, ...
炸鱼薯条德里克's user avatar
1 vote
1 answer
647 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? ...
Geremia's user avatar
  • 1,185