Questions tagged [pthreads]
For questions related to POSIX Threads API.
35 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
2
answers
661
views
How to send a signal to a set of pthread within one process in Linux?
I am working on an embedded Linux system (kernel-5.10.24).
There is a multi-threaded process needed to handle a certain of exception delivered through a signal.
The process is something like below.
...
1
vote
0
answers
169
views
mysqld thread count exceeds max_connections
As the question title suggests: I have set max_connections = 2 in my my.cnf file, but when I activate my mysql daemon, the thread count sits at 37. I am searching online but cannot find indication my ...
0
votes
0
answers
338
views
Can I prevent a pthread from ever being interrupted by the scheduler?
I'm programming an embedded real-time Linux device with a 4 core ARM CPU. There is a requirement for a periodic computation at 10 kHz that should not jitter too much and should never be lost. My POSIX ...
0
votes
1
answer
185
views
Is there a way to prevent a descendant thread from getting into cgroup of its ancestor thread automatically?
I write some threads of my app to a Linux cpu cgroup, created by me, explicitly (let us talk e.g. about v1 for now, but if you know a way for v2, that would be also great).
However, I see that ...
3
votes
2
answers
802
views
What is the region of memory allocated by malloc()?
I was writing a multi-threaded C program using pthread library. The program calls the malloc() from a thread and the main-thread. When I inspected the memory address returned by malloc(), the address ...
0
votes
1
answer
981
views
How many times has my process been preempted?
I wrote a simple program with a thread which runs on a CPU core. It spins kind of aggressively, and it takes 100% of the CPU core. I can see that with top + 1.
After N minutes, I would like to be able ...
45
votes
3
answers
9k
views
How is a signal "delivered" in Linux?
I am confused by the terminology used to describe Linux signal delivery. Most texts say things like "the signal is delivered to the process" or "the signal is delivered to the thread&...
0
votes
2
answers
810
views
Simple Scan crashes almost immediately upon start-up
I'm using simple-scan on Debian and it is now always crashing. It worked fine a few months ago. I suspect that something got upgraded (I'm running bullseye) and broke things.
The output from simple-...
0
votes
1
answer
959
views
Linker cannot find libpthread
I am trying to build 32bit versions of two programs, and both shows the same error message
/usr/bin/ld: cannot find /media/34GB/Arquivos-de-Programas-Linux/Glibc-2.17-32bit/lib/libpthread.so.0
I ...
0
votes
2
answers
548
views
Xlib: what is the best implementation of GUI digital clock?
I am making an X application which contains a digital clock. The clock displays the current time in the format of "hh:mm". I want to master Xlib, so I want to use only Xlib (no other ...
-1
votes
1
answer
84
views
What security controls exist such that user processes can't assign themselves highest priority?
I'm learning about the Linux process scheduler and have been reading through the pthread_setsched function: https://man7.org/linux/man-pages/man3/pthread_setschedparam.3.html
One thing that had ...
1
vote
1
answer
1k
views
Is it possible to get the CPU time of any thread on Linux by calling clock_gettime?
If I know the TID of an arbitrary thread that is running on my system, I can easily compute its pthread cpu clock ID. But would I be able to call clock_gettime from my program and get its CPU time? My ...
3
votes
1
answer
1k
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 '...
1
vote
1
answer
1k
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:...
0
votes
1
answer
523
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 ...