Questions tagged [thread]

117 questions
258
votes
3 answers

Why does `htop` show more process than `ps`

In ps xf 26395 pts/78 Ss 0:00 \_ bash 27016 pts/78 Sl+ 0:04 | \_ unicorn_rails master -c config/unicorn.rb 27042 pts/78 Sl+ 0:00 | \_ unicorn_rails worker[0] -c config/unicorn.rb …
Cheng
  • 6,531
  • 11
  • 40
  • 42
86
votes
7 answers

Are threads implemented as processes on Linux?

I'm going through this book, Advanced Linux Programming by Mark Mitchell, Jeffrey Oldham, and Alex Samuel. It's from 2001, so a bit old. But I find it quite good anyhow. However, I got to a point when it diverges from what my Linux produces in the…
user147505
59
votes
4 answers

Creating threads fails with “Resource temporarily unavailable” with 4.3 kernel

I am running a docker server on Arch Linux (kernel 4.3.3-2) with several containers. Since my last reboot, both the docker server and random programs within the containers crash with a message about not being able to create a thread, or (less often)…
cdauth
  • 1,387
  • 2
  • 12
  • 19
37
votes
7 answers

How to renice all threads (and children) of one process on Linux?

Linux does not (yet) follow the POSIX.1 standard which says that a renice on a process affects "all system scope threads in the process", because according to the pthreads(7) doc "threads do not share a common nice value". However, sometimes, it can…
Totor
  • 19,302
  • 17
  • 75
  • 102
29
votes
4 answers

Are Linux kernel threads really kernel processes?

I've read in many places that Linux creates a kernel thread for each user thread in a Java VM. (I see the term "kernel thread" used in two different ways: a thread created to do core OS work and a thread the OS is aware of and schedules to perform…
Ellen Spertus
  • 1,193
  • 1
  • 12
  • 16
27
votes
3 answers

How does Linux tell threads apart from child processes?

Linux doesn't actually distinguish between processes and threads, and implements both as a data structure task_struct. So what does Linux provide to some programs for them to tell threads of a process from its child processes? For example, Is there…
Tim
  • 98,580
  • 191
  • 570
  • 977
27
votes
4 answers

How can I kill a particular thread of a process?

$ ps -e -T | grep myp | grep -v grep 797 797 ? 00:00:00 myp 797 798 ? 00:00:00 myp 797 799 ? 00:00:00 myp 797 800 ? 00:00:00 myp This shows the process myp with PID = 797 and four threads with different…
Lazer
  • 34,477
  • 25
  • 70
  • 75
15
votes
1 answer

What are the relations between processes, kernel threads, lightweight processes and user threads in Unix?

Unix Internal by Vahalia have figures showing the relations between processes, kernel threads, lightweight processes, and user threads. This book gives most attention to SVR4.2, and it also explores 4.4BSD, Solaris 2.x, Mach, and Digital UNIX in…
Tim
  • 98,580
  • 191
  • 570
  • 977
15
votes
3 answers

How to kill an individual thread under a process in linux?

These are the individual threads of Packet Receiver process. Is there any way to kill any individual thread? Does Linux provide any specific command which can kill or send stop signal to any particular thread under a process?
Md. Kawsaruzzaman
  • 155
  • 1
  • 1
  • 9
14
votes
2 answers

Understanding the differences between pid_max, ulimit -u and thread_max

I am trying to understand the Linux processes. I'm confused on the respective terms pid_max, ulimit -u and thread_max. What exactly is the difference between these terms? Can someone clarify the differences?
Ramesh
  • 38,687
  • 43
  • 140
  • 215
12
votes
1 answer

What information can I find out about an eventpoll on a running thread?

Following on from a problem described in "How is it that I can attach strace to a process that isn't in the output of ps?" I'm trying to debug a process that hangs part way through. By using strace -f on my parent process, I was able to determine…
Dancrumb
  • 610
  • 1
  • 7
  • 17
11
votes
1 answer

Get PID from TID

I run iotop to check on programs that are heavy disk users, in case I need to decrease their priority. Usually this is good enough, but iotop only shows thread ID (TID), and sometimes I want to know process ID (PID) so I can find out more about…
Nathaniel M. Beaver
  • 1,246
  • 13
  • 28
9
votes
3 answers

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 network to be the bottleneck or C) Complex database…
Eric Stotch
  • 103
  • 5
9
votes
2 answers

The program pstree and htop showing threads with unique PIDS. How is this possible?

I ran the program pstree -p 31872 which printed the following output: ruby(31872)─┬─{ruby}(31906) └─{ruby}(32372) The man page for pstree says: Child threads of a process are found under the parent process and are shown…
stantona
  • 465
  • 1
  • 5
  • 10
9
votes
5 answers

Threads vs (Forked) Processes

Linux applications generally fork then exec (with execve() ), but Java applications, and certain Apache MPMs use threading. If forking, uses the fork + exec to spawn a process, what is the high level version for threading? How does JVM or Worker…
Gregg Leventhal
  • 7,480
  • 19
  • 65
  • 100
1
2 3 4 5 6 7 8