Skip to main content

Questions tagged [multithreading]

The tag has no usage guidance.

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

How does timer-interrupt occur in XV6?

I implemented thread's switching using functions like thread_schedule(), and thread_yield(), which aim at saving current thread's registers and state and loading next thread's one. I now want to ...
iAmYoUrAnGeL's user avatar
2 votes
1 answer
49 views

Thread Name: Is /proc/pid/comm always identical to the Name: line of /proc/pid/status and the second field of /proc/pid/stat?

A Linux thread or forked process may change its name and/or its commandline as visible by ps or in the /proc filesystem. When using the python-setproctitle package, the same change occurs on /proc/pid/...
Juergen's user avatar
  • 684
0 votes
1 answer
32 views

Relationship between number of cores and ability to run processes with higher nice values?

When I "flood" my CPU with 8 high priority (nice=-20) OS threads (the number of cores I have), operation becomes "halty" for obvious reasons, but is still usable. Note that when I ...
doliphin's user avatar
  • 125
0 votes
1 answer
121 views

linux find files with multiple threads

I made a search but couldn't find anything similar. I have huge codebases ( AOSP or Yocto ) stored in ext4 formatted NVME drives ( such as SAMSUNG 980Pro ). These codebases usually consist of hundreds ...
Sertac TULLUK's user avatar
3 votes
2 answers
999 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,785
0 votes
1 answer
58 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 ...
JenyaKh's user avatar
  • 346
0 votes
0 answers
2k views

Does Linux provide a method to fix a thread to a P-core or E-core?

