中国高校课件下载中心 》 教学资源 》 大学文库

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

文档信息
资源类别:文库
文档格式:PPT
文档页数:35
文件大小:1.68MB
团购合买:点击进入团购
内容简介
5.1 文件模型 5.2 分布式文件服务 5.3 分布式目录服务 5.4 分布式文件系统的实现 5.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 文件操作举例

刷新页面下载完整文档
VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
相关文档