磁头导致的处理

现象:

这两天接到同事的咨询,说我维护的机器的CPU IDLE高,导致他的程序无法使用CPU,程序hang住。这个问题从未遇到过,记录下自己的处理过程。

排查:

1、使用top指令看,一段时间后,idle急剧下降,昨天还是十几,今天就是0了。开始以为是同事告知的原因,确实有个日志记录频繁,一天会有超过6G的记录;

开始基本断定是这个问题,并想找同事修改代码了。

2、但今天详细搜索了下,查询IO有个指令:iostat -d -x,看磁盘读写情况,我详细查了下各项的意义,有一项await-表示IO响应时间。一看,按网上讲是最大10,但是很多都超过100.

3、不放心,再对比了下其他服务器(业务相同),发现其他节点并没有这个问题,所以联系硬件的同事做了处理,恢复。


总结:

1、轻易不要下结论,特别是底层的问题;

2、查询过程中,多对比,一点点差别,很可能就能定位到问题


借鉴:

http://www.orczhou.com/index.php/2010/03/iostat-detail/

http://blog.sina.com.cn/s/blog_6cf467320100m2t4.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring循环依赖是指多个Bean之间相互依赖,形成一个环状依赖关系。这种情况下,Spring容器无法完成Bean的实例化,会抛出BeanCurrentlyInCreationException异常,导致系统无法启动。 循环依赖的原因一般是因为两个或多个Bean之间相互依赖,例如BeanA依赖BeanB,同时BeanB又依赖BeanA。 解决循环依赖的方法有以下几种: 1. 构造函数注入:使用构造函数注入可以避免循环依赖问题。 2. 属性注入:属性注入是一种延迟注入方式,可以通过setter方法来解决循环依赖问题。 3. / 2; img_file_.seekp(sector * SECTOR_SIZE + offset * 2, ios::beg); img_file_.write(reinterpret_cast<char*>(&FAT_FREE), 2); return sector; } } } return -1; } // 更新FAT表 void update_fat(int index, unsigned short value) { img_file_.seekp(fat_start_sector_ * SECTOR_SIZE + index * 2, ios::beg); img_file_.write(reinterpret_cast<char*>(&value), 2); } // 读取FAT表项 unsigned short get_fat(int index) { img_file_.seekg(fat_start_sector_ * SECTOR_SIZE + index * 2, ios::beg); unsigned short fat_entry; img_file_.read(reinterpret_cast<char*>(&fat_entry), 2); return fat_entry; } // 查找文件信息 FileInfo find_file_info(const string& name) { for (auto& file_info : root_dir_) { if (file_info.name == name) { return file_info; } } return FileInfo(); } // 去除文件名中的空格和点 string trim_name(const char* name) { char trimmed_name[12]; int j = 0; for (int i = 0; i < 11; ++i) { if (name[i] != ' ' && name[i] != '.') { trimmed_name[j] = name[i]; ++j; } } trimmed_name[j] = '\0'; return trimmed_name; } // 将文件名填充到11个字节 string pad_name(const string& name) { string padded_name(name); if (padded_name.size() < 11) { padded_name.append(11 - padded_name.size(), ' '); } return padded_name; } private: ifstream img_file_; // 磁盘镜像文件 int bytes_per_sector_; // 每个扇区的字节数 int sectors_per_cluster_; // 每个簇的扇区数 int reserved_sectors_; // 保留扇区数 int fat_count_; // FAT表个数 int root_dir_entry_count_; // 根目录项数 int total_sectors_; // 总扇区数 int media_descriptor_; // 媒体描述符 int sectors_per_fat_; // 每个FAT表占用的扇区数 int sectors_per_track_; // 每个磁道的扇区数 int head_count_; // 磁头数 int hidden_sectors_; // 隐藏扇区数 int total_sectors_ext_; // 扩展总扇区数 int fat_start_sector_; // FAT表起始扇区 int root_dir_start_sector_; // 根目录起始扇区 int data_start_sector_; // 数据区起始扇区 vector<FileInfo> root_dir_; // 根目录 const unsigned short FAT_FREE = 0x0000; // 空闲FAT表项 }; int main() { FAT16FileSystem fs("fat16.img"); // 创建一个文件 fs.create_file("test.txt", 1024); // 读取文件内容 fs.read_file("test.txt"); // 删除文件 fs.delete_file("test.txt"); return 0; } ``` 这个实现只是一个简单的示例,可能还有一些细节没有考虑到。如果你要实际使用这个代码,还需要根据具体的需求进行修改和完善。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值