空闲磁盘存储空间的管理位示图法.doc

空闲磁盘存储空间的管理位示图法.doc

  1. 1、本文档共5页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
空闲磁盘存储空间的管理位示图法

空闲磁盘存储的管理:位示图法 1:建立相应的数据结构 2:磁盘上建立一个文件,文件长度设为10MB,为该文件来模拟一个磁盘,磁盘的物理块大小为512字节 3:显示每次磁盘的请求和空间释放后的位示图状态 4显示每次磁盘的请求和空间释放后的全磁盘的状态 5:模拟文件的创建和删除,从而产生磁盘潘快请求和释放,验证以上设计 代码: // OS暑?期ú课?程ì设Θ?计?.cpp : 定¨义?控?制?台?应畖用?程ì序ò的?入?口ú点?。£ // #include stdafx.h #include iostream #include string #include math.h using namespace std ; //文?件t类え? class file { public: string name ; int occupy ; int grade_block ; int start ; }; #define MAX_LINE 3 #define MAX_COLUMN 32 int BIT[32][1000]; int byte[MAX_LINE] ; int file_count; int judge[32] ; int judge2[32]; int cycle ; file f[1000]; void init(int line ,int column); void show() ; void set(int now_location, int occupy ); void clear(int now_location, int occupy); void bitset(int index ,int temp_block_quantity); void create_file(string temp_name, int temp_occupy ); void delete_file(string name); bool byte_judge(int num,int i); int _tmain(int argc, _TCHAR* argv[]) { string cmd; string file_name ; int file_occupy ; init( MAX_LINE, MAX_COLUMN ) ; //初?始?化ˉ while ( cin cmd ) // { if( q == cmd || Q == cmd ) { exit(0) ; return 0 ; } cin file_name ; if(create == cmd) { cin file_occupy ; create_file(file_name,file_occupy); } else { delete_file(file_name) ; } } return 0; } void show() { for(int i = 0 ; i MAX_LINE ; i ++) { for(int j = 0 ; j MAX_COLUMN ; j ++) { //coutBIT[i][j] ; coutbyte_judge(byte[i],j) ; } cout endl ; } } void set(int now_location, int occupy ) { int line ; int column ; for(int i = 0 ; i occupy ; i ++ ) { line = (now_location - i) / MAX_COLUMN ; column = (now_location - i ) % MAX_COLUMN ; //BIT[line][column] = 1 ; byte[line] |= judge[column]; } } //清?零? void clear(int now_location, int occupy) { int line ; int column ; for(int i = 0 ; i occupy ; i ++) { line = (now_location + i) / MAX_COLUMN ; column = (now_location + i ) % MAX_COLUMN ; //BIT[line][column] = 0 ; byte[line] = judge2[column]; } } void

文档评论(0)

aicencen + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档