In recent years, with an increasing number ofrequests, energy, power and temperature have beenimportant keys in embedded systems, which decrease thelifetime of both CPUs and hard disks. The energyconsumption is an important issue in computer systems,particularly real-time embedded systems. The frequencyand the Revolutions Per Minute are major factors in thereduction of energy consumption in both processors andhard disk drives. Therefore, the main goal of this paper isto present a scheduling mechanism for a real timeperiodic task that can save more energy. This mechanismis based on increasing, as much as possible, the executiontime of the CPU and/or the Read/Write time of the harddisk without passing the task deadline. This will be doneby dynamically changing the CPU frequency and/or theRPM of hard disk. Our experimental results demonstratethat the proposed algorithm manages to lower energyconsumption by an average of 25% and to reduce thenumber of missed tasks by 80%.