东北大学:《分布式操作系统》课程教学资源(PPT课件)第5章 分布式文件管理

第5章分布式文件管理 东北大学信息学院 于戈 2002年7月
第5章 分布式文件管理 东北大学信息学院 于 戈 2002年7月

主要内容 5,1文件模型 5.2分布式文件服务 5.3分布式目录服务 54分布式文件系统的实现 5.5习题 2002-7-5 东北大学软件所于戈 第五章分布式文件管理
2002-7-5 东北大学软件所 于戈 第五章 分布式文件管理 2 主要内容 5.1 文件模型 5.2 分布式文件服务 5.3 分布式目录服务 5.4 分布式文件系统的实现 5.5 习题

5.1文件模型 口文件:信息在磁盘或其它持久介质上的存 储单位 口文件名:文件的标识,由字串组成(8255) 口文件属性:描述信息如大小、创建时间、 授权 口目录:保存文件系统的结构 口路径:目录树上的一段路经 2002-7-5 东北大学软件所于戈 第五章分布式文件管理
2002-7-5 东北大学软件所 于戈 第五章 分布式文件管理 3 5.1 文件模型 ❑文件:信息在磁盘或其它持久介质上的存 储单位 ❑文件名:文件的标识,由字串组成(8-255) ❑文件属性:描述信息,如大小、创建时间、 授权 ❑目录:保存文件系统的结构 ❑路径:目录树上的一段路经

文件结构 1、二进制序列;2、记录序列:3、树 Byte Ant‖Fo Hen Ibis Lamb (a) 2002-7-5 东北大学软件所于戈 第五章分布式文件管理
2002-7-5 东北大学软件所 于戈 第五章 分布式文件管理 4 文件结构 1、二进制序列;2、记录序列;3、树

文件类型举例 1、可执行文件r[c Header ext 2、归档文件=〓 Date Symbol table size Object module Header Text Object module Header Obj sm mbol (a) 2002-7-5 东北大学软件所于戈 第五章分布式文件管理
2002-7-5 东北大学软件所 于戈 第五章 分布式文件管理 5 文件类型举例 1、可执行文件 2、归档文件

典型的文件扩展名 Extension Meaning file bak Backup file file. c C source program file. gif Compuserve Graphical Interchange Format image file. hl Help file file. html World Wide Web Hyper Text Markup Language document file. jpg Still picture encoded with the JPEG standard file. mp3 Music encoded in MPEG layer 3 audio format file. mpg g Movie encoded with the MPEG standard file. o Object file(compiler output, not yet linked file. pdf Portable document format file file.ps Postscript file file. tex Input for the TEX formatting program file. txt General text file file. zip Compressed archive 2002-7-5 东北大学软件所于戈 第五章分布式文件管理
2002-7-5 东北大学软件所 于戈 第五章 分布式文件管理 6 典型的文件扩展名

文件的属性 Attribute Meaning ProtectionWho can access the file and in what way Password Password needed to access the file Creator ID of the person who created the file Owner Current owner Read-only flag o for read/write; 1 for read only idden fla o for normal; 1 for do not display in listings System flag O for normal files: 1 for system file Archive fl nlag 0 for has been backed up: 1 for needs to be backed up ASCI/binary flag o for ASCll file; 1 for binary file Random access flag 0 for sequential access only; 1 for random access Temporary flag o for normal; 1 for delete file on process exit Lock flags I O for unlocked; nonzero for locked Record length Number of bytes in a record Key position Offset of the key within each record Key length Number of bytes in the key field Creation time Date and time the file was created Time of last access Date and time the file was last accessed Time of last change Date and time the file has last changed Current size Number of bytes in the file Maximum size Number of bytes the file may grow to 2002-7-5 第五章分布式文件管理 7 东北大学软件所于戈
2002-7-5 东北大学软件所 于戈 第五章 分布式文件管理 7 文件的属性

文件基本操作 1. Create 7. Append 2. Delete 8 Seek 3. Open 9. Get attributes 4. Close 10. Set Attributes e 5. Read 11.Rename 6. Write 2002-7-5 东北大学软件所于戈 第五章分布式文件管理
2002-7-5 东北大学软件所 于戈 第五章 分布式文件管理 8 文件基本操作 1. Create 2. Delete 3. Open 4. Close 5. Read 6. Write 7. Append 8. Seek 9. Get attributes 10.Set Attributes 11.Rename

文件操作举例 /* File copy program. Error checking and reporting is minimal. * #include / include necessary header files * #include #include #include int main(int argc, char *argv D) /* ANSI prototype刘 #define BUF SIZE 4096 / use a buffer size of 4096 bytes #define OUTPUT MODE 0700 / protection bits for output file * e int main(int argc, char *argvD) int in fd. out fd. rd count wt count: char buffer[BUF SIZE if (argc I= 3)exit(1); / syntax error if argc is not 3 2002-7-5 第五章分布式文件管理 9 东北大学软件所于戈
2002-7-5 东北大学软件所 于戈 第五章 分布式文件管理 9 文件操作举例

文件操作举例 / Open the input file and create the output file * in_ fd= open(argv[1],ORDONLY): / open the source file * if (in_fd 0)exit(2): if it cannot be opened, exit * out_ fd=creat(argv[2], OUTPUT_ MODE); /* create the destination file * if (out_fd O)exit (3); / if it cannot be created. exit * / Copy loop * while(TRUE)I rd- count= read(in_fd, buffer, BUF SIZE); * read a block of data * if (rd_count <= 0)break / if end of file or error, exit loop * wt_count= write(out_fd, buffer, rd_ count); / write data * if (wt_count < O)exit(4); /* wt count <=0 is an error * /* Close the files * close(in_ fd) close(out fd); if(rd_count = 0) /* no error on last read exit(O) else 2002 exit(5 / error on last read * 10 东北
2002-7-5 东北大学软件所 于戈 第五章 分布式文件管理 10 文件操作举例
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 东北大学:《分布式操作系统》课程教学资源(PPT课件)第4章 分布式进程管理.ppt
- 东北大学:《分布式操作系统》课程教学资源(PPT课件)第3章 分布式同步控制.ppt
- 东北大学:《分布式操作系统》课程教学资源(PPT课件)第2章 分布式通信管理.ppt
- 东北大学:《分布式操作系统》课程教学资源(PPT课件)第1章 分布式系统(主讲:于戈).ppt
- 东北大学:《分布式操作系统》课程教学资源(PPT课件)第0章 操作系统回顾.ppt
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)总线设计.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)输入/输出系统.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)虚拟存储器.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)高速缓冲存储器系统.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)存储器系统.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)利用流水线改进性能.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)设计流水线处理器.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)流水技术引论.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)设计多周期控制器微程序和中断.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)设计多周期处理器.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,下)设计单周期控制.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,上)设计单周期数据通路.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,上)除法、浮点数.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,上)ALU设计——乘法与移位.pdf
- 北京大学:《计算机组织与体系结构》课程教学资源(讲义,上)设计过程与ALU设计.pdf
- 东北大学:《分布式操作系统》课程教学资源(PPT课件)第6章 分布式存储管理.ppt
- 清华大学:《操作系统》课程教学资源(PPT课件)第二章 作业管理和用户接口.ppt
- 清华大学:《操作系统》课程教学资源(PPT课件)第一章 绪论(向勇).ppt
- 清华大学:《操作系统》课程教学资源(PPT课件)第三章 用户管理和配置管理.ppt
- 清华大学:《操作系统》课程教学资源(PPT课件)第四章 进程管理.ppt
- 清华大学:《操作系统》课程教学资源(PPT课件)第五章 处理机管理.ppt
- 清华大学:《操作系统》课程教学资源(PPT课件)第七章 文件系统.ppt
- 清华大学:《操作系统》课程教学资源(PPT课件)第六章 存储管理.ppt
- 清华大学:《操作系统》课程教学资源(PPT课件)第八章 外部设备管理.ppt
- 清华大学《Windows操作系统原理》_操作系统概述&Windows2000/XP的体系结构.ppt
- 清华大学《Windows操作系统原理》_进程和处理机管理.ppt
- 清华大学《Windows操作系统原理》_存储管理.ppt
- 清华大学《Windows操作系统原理》_I/O系统.ppt
- 清华大学《Windows操作系统原理》_网络network.ppt
- 清华大学《Windows操作系统原理》_Windows应用程序设计.ppt
- 清华大学《Windows操作系统原理》_Windows设备驱动程序开发.ppt
- 微软先进技术专题(一):软件开发和艺术 The Art and Science of Software Development.pdf
- 微软先进技术专题(二):如何做研究 How To Do Research.pdf
- 微软先进技术专题(三):如何获得公开发表的研究 How to Get Good Research Published.pdf
- 微软先进技术专题(四):写好代码的10个秘诀_ 10 Things You Can Do To Write Better Code.ppt