LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-22-2023, 08:11 AM   #1
jt1122
Member
 
Registered: Apr 2021
Posts: 140

Rep: Reputation: Disabled
ulimit -R


from the bash man, ulimit options:"-R The maximum time a real-time process can run before blocking, in microseconds"

Code:
(ulimit -R 1000;x=1; while true;do let x+=1;echo $x;done)
doesn't stop after 1sec. why?

Thanks
 
Old 11-22-2023, 10:52 AM   #2
lvm_
Member
 
Registered: Jul 2020
Posts: 940

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
In bash's man page clarity is sacrificed for brevity. getrlimit man page describes it in more detail:

Code:
       RLIMIT_RTTIME (since Linux 2.6.25)
              This is a limit (in microseconds) on the amount of CPU
              time that a process scheduled under a real-time scheduling
              policy may consume without making a blocking system call.
              For the purpose of this limit, each time a process makes a
              blocking system call, the count of its consumed CPU time
              is reset to zero.  The CPU time count is not reset if the
              process continues trying to use the CPU but is preempted,
              its time slice expires, or it calls sched_yield(2).

              Upon reaching the soft limit, the process is sent a
              SIGXCPU signal.  If the process catches or ignores this
              signal and continues consuming CPU time, then SIGXCPU will
              be generated once each second until the hard limit is
              reached, at which point the process is sent a SIGKILL
              signal.

              The intended use of this limit is to stop a runaway real-
              time process from locking up the system.

              For further details on real-time scheduling policies, see
              sched(7)
In short, it doesn't do what you expect it to do, you should've used timeout (as in 'man timeout')
 
Old 11-22-2023, 11:02 AM   #3
jt1122
Member
 
Registered: Apr 2021
Posts: 140

Original Poster
Rep: Reputation: Disabled
Thanks.

Doesn't this mean stopping a process after a preset time:
Code:
The intended use of this limit is to stop a runaway real-time process from locking up the system.
?
 
Old 11-22-2023, 11:36 AM   #4
lvm_
Member
 
Registered: Jul 2020
Posts: 940

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
Yes, but not just any old process but only a processes with real-time scheduling priority - which bash definitely isn't, which hasn't issued any blocking calls within the limit and keeps ignoring repeated requests to yield time to other processes.
 
Old 11-22-2023, 12:01 PM   #5
jt1122
Member
 
Registered: Apr 2021
Posts: 140

Original Poster
Rep: Reputation: Disabled
thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ulimit -s 40960 vs ulimit ulimit -s 10240 centguy Linux - Software 2 10-22-2016 11:38 PM
ulimit Serena Linux - Software 6 12-17-2014 11:04 PM
[SOLVED] Cannot set ulimit -l, says ulimit: max locked memory: cannot modify limit Xiano Slackware 1 07-24-2014 02:58 AM
Ulimit privilege for a user linuxfans Linux - General 3 04-16-2003 12:03 PM
ulimit -n evilrico Linux - Distributions 0 03-14-2003 04:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration