With the enhancement of hardware and software engineering, the effectiveness and correctness of software is less and less doubted and customers are more aware about whether software services are available or not when needed. Software maintenance is one of the main reasons that make software unavailable and it is often very expensive to perform maintenance tasks. Common approaches of studying software maintenance are to consider it as a static by-product of software operation and only the maintenance cost is covered. In this paper, software maintenance policies are studied with the consideration of unavailable service time. A non-homogeneous continuous Markov chain is adopted for modeling the software operation and maintenance process, and the cost of software unavailability that is brought in by software maintenance is investigated and analyzed for searching the optimal maintenance policy, which aims at minimizing the average maintenance time cost. The optimality of our proposed policy is shown and checked by numerical examples with discussions of its possible application perspectives. Copyright © 2010 John Wiley & Sons, Ltd.