Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [thread]

The tag has no usage guidance.

1
vote
0answers
14 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 *...
0
votes
0answers
17 views

understanding how threads are created inside linux operating system

I am currently studying on Linux operating system. My problem is with threads inside Linux. I know that every process has it own PCB of size 1KB inside the kernel and an additional 7KB stack ...
1
vote
0answers
27 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, ...
0
votes
0answers
11 views

Killing a thread in Python (which is descendant of current process) [duplicate]

Normally, Linux threads cannot be killed outside the main proces's scope, except by killing the main process itself, however, I need to do so. I made a threaded program which needs to have a complete ...
0
votes
1answer
22 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
1answer
39 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
1answer
41 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 ...
0
votes
2answers
52 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 ...
1
vote
2answers
118 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 ...
2
votes
1answer
117 views

Are tid and tgid always the same as pid in the output of ps?

In manpage of ps tid TID the unique number representing a dispatchable entity (alias lwp, spid). This value may also appear as: a ...
0
votes
2answers
84 views

thread dump of Java using Kill -3

I used to take thread dumps using: kill -3 `pidof java` This will create thread dumps in catalina.out ; how to get those output to a file rather than in catalina.out. Usually kill command won't ...
0
votes
1answer
35 views

Does software threads include user threads?

From this answer - software threads vs hardware threads, software threads are threads managed by OS. But I also learn another term called user threads, which are threads that's not kernel threads, i.e....
2
votes
0answers
53 views

OpenBSD threads priorities

Can anybody explain how to work with thread priorities in OpenBSD? Information about this question in MAN pages is poor, it does not give clear understanding. In particular: sched_get_priority_min/...
0
votes
0answers
25 views

How do you determine the priority of Linux system processes?

I've currently inherited some legacy code in which the user program spawns two threads running at priority level 49. Here's a snippet for one of the threads: SchedParam.sched_priority = 49; if(...
12
votes
1answer
3k views

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

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 ...
1
vote
1answer
148 views

Is a light weight process attached to a kernel thread in Linux?

Based on my understanding from Understanding the Linux Kernel, is it correct that: kernel threads and light weight processes in Linux kernel are both represented by task_struct structure in C. ...
0
votes
1answer
57 views

Error message “jrcmd: not found” when I execute a script

I am getting the error below when I execute a script: Ksh: line 1: jrcmd: not found When I execute the same command in weblogic server, I get the output, but executing the same command inside a ...
2
votes
1answer
60 views

Run process as if on a single-core machine to find a bug

I have a bug in my Linux app that is reproducable only on single-core CPUs. To debug it, I want to start the process from the command line so that it is limited to 1 CPU even on my multi-processor ...
0
votes
1answer
113 views

What is contention? [closed]

I have been asked to measure the contention of locks a write process is causing. I was looking at the data of the lockstat for that write process. My questions are below: Is contention related to ...
0
votes
3answers
271 views

How does the kernel knows which “threads”/processes are associated with a process? [duplicate]

As I have read, a "thread" in Linux is just a process. Say that a process created two "threads", now when the process is terminated, the two "threads"/processes that are associated with the process ...
0
votes
1answer
164 views

What does “asynchronous” mean in these cases?

I have asked what "asynchronous" means a while ago for interrupts. Now I have the same question but for running shell commands and for cancelling threads. From Bash manual If a command is ...
20
votes
3answers
3k views

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 ...
5
votes
1answer
2k views

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 ...
0
votes
1answer
43 views

Count the number of processes during compiling code

We are using ant as build system that calls different other tools (Java tools, Python scripts, Perl scripts, LaTeX and so on). Now I would like to know how many processes have been created during the ...
0
votes
1answer
95 views

Differences between threading and processes? [closed]

In an operating systems course (the operating System on which the course is covered is Linux) that I am participating in, we are told that: Processes have priority values which determine what process ...
2
votes
0answers
226 views

How to make strace keep following children after the death of the father/mother:))?

I use this command to trace all the things that are done or started from a shell. sudo strace -e trace=memory -o outm -ff -p <the pid of the terminal instance I want to trace> -f But the ...
13
votes
2answers
5k views

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 ...
2
votes
0answers
76 views

determining number of free threads

Suppose that on a computer capable of processing n simultaneous threads, one wishes to launch n-m single-thread jobs where m is the number of threads currently in use. How is m defined and by what ...
1
vote
1answer
603 views

Could someone explain the sleep/wake dynamics in Linux?

