Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can I ensure that a drive is spinning and ready to write data?

How can I ensure that a drive is spinning and ready to write data?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++help
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TragicComic
    wrote on last edited by
    #1

    Hello, I am working on an application that streams uncompressed data from high resolution video cameras directly to a hard drive. The amount of data that I am writing is very high, and if I start to write while the drive is idle, I lose a significant number of initial video frames. Does anyone know a simple way using c++ (on Windows XP) to keep a drive ready to go? My first thought is to open a file, write some bits, close it and delete it every so often, but I worry that it might just sit in the hard drive buffer without spinning up the drive (and if the data doesn't sit in the HD buffer, it seems like a bit of overkill anyway). And I guess I also have a follow up question, is it possible to check the drive to see if it is idle, or if it is spun up? I've looked in the windows SDK, but the disk managment functions in the Platform SDK are a little light. Thanks for the help, Adam

    D S N 3 Replies Last reply
    0
    • T TragicComic

      Hello, I am working on an application that streams uncompressed data from high resolution video cameras directly to a hard drive. The amount of data that I am writing is very high, and if I start to write while the drive is idle, I lose a significant number of initial video frames. Does anyone know a simple way using c++ (on Windows XP) to keep a drive ready to go? My first thought is to open a file, write some bits, close it and delete it every so often, but I worry that it might just sit in the hard drive buffer without spinning up the drive (and if the data doesn't sit in the HD buffer, it seems like a bit of overkill anyway). And I guess I also have a follow up question, is it possible to check the drive to see if it is idle, or if it is spun up? I've looked in the windows SDK, but the disk managment functions in the Platform SDK are a little light. Thanks for the help, Adam

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      TragicComic wrote:

      ...if I start to write while the drive is idle, I lose a significant number of initial video frames.

      I would be more concerned with data loss than I would with drive speed/idling. Think about it -- even if the data to be written was not very much, if you happened to write to the HD when it was not spinning and it lost that data, you've got much bigger problems.


      "A good athlete is the result of a good and worthy opponent." - David Crow

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      1 Reply Last reply
      0
      • T TragicComic

        Hello, I am working on an application that streams uncompressed data from high resolution video cameras directly to a hard drive. The amount of data that I am writing is very high, and if I start to write while the drive is idle, I lose a significant number of initial video frames. Does anyone know a simple way using c++ (on Windows XP) to keep a drive ready to go? My first thought is to open a file, write some bits, close it and delete it every so often, but I worry that it might just sit in the hard drive buffer without spinning up the drive (and if the data doesn't sit in the HD buffer, it seems like a bit of overkill anyway). And I guess I also have a follow up question, is it possible to check the drive to see if it is idle, or if it is spun up? I've looked in the windows SDK, but the disk managment functions in the Platform SDK are a little light. Thanks for the help, Adam

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        Put your ear on it.....

        Steve

        1 Reply Last reply
        0
        • T TragicComic

          Hello, I am working on an application that streams uncompressed data from high resolution video cameras directly to a hard drive. The amount of data that I am writing is very high, and if I start to write while the drive is idle, I lose a significant number of initial video frames. Does anyone know a simple way using c++ (on Windows XP) to keep a drive ready to go? My first thought is to open a file, write some bits, close it and delete it every so often, but I worry that it might just sit in the hard drive buffer without spinning up the drive (and if the data doesn't sit in the HD buffer, it seems like a bit of overkill anyway). And I guess I also have a follow up question, is it possible to check the drive to see if it is idle, or if it is spun up? I've looked in the windows SDK, but the disk managment functions in the Platform SDK are a little light. Thanks for the help, Adam

          N Offline
          N Offline
          Nuxser
          wrote on last edited by
          #4

          This is more about Power Management than Disk Management. So (assuming that the disk doesn't have inbuilt smartness to act on power management and completely relies on OS for power mgt), 1. You could set the power management policy in windows (Control Panel!!!) so that it doesn't put the HD in sleep. This doesn't require coding but than needs human intervention in every PC where you run your app. 2. Play with power management API ( SetSystemPowerState(..) or alike) so that your app can notify the OS to not step in and do power management. Don't forget to revert system state on application exit (if required). But must say, above are from my concept rather than any real work relating to such situation. But I know for sure that there exists some API where a app can tell OS to not kick in power mgnt policy.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups