文档介绍:精选优质文档-----倾情为你奉上
精选优质文档-----倾情为你奉上
专心---专注---专业
专心---专注---专业
精选优质文档-----倾情为你奉上
专心---专注---专业
空闲磁盘存储的管理:位示图法
1:建立相py ; 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 bitset(int index ,int temp_block_quantity)
{
int block_quantity = temp_block_quantity ;
int free_quantity = 0 ;
int line, column ;
int sign = cycle - 1 ;
for (;; cycle++ )
{
line = cycle / MAX_COLUMN ;
column = cycle % MAX_COLUMN ;
if( 0 == byte_judge(byte[line],column))
{
free_quantity ++ ;
}
精选优质文档-----倾情为你奉上
精选优质文档-----倾情为你奉上
专心---专注---专业
专心---专注---专业
精选优质文档-----倾情为你奉上
专心---专注---专业
else
{
free_quantity = 0 ;
}
if(free_quantity >= block_quantity )
{
f[index].start = cycle - block_quantity + 1;
set(cycle, block_quantity);
cycle ++;
cout<<"create file success"<<endl;
show();
return ;
}
if(cycle >= MAX_LINE * MAX_COLUMN-1)
{
cycle = -1;
free_quantity = 0;
}
if(sign == cycle )
{
break ;
}