I am studying the locking mechanisms in an OS and came across these POSIX functions: pthread_cond_wait(pthread_cond_t *c, pthread_mutex_t *m); pthread_cond_signal(pthread_cond_t *c); I fully ...
1
vote
0answers
229 views

Mapping Kernel-level Threads, User-level Threads to Process/Threads

I know this question has been brought up many times, however I can't find anywhere a definitive answer, so here it goes again: Is it true that Kernel Level Thread has it's own unique PID, while the ...
59
votes
7answers
14k views

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 ...
2
votes
0answers
323 views

Can thread ID be 0?

While traversing /proc/$PID/task/ directory, my program sometimes (rarely) comes across a subdirectory with name 0. After I notice this and check the directory, there's no such subdirectory already. ...
1
vote
1answer
502 views

Show running processes only — *not* threads

How do I show running processes for every user? Only the processes. I tried ps -e or ps -A, but it also shows the [ name ] which are threads.
1
vote
1answer
3k views

Does nproc in limits.conf refers to number of processes or number of threads?

If I want to check if I got to the max of the nproc value should I do: ps -ef | wc -l Or ps -efL | wc -l Does nproc in limits.conf refers to number of processes or number of threads?
0
votes
1answer
579 views

Multithreaded applications on a single threaded CPU?

The motivation behind this question arises from exploring the Intel Galileo gen2 board which has a single threaded processor. I'm looking for a conceptual explanation on what does that mean for all ...
-1
votes
1answer
63 views

Are there UNIX variants or other OS which make user level threads visible to OS kernel? [closed]

Are there UNIX variants or other OS which make user level threads visible to OS kernel ?
0
votes
1answer
427 views

How are separate stacks for different threads allocated in kernel mode for a process in Linux Kernel?

If a system call is made for a process and sitting in kernel mode, if 2 threads are created then a)how are the stacks for each thread is created in kernel? b)If one of the thread switch back to ...
19
votes
5answers
4k views

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 ...
2
votes
3answers
11k views

Too many rcuos and rcuob processes in my VM

I am running CentOS 7.2 (3.10.0-327.18.2.el7.x86_64) as VMware guest with 2 cpu and 6 GB RAM on my Lenevo W540 iCore 7 having 32 GB RAM. I see 128 processes each for rcuos and rcuob in my VM. This ...
2
votes
1answer
110 views

Pthread scheduler scope variables?

I read that their is 1:1 mapping of user and kernel thread in linux What is the difference between PTHREAD_SCOPE_PROCESS & PTHREAD_SCOPE_SYSTEM in linux if kernel is considering every thread ...
4
votes
2answers
1k views

Status of a threads vs. status of a process

Do all threads of a specific process share the same status (D, R, S, ...) or may there be differences among these threads? If so, where in /proc do I find information about the status of a certain ...
0
votes
1answer
319 views

Multithreading (increasing the number of threads for the process)

I wonder if there is any way of adding thread to specific process just to prove that number of thread which are assigned to process can be changed by user. If so, how could I do that ? [root@195689 ...
5
votes
1answer
531 views

Does POSIX define context switch?

Is a POSIX context switch well-defined? Is it the same thing as switching threads in C? Can the C compiler generate everything for a context switch or is assembly programming still needed for a ...
1
vote
1answer
1k views

Understanding Linux Perf sched-switch and context-switches

I've been trying to enable context switch events on perf and use perf script's dump from perf.data to investigate thread blocked time. So far the only two recording options that seem to be helpful ...
0
votes
2answers
716 views

Sleep system call and its time parameter

Let's say that we are writing a C program that calls the sleep() function. For instance, by calling sleep(7), the calling thread would be put to sleep for 7 seconds. My question is: Will the thread ...
32
votes
3answers
48k views

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 ...
1
vote
1answer
526 views

Threads vs interrupts

What does it mean when threads are time-sliced? Does that mean they work as interrupts, don't exit while routine is not finished? Or it executes one instruction from one thread then one instruction ...
4
votes
2answers
5k views

How can I know thread names that run on specific core

I am working in Java code. My code makes specific Java threads run on specific cores. In this code, I give names to Java threads. I need a Linux command that enables me to know the threads' names that ...
1
vote
2answers
2k views

Number of Threads in Kernel

How can I get the number of threads in the kernel at specific sampling rate? I need to measure the utilization of the system directly by myself.
1
vote
2answers
6k views

'htop' process and threads cpu usage?

I'm observing a multi threaded process in htop in tree view. If I were to strip it just to the problematic part, it looks somewhat like this: CPU% bin/process 100 `- ...