Questions tagged [pthreads]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
9
votes
1answer
5k 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 ...
4
votes
2answers
566 views

unable to create new native Thread or Resource temporarily unavailable after 10K threads

I'm trying to allocate more than 10K threads on both a Fedora 30 (12GB of RAM) and Ubuntu 16 Linux machines (16GB of RAM). I get these errors around 10k threads: Java: unable to create new native ...
4
votes
0answers
1k views

Portable way to get all thread ids running inside a process.

During the porting of an application form Linux to FreeBSD I came up with the following problem. I need to get all thread id of all threads running inside my application. In terms of PThreads, I need ...
3
votes
1answer
57 views

Unlimited stack size with pthreads

My default stack size (according to ulimit -s) is 8192 kB, so naturally the code below segfaults when I try to run it. Also, naturally, it works fine if I do a 'ulimit -s 9000'. However, when I do a '...
3
votes
1answer
82 views

Scheduling policy of a POSIX thread Vs kernel's Completely Fair Scheduler when the thread is actually executing

I have some doubts about setting the policy of a thread and how that policy is going to be followed while it is executing. Pthread allows setting the scheduling policy of a thread to SCHED_FIFO/...
2
votes
1answer
166 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/...
2
votes
0answers
466 views

Suddenly I see a lot of involuntary context switches for multi threaded app

I have a multi-threaded app, with 4 worker threads that until recently performed very well on my 4-core CPU. The system is running Ubuntu 16.04.3 LTS. Today I updated my OS with sudo apt-get dist-...
1
vote
1answer
48 views

What is the process state when pthread_mutex() is executed

Following are the Linux Process states; R: running or runnable, it is just waiting for the CPU to process it S: Interruptible sleep, waiting for an event to complete, such as input from the terminal D:...
1
vote
1answer
76 views

Why is No manual entry for pthread_mutex_lockerror prompted?

I want to check the use of the pthread_mutex_lock function, so I execute the command man pthread_mutex_lock, the result appears No manual entry for pthread_mutex_lock. I checked the information on ...
1
vote
1answer
28 views

Installing Read/Write locks documentation on Debian

I'm trying to write a program that uses read/write locks and would like to install the man pages for this type of lock. I already have installed the packages manpages-dev man-db glibc-doc Could you ...
1
vote
2answers
739 views

How to comprehend Cpus_allowed and thread id number?

Environment: OS --debian + python3. All the output info below ommit unimportant. Get my computer's cpu info with cat /proc/cpuinfo : cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu ...
1
vote
0answers
41 views

Behavior of Linux kernel with respect to machine check exceptions (MCE) and threads

I was recently working with custom hardware that was not fully respecting the PCIe bus standards, and certain reads from the device would cause a bus fault and Linux machine check exception. When this ...
1
vote
1answer
87 views

file lock existence check on remote host

I want to check the existence of file lock on a file in gluster file system. So that I can see from any host that whether file lock is held by any process (remote or local) on file in gluster file ...
1
vote
0answers
88 views

Linux (kernel 3.x and 4.x) Pthread and general process scheduling algorithms

I was wondering if both scheduling (contention) scopes (SYSTEM and PROCESS) are used in the Linux kernel scheduling logic. POSIX supports PROCESS scope pthreads (MXN model) and SYSTEM scope pthreads (...
0
votes
2answers
38 views

Thread Creation

Why do we use pthread_exit(NULL) method in main() method when creating threads? #include <stdio.h> #include <unistd.h> #include <pthread.h> void *message(void *arg){ char *...
0
votes
1answer
16 views

Schedule jobs from a queue onto multiple threads

I have a function that has to process all files in a set of directories (anything between 5-300 files). The number of parallel threads to be used is user-specified (usually 4). The idea is to start ...
0
votes
1answer
848 views

Is it recommended to use param.sched_priority in Linux FIFO during thread creation?

In my embedded device I absorb strange behaviour with the protocol we use, sometimes it takes a while to send the data via serial device using FIFO. My suspicion is Linux is not real-time OS and why ...
0
votes
0answers
24 views

FFMPEG : streaming two different videos using the same resource

I'm trying to use FFMPEG to stream a video to a web-server, I'm using Local-host for now,It works like a charm Both on MacOs and Ubuntu, But I want to try streaming two videos, on the same resource (...
0
votes
1answer
26 views

Problems with pthread scheduling and output

I am having some problems with outputing my threads in a right order. My program needs to take at least 2 parameters (could be more, but always 2 at a time because one is integer(how many second does ...
0
votes
0answers
26 views

Linux pthread_cond_wait hangs in NASM

The following NASM code uses pthread_cond_wait to take 4 cores (numbered 0, 8, 16, 24) in core order, starting with core 0. After each core locks the mutex, it enters mutex_lock_loop where it tests ...
0
votes
1answer
34 views

Do all threads originating from the same process sleep on wait_event_interruptible()?

If I have 3 pthreads: A, B, C, all originating from the same process, running in user space and one thread, thread B does a blocking read from a kernel module and is put to sleep, will threads A and C ...
0
votes
0answers
200 views

Can a signal in one thread, interrupt sleep period of another thread of the same process in linux

There are two threads (parent thread and child thread, both runs in their own infinite loop) in a process. The parent thread does only one work, i.e. to continuously (while(1)) check the system time ...
0
votes
1answer
574 views

How can I view threads for a running process that is creating threads?

I made a very small program that creates two threads: #include <pthread.h> #include <stdio.h> #include <unistd.h> void *start() { printf("Am a new thread!\n"); ...
0
votes
1answer
4k views

Custom priority value: is a pthread high sched prio positive or negative?

I’m trying to reimplement in a backward-compatible way the RobotC API from C (although some details would better fit or would be easier with C++), and trying to reimplement their multithreading API in ...
-1
votes
1answer
923 views

fatal error : linux/interrupt.h : no such file or directory

I am developing code for interrupt. When I am including #include <linux/interrupt.h>, I get fatal error : linux/interrupt.h no such file or directory Why am I getting this error and how can I ...