SEM(1) parallel SEM(1) (NAME) sem - (SYNOPSIS) sem [--fg] [--id ] [--semaphore-timeout ] [-j ] [--wait] command (DESCRIPTION) GNU sem GNU parallel --semaphore . GNU sem . GNU sem . num GNU sem . GNU sem ( -a ::: ::::). . . GNU sem ..SH " (OPTIONS)" command . . --bg GNU sem . . : GNU sem . : --fg --jobs N -j N --max-procs N -P N N . 1 mutex ( ) . : -j . --jobs +N -j +N --max-procs +N -P +N N CPU. . -j +0 . --jobs -N -j -N --max-procs -N -P -N N CPU. . . : --use-cpus-instead-of-cores. --jobs N% -j N% --max-procs N% -P N% N% CPU. . . : --use-cpus-instead-of-cores. --jobs procfile -j procfile --max-procs procfile -P procfile . procfile -j. procfile 100% +2 10 . --pipe stdin ( ) command. command stdin ( ) --pipe . --semaphore-name name --id name name (semaphore). tty ( tty) . name . $$ my_task_name . ~/.parallel/semaphores/ . : . --fg ( ). : GNU sem . --semaphore-timeout secs --st secs secs > 0: secs . secs < 0: secs . : secs > 0: secs . secs < 0: secs . --wait . : ..SH " (UNDERSTANDING A SEMAPHORE)" : sem -j 2 'sleep 1;echo 1 finished'; echo sem 1 exited sem -j 2 'sleep 2;echo 2 finished'; echo sem 2 exited sem -j 2 'sleep 3;echo 3 finished'; echo sem 3 exited sem -j 2 'sleep 4;echo 4 finished'; echo sem 4 exited sem --wait; echo sem --wait done (-j 2) . GNU sem '1' . '1' GNU sem '2' . '1' '2' GNU sem . '1' GNU sem '3' . '2' '3' GNU sem . '2' GNU sem '4' . GNU sem . : log.* Gzip (EXAMPLE: Gzipping *.log) gzip (CPU). CPU ( ). for i in *.log ; do echo $i sem -j+0 gzip $i ";" echo done done sem --wait : pod2html (EXAMPLE: Protecting pod2html from itself) pod2html pod2htmd.tmp pod2htmi.tmp . . pod2html ( Makefile make -j) pod2html : # This may fail due to shared pod2htmd.tmp/pod2htmi.tmp files foo.html: pod2html foo.pod --outfile foo.html bar.html: pod2html bar.pod --outfile bar.html $ make -j foo.html bar.html pod2html . sem (mutex) : foo.html: sem --id pod2html pod2html foo.pod --outfile foo.html bar.html: sem --id pod2html pod2html bar.pod --outfile bar.html clean: foo.html bar.html sem --id pod2html --wait rm -f pod2htmd.tmp pod2htmi.tmp $ make -j foo.html bar.html clean (BUGS) . (REPORTING BUGS) ..SH " (AUTHOR)" (C) 2010-2026 Ole Tange http://ole.tange.dk Free Software Foundation, Inc. (LICENSE) << >> (GNU General Public License) ( ) / . . . . . (Documentation license I) / << >> (GNU Free Documentation License) . . LICENSES/GFDL-1.3-or-later.txt . (Documentation license II) : (to Share) (to Remix) : (Attribution) ( ). (Share Alike) . : (Waiver) . (Public Domain) . (Other Rights) : o o o . (Notice) . LICENCES/CC-BY-SA-4.0.txt . (DEPENDENCIES) GNU sem Perl Getopt::Long Symbol Fcntl ..SH " (SEE ALSO)" parallel(1) 20260722 2026-07-25 SEM(1)