Chapter 13. System calls in RHEL for Real Time
Chapter 13. System calls in RHEL for Real Time The real-time system call is a function used by application programs to communicate with the kernel. It is a mechanism for programs to order resources from the kernel. 13.1. sched_yield() function The sched_yield() function is designed for a processor to select a process other than the running one. This type of request is prone to failure when issued from within a poorly-written application. When the sched_yield() function is used within processes with real-time priorities, it can display unexpected behavior. The process that calls sched_yield() moves to the tail of the queue of processes running at same priority. When there are no other processes running at the same priority, the process that called sched_yield() continues to run. If the priority of that process is high, it can potentially create a busy loop, rendering the machine unusable. In general, do not use sched_yield() on real-time processes. 13.2. getrusage() function The getrusage() function retrieves important information from a specified process or its threads. It reports on information such as: The number of voluntary and involuntary context switches. Major and minor page faults. Amount of memory in use. getrusage() enables you to query an application to provide information relevant to both performance tuning and debugging activities. getrusage() retrieves information that would otherwise need to be cataloged from several different files in the /proc/ directory and would be hard to synchronize with specific actions or events on the application. Note Not all the fields contained in the structure filled with getrusage() results are set by the kernel. Some of them are kept for compatibility reasons only. Additional resources getrusage(2) man page on your system