Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

how does sleep work in windows kernel

tony_zhutony_zhu Member Posts: 41

so when i press Start -> Shut down or sign out -> Sleep , then the windows should go to sleep. But what is behind all this? Will the System BIOS be involved?
suppose this new device supports S3 power transition from D0, then its driver must have function that will be called after Sleep is pressed.
but what if Sleep is pressed, but the driver's sleep function never get called. What would be the reason?


  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,768

    If the device is already in D3, the system doesn't have to let the driver know when the system goes to sleep. The system is now rather aggressive about power management, and will try to put your device in D3 as soon as can. That way, system sleep can happen almost instantly.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • tony_zhutony_zhu Member Posts: 41

    Hi @Tim_Roberts , how do i know if my device is already in D3? (I suppose this D3 is the same as S3 )
    actually this device is video card , so i have set a breakpoint at DxgkDdiSetPowerState this DDI function. but it never get called even after i press Sleep.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,768

    Devices have D-states. The system has an S-state. The two are rather lightly connected. When the system wants to go to S3, it will ask the devices to fall out of D0. It's up to the device how they handle that. If a device is already not in D0, then the system doesn't necessarily need to ask it to change. You can find out what D-state you're in in Device Manager; it's one of the property pages.

    There are some good power management tools that allow you to force the system into certain states, like powercfg. I suppose you could use some of those to chase this down.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • tony_zhutony_zhu Member Posts: 41
    edited March 2020

    thank you @Tim_Roberts
    Could you give litter more about this powercfg for how to use it?
    i want to check if power manager sends the power command to my driver, do you think i can check this using powercfg?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE