Questions tagged [multithreading]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

How can a single thread freeze Gnome?

I have a CPU with 16 cores and 24 threads and Inkscape is only maxing out a single thread for its Trace Bitmap function (Multicolor, Autotrace). Still, it shows a "not responding" message ...
1 vote
1 answer
83 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 ...
0 votes
1 answer
13 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 ...
  • 487
1 vote
0 answers
47 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 ...
  • 365
0 votes
1 answer
56 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 ...
  • 3
0 votes
1 answer
80 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 ...
  • 177
0 votes
0 answers
45 views

user and kernel threads mapping

In this link in the many to many model , it states that : The user thread programming facilities are shared between the threads library and the kernel threads. What does this exactly mean?
  • 87
1 vote
0 answers
119 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 ...
  • 225
2 votes
1 answer
665 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-...
  • 233
1 vote
1 answer
103 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 ...
  • 2,299
1 vote
2 answers
150 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 ...
2 votes
1 answer
890 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 ...
  • 131
0 votes
0 answers
109 views

When to use named FIFO over posix message queues for IPC and process-thread communication

Trying to understand which IPC mechanism (mqueue vs mkfifo) is preferred to use in which scenario. I have got two different processes/tasks and multiple threads running in one of the processes. The ...
  • 121
1 vote
1 answer
278 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 ...
  • 111
0 votes
1 answer
285 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\>...
1 vote
1 answer
828 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 ...
  • 304
1 vote
1 answer
314 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 ...
  • 113
2 votes
2 answers
521 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 "*....
3 votes
3 answers
542 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; ...
1 vote
1 answer
115 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/...
2 votes
2 answers
852 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 ...
0 votes
1 answer
437 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 ...
  • 487
3 votes
3 answers
364 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 ...
2 votes
0 answers
61 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 (...
  • 121
0 votes
1 answer
244 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 ...
0 votes
1 answer
91 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, ...
0 votes
1 answer
135 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 ...
  • 135
2 votes
1 answer
154 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 ...
16 votes
3 answers
20k 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 ...
  • 267
-1 votes
1 answer
946 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 ...
3 votes
2 answers
234 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(...
  • 133
0 votes
1 answer
160 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 ...
  • 131
0 votes
2 answers
288 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 ...
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 ...
0 votes
0 answers
567 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 ...
  • 111
1 vote
1 answer
427 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....
1 vote
1 answer
393 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?
  • 11
1 vote
0 answers
338 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. ...
  • 31
25 votes
1 answer
3k 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?
  • 30.7k
0 votes
1 answer
99 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 ...
  • 101
1 vote
0 answers
217 views

Using libhugetlbfs to transparently back up glibc malloc calls in a multi-threaded application

I'm trying to back up the memory allocations of a multi-threaded application with 1GiB hugepages using libhugetlbfs. However, only the main thread allocations are being assigned hugepages. If I ...
0 votes
1 answer
2k views

What types of threads does Java/JVM use from Linux OS's perspective?

A developer friend of mine recently asked the question: On a Linux system when a Java application runs which has threads, how do these threads appear to the underlying Linux OS? So what are Java ...
  • 350k
3 votes
1 answer
9k views

Multithreaded xz, with gzip, pv, and pipes - is this the most efficient I can get?

I'm excited to learn that xz now supports multithreading: xz --threads=0 But now I want to utilise this as much as possible. For example, to recompress gzips as xz: gzip -d -k -c myfile.gz | pv | ...
3 votes
1 answer
623 views

Why is this code exiting with return code 16?

I am trying my hands on clone() system call to create a Thread. However program is terminating itself as it return from t2_thread() function. Why is this behaviour? What am I missing? #define ...
  • 67
1 vote
1 answer
872 views

How to correctly create and stop kthreads?

I wrote the following kernel module: #include <linux/module.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/kthread.h> #include <...
0 votes
1 answer
85 views

How to limit the amount of spillover to other CPUs from a single process

Please excuse the complete ignorance of my question - I'm probably lacking the right terminology here... I am trying to understand how a single process (R session) can spill over to all CPUs on our ...
2 votes
0 answers
159 views

Linux task state different in /proc/pid/stat compared to Ftrace output of sched events

I'm trying to trace the flow of a piece of code just to understand the points where the tasks go into D/S/R states (uninterruptible/interruptible/running). I do understand the meaning of each state, ...
  • 41
0 votes
2 answers
369 views

Lightweight processes behavior with an new PID

I've been experimenting with lightweight processes. Basically calling the clone function and assigning a new PID to the cloned LWP. This works fine it lets me identify all the children threads of ...
1 vote
0 answers
77 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 ...
  • 11
3 votes
1 answer
403 views

Is mkdir -p safe to parallelize?

I'm writing Makefile rules like this: out/%.x: ... mkdir -p $(@D)/ ... I intend to parallelize this Makefile (-j), which will trigger many mkdir -p's to simultaneously. Is this safe? Or do ...
  • 2,933