C-states are the idle state policies that govern an x86 system - i.e. states that shut down parts of the microprocessor when cores are not used. Modern x86 microprocessors have several C-states representing an increasingly larger part of the processor that's being shut down. Additionally because x86 MPUs are also exclusively multi-core, most recent microarchitectures include two C-states: core-based C-states called CC-states and a package-based C-states called PC-states.
Overview
As with everything in life, the microprocessor doesn't experience consistent heavy loads of work at all times. In fact, more often than not, for the typical user, the microprocessor ends up executing very little if nothing at all. An idle CPU is a CPU that doesn't do any useful work. Much like when you turn off the lights in a room and no one is there, since the CPU is not doing any useful work it can be momentarily turned off.
Because today's processors are complex made of multiple cores, caches, and other components, there are multiple C-states depending on which part of the system is talked about. In practice there are usually 3 general C-states:
- CC-states - a set of idle states provided by the hardware controlling the idle states of a physical core.
- PC-states - a set of idle states provided by the hardware controlling the idle states of the entire package. This also covers various shared resources.
- OS C-state - a set of logical idle states provided by the operating system to the application software. Those states are logical c-state and may be anything the OS wants them to be.
Modern x86 microprocessors have several C-states representing an increasingly larger part of the processor that's being shut down. CC-states are concerned with the idle state of an individual core. For example a CC-state of CC0 is your operational state, under this state the CPU is not idle and is actually busy doing useful work. This first state can be thought of as a idle state off state. A CC-state of CC1 is the first real idle state. Under this state, the core clock is gated, effectively shutting down the core's operation. A higher CC-state such as CC2 shuts down additional components such as the external I/O controller, blocking interrupts. Other higher states exist.
Because modern processors have multiple cores, it's possible for a dual-core processor to have one core at CC0 (doing busy work) while a second core is at CC2 doing nothing. PC-states relate the CC-states of the individual core to the state of the entire processor (i.e. the package). The processor may only enter a specific PC-state when all the components are ready for it to happen. If we take our earlier scenario where a dual-core processor has one core at CC0 and a second core at CC2, because the first core is doing busy work we cannot enter PC2 as we cannot disrupt the operating of the working core.
The OS C-states are entirely logical C-state. The OS vendors are free to define what an OS C-state correlates to as they see fit. On some operating systems such as Microsoft Windows, the logical C-state is fairly equivalent to the physical core's CC-state. This is usually the case for other operating systems but it's not a requirement.
This article is still a stub and needs your attention. You can help improve this article by editing this page and adding the missing information. |