Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the code for the idle process?

Tags:

process

cpu

When the cpu isn't doing anything, it runs the idle process. I heard that this process looks for programs that are waiting in the queue so that the cpu can run them. Is that all it does? What does the code for it look like? I am also interested in knowing the file name of the system idle process in the various OSes.

like image 580
node ninja Avatar asked Feb 25 '11 00:02

node ninja


People also ask

How do I fix System Idle Process?

1) On your keyboard, press Win+R (the Windows logo key and the R key) at the same time to invoke the run box. 2) Type msconfig in the run box and click the OK button. 3) Click Open Task Manager. 4) Select one item that you don't need to open at startup and click the Disable button.

How do I check my System Idle Process?

To see the System Idle Process in action depends on the OS that you're running. In Windows 10 start the Task Manager (press CTRL-SHIFT-ESC) and click on the Details tab. Sort by CPU when your PC isn't doing much and the System Idle Process should be at the top 'using' most of your CPU's resources.

What is idle process Linux?

An idle process is waiting for some event to happen so that it can continue. For example, it can be waiting for input in a read() system call. By the way, the kernel is not a separate process.

What is idle in C?

IDLE (short for Integrated Development and Learning Environment) is an integrated development environment for Python, which has been bundled with the default implementation of the language since 1.5. 2b1.


2 Answers

The question contains several erroneous tacit assumptions. Here are some pointers:

  • It's not necessarily an idle process. It's an idle process on non-multithreading operating systems, but not on multithreading ones. Concentrating upon the process in the latter kind of operating system is concentrating upon the wrong thing. Although Microsoft Windows NT calls it an "Idle Process", and displays that in its Task Manager, the important mechanisms are the idle threads. The idle process is simply the process to which those threads belong for the sake of bookkeeping. (All threads must belong to a process.) There's no filename. (Processes don't even have names on many systems.)
  • Not all operating systems even have these idle processes/threads. On several older uniprocessor operating systems, idling the system when there was nothing to do was simply a special case in the dispatcher. This approach is problematic for multiprocessor operating systems (when one CPU is idling in a process/thread that another CPU wants to dispatch to), and is why the idea of a special process/thread that was always ready to run, one per processor in the system, so that the CPU could idle in its own private thread context, became the norm.
  • What an idle process/thread does is CPU-specific. The important quality of an idle process/thread is that it must always be ready to run. It must never block. But it can do whatever it likes in doing so. Usually "whatever it likes" means "as little as possible", however. The canonical idle thread is just an infinite loop: an unconditional branch instruction branching to itself. Several processor architectures provide equivalents to the x86 hlt instruction, the intent of which is in general terms to reduce the idling processor's use of the system bus (so that, of course, non-idle processors can use that bus bandwidth). So on many architectures the infinite loop repeatedly executes those instructions. Some processors can signal their "idle" state on the bus when they execute such instructions, which external hardware can recognize and act upon (such as by slowing bus clocks down and consuming less power, for example). Similarly, the idle instructions can cause the processors themselves to do things like clock-slowing and power-saving.
  • Low-level scheduling is not an "in-thread" thing. After all, it's the low-level scheduler, often called the dispatcher, that determines what thread to even run in the first place. It's medium-level and (sometimes, albeit rarely) high-level scheduling that are run within threads. A medium-level scheduler can be, for example, a thread that wakes up every N seconds and scans the thread table recomputing the thread priorities of dynamic-priority threads. Or it could be a thread that, every N seconds, pushes entire process segments out to disk and pulls them back again, depending from process priority and recent CPU usage. (This latter type is rare on modern paging operating systems, but it existed on segment-swapping operating systems.)
like image 73
JdeBP Avatar answered Oct 18 '22 18:10

JdeBP


In space critical embedded systems, the idle process is used to scrub memory in order to check whether cosmic rays have introduced bit flips.

like image 24
mouviciel Avatar answered Oct 18 '22 18:10

mouviciel