码迷,mamicode.com
首页 > 其他好文 > 详细

Persistence

时间:2014-09-23 00:45:03      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:style   os   ar   for   sp   art   on   c   amp   

Most of the programs we have seen so far are transient in the sense that they run for a short time and produce some output, but when they end, their data disappears. If you run the program again, it starts with a clean state.

Other programs are persistent: they run for a long time (or all the time); they keep at least some of their data in non-volatile storage (a hard drive, for example); and if they shut down and restart, they pick up where they left off.

Examples of persistent programs are operating systems, which run pretty much whenever a computer is on, and web servers, which run all the time, waiting for requests to come in on the network.

One of the simplest ways for programs to maintain their data is by reading and writing text files. We have already seen programs that read text files; in this chapter we will see programs that write them.

An alternative is to store the state of the program in a database. In this chapter I will present a simple database and a module, pickle, that makes it easy to store program data.

 

from Thinking in Python

Persistence

标签:style   os   ar   for   sp   art   on   c   amp   

原文地址:http://www.cnblogs.com/ryansunyu/p/3987182.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!