nproc和ulimit之间的区别?

udi*_*udi 10 unix linux

Ulimit和nproc都用于限制*nix系统中特定用户或应用程序的系统进程和资源(如果我错了,请纠正我).这两者有什么主要区别?

Lev*_*sky 19

nproccoreutils打印处理器的数量.来自man nproc:

NPROC(1)                         User Commands                        NPROC(1)

NAME
       nproc - print the number of processing units available

SYNOPSIS
       nproc [OPTION]...

DESCRIPTION
       Print  the number of processing units available to the current process,
       which may be less than the number of online processors
Run Code Online (Sandbox Code Playgroud)

但是,nproc设置/etc/security/limits.conf确实限制了进程数量:

来自man limits.conf:

       nproc
           maximum number of processes
Run Code Online (Sandbox Code Playgroud)