On chips 12th gen and newer in the Intel lineup, (and I'm told on ARM chips) there are distinct classes of cores with different clock speeds P-cores for performance, higher clock speed E-cores for ...
Evan Carroll's user avatar
  • 31.6k
0 votes
0 answers
55 views

Frequency of Intra versus interprocess context switching

In a book I'm reading (from 2013) it says that, in the Linux Kernel, intraprocess switching is much more cheaper than interprocess switching, I guess, because the switching in a same CPU between two ...
ABu's user avatar
  • 556
0 votes
1 answer
448 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 ...
ThreadFrank's user avatar
0 votes
0 answers
116 views

sigtimedwait sets errno to ETIMEDOUT with timeout=0

In a cpp multithreaded program, we're using a copy of Linux sigwait implementation at the end of our main function, after creating all threads and initializing our program: sigset_t mask; ...
binks's user avatar
  • 1
3 votes
2 answers
605 views

Why does higher CPU-usage slow down a task?

I am using whisper.cpp to transcribe some sound files. It is a very CPU heavy process so I try to find some optimal settings and therefore I have done some tests with the thread setting (-t) but the ...
d-b's user avatar
  • 1,937
2 votes
1 answer
574 views

How does round-robin scheduling and context switching work from a low-level?

Using round-robin scheduling, the kernel provides time slices for different processes / tasks. It seems that the kernel will initialize a timer, and when the timer times out, this will cause the ...
Engineer999's user avatar
  • 1,171
4 votes
1 answer
1k views

Does thread stack comes from the memory mapping segment of the process on Linux?

I'm currently studying Linux. I know the thread is a kind of lightweight process on Linux. But I wonder to know where the thread stack space comes from. The stack of the thread is private. It is ...
Kevin eyeson's user avatar
1 vote
2 answers
663 views

Looking for a linux backup tool multithreaded with encryption and good compression algorithm

I am looking for a linux backup tool to upgrade my backup strategy. Today I do full backups everyday on Linux server (Ubuntu 20.04). I prefer to backup data directly inside our VMs and send to another ...
moe69230's user avatar
0 votes
1 answer
75 views

Is there an implementation of POSIX semaphore not based on Mutex+CV?

I read that semaphores in the FreeBSD kernel is not as efficient as Mutex+CV from this man page. I've examined the kernel and syscall implementation of POSIX semaphore from the source code and ...
DannyNiu's user avatar
  • 620
1 vote
0 answers
55 views

Task takes 15 minutes with one processor and 20 minutes with two processors

This is the command, run at the root of an NTFS partition from a Debian 12 VM (VirtualBox) $ (find . -type f -exec cat {} \;) | pv | wc -c I was trying to check that all files are readable. It's a ...
golimar's user avatar
  • 417
0 votes
1 answer
381 views

Linux multiprocessors support

I am reading the following paper. In the paper, the authors argue that Unix/Linux "has struggled for a decade to support multiprocessors in a single node" in the last paragraph of the first ...
UVY's user avatar
  • 3
0 votes
1 answer
266 views

How can I create a dummy multi-threaded process and get its tids using common utilities?

I can make a dummy process that will hang forever and get its PID with: bash -c 'echo $$; read' I'd like a multi-threaded alternative to this one-liner which creates 2+ threads, prints the thread ids ...
jrpear's user avatar
  • 424
1 vote
0 answers
630 views

File locking from different therads of the same process, including for Solaris OS

I need to perform a file lock when accessing a file from C/C++ code with the following requirements: Blocking should be performed when access occurs not only from different processes, but also from ...
ibse's user avatar
  • 315
1 vote
1 answer
2k views

How to run one command on several cores

I have a command which I want to run on all free cores to speed up the execution time. Specifically I am running the Pitman-Yor Adaptor-Grammar Sampler software I downloaded from here ./py-cfg/py-cfg-...
M.A.G's user avatar
  • 261
1 vote
1 answer
697 views

Understanding load average on multicore system with a multithreaded app

We have a curious situation regarding load average on our system. It's running an application called ZAG that is idle most of the day. But every 80 minutes or so, it has some sort of activity burst of ...
Mike S's user avatar
  • 2,572
1 vote
2 answers
266 views

Spike in number of page faults with make -j`nproc`

I am running a benchmark to figure out the number of jobs I should allow GNU Make to use in order to have optimal compile time. To do so, I am compiling Glibc with make -j<N> with N an integer ...
Abdelhakim AKODADI's user avatar
4 votes
1 answer
6k views

Understanding overhead cost of context switching

I've always read/heard that context switching is expensive. I recently started reading Robert Love's "Linux Kernel Development" and have made it through the Processes and Process Scheduling ...
Joe's user avatar
  • 151
1 vote
1 answer
657 views

Linux equivalent of Thread Director?

The 12th Generation Intel chips are rumoured to have "Efficient" and "Performance" cores. Apparently Microsoft's Thread Director, in Windows 11, takes advantage of them. What will ...
power's user avatar
  • 111
0 votes
1 answer
1k views

Help understanding lsof and threads

When i use -p $PID on lsof i get only the immediate thread of the process. why and how to work with threads and lsof effectively? sudo lsof -p 5344 > lsof-p5344.log sudo lsof | grep '\<5344\>...
Gabriel's user avatar
11 votes
1 answer
5k views

Why do threads have their own PID?

I'm using htop and looking at a process (rg) which launched multiple threads to search for text in files, here's the tree view in htop: PID Command 1019 |- rg 'search this' 1021 |- rg 'search ...
Dean's user avatar
  • 454
1 vote
1 answer
802 views

xz: OOM when compressing 1TB .tar

I'm trying to compress a large archive with multi-threading enabled, however, my system keeps freezing up and runs out of memory. OS: Manjaro 21.1.0 Pahvo Kernel: x86_64 Linux 5.13.1-3-MANJARO ...
JKleinne's user avatar
  • 113
3 votes
2 answers
3k views

Simple BASH script to become a multi-process/'threaded' BASH script?

I have the following, working BASH script, which I run on a Mac Pro 2010/Mojarve OS: #!/bin/bash c=0 cnt=0 # count up wav files cnt=$(find /hummdinger/LoCI/LoCI_orig/VO/WAV_Processed/ -name "*....
Benjamin Rich's user avatar
3 votes
3 answers
2k views

How can I parallelize command sha256sum or other hashing commands?

I want to parallelize hash calculation process because I have a very large amount of file counts and sizes. When I see CPU usage of these commands, I get upset because they are only using one thread; ...
Berkant E.'s user avatar
1 vote
1 answer
169 views

FIFO number of processes, sustained growth

I have a FIFO question: Why the fifo thread_num limit 2, but number of processes, sustained growth when one process ends, two processes start, and then got 3 processes. sustained growth 2n-1 #!bin/...
wangjiaying's user avatar
3 votes
2 answers
3k views

How to run a bash script using threads/parallel

I am running the following bash script as is. I.e. sequentially. Note that the prefetch and fastq-dump are calls for downloading files from a database, and _shrink is a C++ program that I have made to ...
GoldenRetriever's user avatar
0 votes
1 answer
1k views

Which thread receives SIGURG?

I recently wrote a "study note" about Unix, and I made following proposition about multi-threaded processes: it will be almost impossible for the kernel to identify the thread that should ...
DannyNiu's user avatar
  • 620
3 votes
3 answers
944 views

Boosting the grep search using GNU parallel

I am using the following grep script to output all the unmatched patterns: grep -oFf patterns.txt large_strings.txt | grep -vFf - patterns.txt > unmatched_patterns.txt patterns file contains the ...
user3441801's user avatar
2 votes
0 answers
271 views

JVM only uses 4 cores

I have a processor-intensive Java program and I want it to use all 8 available cores on the machine. I've run taskset and it reports the mask to be: pid 5897's current affinity mask: ff But in top (...
SandTh's user avatar
  • 121
0 votes
1 answer
510 views

How to switch from one process to another process and kill the first process

I have the following scenario, I have two programs running one in the background and one in front. The back program is doing some stuff for the front program. once the back program has done the ...
emaan daavis's user avatar
0 votes
1 answer
211 views

Bind 9 process of named is using one core cpu only

i Have a DNS server running on Debian os , the named process is taking 394% of cpu. i noticed it is using one core of the 1 cores provided to the whole VM . top - 17:29:04 up 105 days, 1:33, 1 user, ...
Nour Eddin's user avatar
0 votes
1 answer
472 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 ...
tpb261's user avatar
  • 135
2 votes
1 answer
492 views

All processes running on the same core

I found all processes on my machine to only run on a single core and their core affinity set to 0. Here is a small python script which reproduces this for me: import multiprocessing import numpy as np ...
Roofkiller's user avatar
29 votes
3 answers
54k views

How to use multi-threading for creating and extracting tar.xz

I use tar -cJvf resultfile.tar.xz files_to_compress to create tar.xz and tar -xzvf resultfile.tar.xz to extract the archive in current directory. How to use multi threading in both cases? I don't ...
ewr3243's user avatar
  • 397
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
4 votes
2 answers
409 views

What are these threads named disk$0, disk$1, etc.?

I am using Ubuntu 20.04 LTS. The kernel version is 5.4.0-42. Here is an example program: // mre.c // Compile with: cc -o mre mre.c -lSDL2 #include <stdio.h> #include <SDL2/SDL.h> int main(...
JudeMH's user avatar
  • 143
0 votes
1 answer
512 views

Does a process filling all logical cores have a negative impact on performance? [closed]

Because of hyper-threading, my CPU has 2 logical processors per core. If I understand the premise of hyper-threading correctly, it allows each core to have a separate cache and instruction pointer for ...
Charlim's user avatar
  • 131
0 votes
2 answers
407 views

massive resource consumption during mkfs.ntfs on a zvol, why (and how can I limit this)?

On my machine mkfs.ntfs is slow and results in massive use of resources, preventing me from using the machine for anything else. According to top it (or rather directly related zvol processes) is ...
Stonecraft's user avatar
18 votes
4 answers
3k views

Are basic POSIX utilities parallelized?

In a common Linux distribution, do utilities like rm, mv, ls, grep, wc, etc. run in parallel on their arguments? In other words, if I grep a huge file on a 32-threaded CPU, will it go faster than on ...
homocomputeris's user avatar
0 votes
0 answers
794 views

IPSec multithreading via pcrypt worse than single thread

According to this document: https://www.strongswan.org/docs/Steffen_Klassert_Parallelizing_IPsec.pdf parallelizing IPSec using pcrypt kernel module will make the connection much more efficient (graphs ...
dywan666's user avatar
  • 111
1 vote
1 answer
550 views

Threads to process a million files [closed]

How many threads should be used to process a million files? How yould you justify your answer? This is a question from an OS exam from last year and I'm courious how you guys think. I think that 10....
Andrei Gabor's user avatar
1 vote
1 answer
609 views

In Solaris box how do we check if hyper-threading/multi-threading is enabled or not using command?

In Solaris, how we can find the status or check hyper-threading or multi-threading is enabled or not using commands?
sandeep's user avatar
  • 11
1 vote
0 answers
392 views

macOSx / what is the kernel variable os_refcnt counting and what might be causing it to overflow?

Trying to figure out why running some software that I am developing causes my Mac to do a panic restart every 16 h or so always with an "os_refcnt" kernel variable overflow when running tcsh scripts. ...
jmf7's user avatar
  • 41
25 votes
1 answer
5k views

How to use "parallel" to speed up "sort" for big files fitting in RAM?

I have a 100 M line file that fits in RAM on a GNU/Linux system. This is rather slow: sort bigfile > bigfile.sorted and does not use all 48 cores on my machine. How do I sort that file fast?
Ole Tange's user avatar
  • 35.7k
0 votes
1 answer
170 views

Thread safe next number (or round-robin) service in linux

I have an Ubuntu machine and a scenario in which I need to generate the next number (starting from X) between 0 and 20 in a round-robin way. I need a way to get the next number which will be thread ...
winter's user avatar
  • 101