1. Trang chủ
  2. » Luận Văn - Báo Cáo

Thuật caching trong quản trị mạng lưu trữ

91 7 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

TRẦN THỊ VÂN NGA BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC BÁCH KHOA HÀ NỘI - TRẦN THỊ VÂN NGA KỸ THUẬT ĐIỆN TỬ TIN HỌC THUẬT CACHING TRONG QUẢN TRỊ MẠNG LƯU TRỮ LUẬN VĂN THẠC SĨ KHOA HỌC KỸ THUẬT ĐIỆN TỬ TIN HỌC KHOÁ 2009 Hà Nội – Năm 2012 BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC BÁCH KHOA HÀ NỘI - Họ tên tác giả luận văn TRẦN THỊ VÂN NGA TÊN ĐỀ TÀI LUẬN VĂN THUẬT CACHING TRONG QUẢN TRỊ MẠNG LƯU TRỮ Chuyên ngành: Kỹ thuật điện tử tin học LUẬN VĂN THẠC SĨ KHOA HỌC KỸ THUẬT ĐIỆN TỬ TIN HỌC NGƯỜI HƯỚNG DẪN KHOA HỌC TS NGUYỄN VIẾT NGUYÊN Hà Nội - Năm 2012 MỤC LỤC DANH MỤC CÁC HÌNH VẼ, ĐỒ THỊ 4  DANH MỤC CÁC BẢNG 5  DANH MỤC CÁC KÝ HIỆU, CÁC CHỮ VIẾT TẮT 6  LỜI CAM ĐOAN 7  LỜI NÓI ĐẦU 8  PHẦN MỞ ĐẦU 9  CHƯƠNG 1: TỔNG QUAN VỀ CACHING 11  1.1 Lịch sử đời 11  1.2 Khái niệm 11  1.3 Nguyên tắc nhớ cache 14  1.3.1 Bộ nhớ cache 14  1.3.2 Tổng quan hoạt động nhớ cache 14  1.3.3 Các yếu tố thiết kế cache 16  1.4 Mơ hình cache 26  1.4.1 Cache Hits 26  1.4.2 Cache Miss 27  1.4.3 Cache Consistency 28  1.5 Kiến trúc cache 28  1.5.1 Kiến trúc đọc 29  1.5.2 Chính sách viết 31  1.6 Các thành phần cache 34  1.6.1 SRAM 34  1.6.2 Tag RAM 34  1.6.3 Bộ điều khiển cache 34  1.7 Cache Organization 35  1.7.1 Fully-Associative (kết hợp đầy đủ) 36  1.7.2 Direct Map 37  1.7.3 Set Associative 38  CHƯƠNG 2: THUẬT TOÁN CACHING 39  2.1 Tổng quan số thuật toán cache 39  2.1.1 Least Frequently Used (LFU) 39  2.1.2 Least Recently Used (LRU) 39  2.1.3 Least Recently Used (LRU2) 40  2.1.4 Adaptive Replacement Cache (ARC) 40  2.1.5 Most Recently Used (MRU) 40  2.1.6 First in First out (FIFO) 41  2.1.7 Simple time-based 42  2.1.8 Extended time-based expiration 42  2.1.9 Sliding time-based expiration 42  2.2 Một số thuật toán caching tiếng 43  2.2.1 Thuật toán Cache Random (bộ nhớ cache ngẫu nhiên) 43  2.2.2 Thuật toán cache FIFO 46  2.2.3 Thuật toán cache LFU 49  2.2.4 Thuật toán cache LRU 52  CHƯƠNG 3: THUẬT TOÁN CACHING TRONG HỆ THỐNG LƯU TRỮ TẬP TIN 58  3.1 Giới thiệu 58  3.2 Các thuật toán thay cache đĩa cứng 59  3.2.1 Thuật toán LRU 59  3.2.2 Thuật toán LFU 59  3.2.3 Thuật toán FBR 61  3.2.4 Thuật toán MIN 62  3.2.5 Thuật toán RAND 62  CHƯƠNG 4: ĐÁNH GIÁ HIỆU SUẤT CỦA DỮ LIỆU CACHING 64  4.1 Tổng quan 64  4.2 Cấu hình chạy mô cache 67  4.3 Thiết lập mô 68  4.3.1 Tạo file chạy mô 68  4.3.2 Phần mềm TraceAnalyzer- phân tích tệp tin vết 70  4.4 Phân tích đánh giá kết mô 72  4.4.1 Đánh giá hiệu suất cache phụ thuộc vào block size 72  4.4.2 Đánh giá hiệu suất cache phụ thuộc vào associative 73  KẾT LUẬN VÀ HƯỚNG PHÁT TRIỂN 75  TÀI LIỆU THAM KHẢO 77  PHỤ LỤC 80  Phụ lục 1: tệp tin mô (*.c) 80  Phụ lục 1: ví dụ trace file (*.tr) 81  Phụ lục 3: Hướng dẫn cài đặt simplescalar 84  DANH MỤC CÁC HÌNH VẼ, ĐỒ THỊ Hình 1.1: Tổ chức nhớ máy tính 12  Hình 1.2: Vị trí nhớ cache 14  Hình 1.3: Cấu tạo nhớ cache Main memory 15  Hình 1.4: Tổ chức nhớ cache điển hình 15  Hình 1.5: Tổ chức ánh xạ trực tiếp 18  Hình 1.6: Minh họa ánh xạ trực tiếp 19  Hình 1.7: Tổ chức Cache ánh xạ kết hợp 20  Hình 1.8: Minh họa ánh xạ kết hợp 21  Hình 1.9: Tổ chức cache liên kết K chiều 23  Hình 1.10: Minh họa ánh xạ liên kết 24  Hình 1.11: Mơ hình cache 26  Hình 1.12: Look Aside Cache 29  Hình 1.13: Look Through Cache 30  Hình 1.14: Write - back 32  Hình 1.15: Write-through 33  Hình 1.16: Cache page 35  Hình 1.17: Fully-Associative Cache 36  Hình 1.18: Direct Mapped 37  Hình 1.19: 2-Way Set Associative 38  Hình 3.1: Ba phần cache FBR 62  Hình 4.1: Bộ công cụ SimpleScalar 65  Hình 4.2: Cấu trúc mơ simplescalar 66  Hình 4.3: Ví dụ đoạn script chạy mơ 69  Hình 4.4: Thực mô 70  Hình 4.5: Phần mềm phân tích tệp tin vết (trace file) 71  Hình 4.6: Sự phụ thuộc missrate vào block size 72  Hình 4.7: Sự phụ thuộc missrate vào associative 74  DANH MỤC CÁC BẢNG Bảng 1.1: Ba trường địa nhớ 17  Bảng 1.2: Cache ánh xạ trực tiếp 17  Bảng 2.1: Minh họa trình thực cache ngẫu nhiên 46  Bảng 2.2: Minh họa trình thực cache FIFO 48  Bảng 3.1: Đếm tham chiếu thay đổi 61  Bảng 4.1: Bảng giá trị Miss_rate thay đổi block size 72  Bảng 4.2: Bảng giá trị Miss_rate thay đổi associative 73  DANH MỤC CÁC KÝ HIỆU, CÁC CHỮ VIẾT TẮT STT TÊN VIẾT TẮT TÊN ĐẦY ĐỦ PHIÊN ÂM DRAM Dynamic random-access memory Truy cập nhớ ngẫu nhiên động SRAM Static random-access memory Truy cập nhớ ngẫu nhiên tĩnh TRAM Tag random-access memory Truy cập nhớ ngẫu nhiên theo thẻ LFU Least Frequently Used Ít sử dụng thường xuyên LRU Least Recently Used Gần sử dụng LRU2 Least Recently Used Gần sử dụng phiên ARC Adaptive Replacement Cache Bộ nhớ cache thay thích nghi MRU Most Recently Used Gần sử dụng nhiều FIFO First in First out 10 FBR Frequency Based Replacement Thay dựa vào tần số 11 MIN Optimal strategy Chiến lược thay tối ưu 12 RAND Random replacement Sự thay ngẫu nhiên LỜI CAM ĐOAN Lời cam đoan học viên: Tên Trần Thị Vân Nga, cam kết luận văn tốt nghiệp cơng trình nghiên cứu thân tơi hướng dẫn TS Nguyễn Viết Nguyên giảng viên Viện Điện tử Viễn thông trường Đại Học Bách Khoa Hà Nội Các kết nêu luận văn trung thực, khơng phải chép tồn văn cơng trình khác Hà Nội, ngày 25 tháng 03 năm 2012 Học viên Trần Thị Vân Nga LỜI NÓI ĐẦU Trước hết, em xin chân thành gửi lời cảm ơn tới thầy cô giáo trường Đại học Bách Khoa Hà Nội tận tình giảng dạy, truyền đạt cho em kiến thức, kinh nghiệm quý báu thời gian học tập rèn luyện trường Đại học Bách Khoa Hà Nội Để hoàn thành đồ án em xin chân thành cảm ơn thầy giáo TS Nguyễn Viết Nguyên, giảng viên Viện Điện tử viễn thông - Đại học Bách Khoa Hà Nội bảo tận tình giúp đỡ em suốt trình làm đồ án Trong trình làm điều kiện thời gian trình độ có hạn khơng thể tránh khỏi sai sót Vì em mong nhận ý kiến bảo quý báu thầy cô, ý kiến đóng góp bạn bè để em kịp thời bổ sung, sửa chữa thiếu sót Em xin chân thành cảm ơn! Hà Nội, ngày 25 tháng 03 năm 2012 Học viên: Trần Thị Vân Nga Lớp: Cao học Điện tử Tin học 2009 PHẦN MỞ ĐẦU Lý chọn đề tài Ngày vi xử lý ngày phát triển tốc độ độ phức tạp Bộ nhớ cache phần thiếu vi xử lý Bộ nhớ cache công nghệ Trong thực tế, triển khai cho máy lớn hàng chục năm trước Nếu nói cách đơn giản cache giúp cho việc truy xuất liệu nhiều lần trình xử lý trở nên nhanh Ngày nay, gần tất thiết bị có khả lưu trữ hay truy xuất dũ liệu có nhớ cache Trong HDD có, DVD có Nhưng tuỳ theo cơng nghệ khả xử lý mà định chất lượng, chi phí mục đích sử dụng Mỗi loại cache cải thiện tốc độ truy xuất xử lý liệu Việc sử dụng nhớ cache hiệu giúp hiệu suất xử lý hệ thống tăng cao Với phát triển nhanh mặt công nghệ yêu cầu xử lý liệu với khối lượng lớn, yêu cầu xử lý nhanh ngày việc sử dụng nhớ cache hiệu toán cần giải Các thuật toán cache cần có thời gian xử lý nhanh, xung đột liệu hay tỉ lệ lỗi liệu thấp (miss_rate) yêu cầu tiên Càng nhiều liệu trao đổi với vùng đệm chương trình phải định nhiều cách thức sử dụng tốt không gian nhớ cho phép Và sử dụng đến vùng đệm chứng tỏ hiệu cache Với lý nêu tác giả chọn luận văn “Thuật caching quản trị mạng lưu trữ” nghiên cứu sâu đánh giá hiệu liệu caching Mục đích nghiên cứu luận văn • Tìm hiểu lý thuyết cache • Nghiên cứu số thuật tốn cache • Nghiên cứu việc ứng dụng thuật toán cache hệ thống lưu trữ TraceAnalyzer (phần mềm phân tích tệp tin dấu vết) tự động hóa khâu tạo tệp tin mơ với việc thay đổi tham số tự động tự động hóa khâu phân tích tệp tin dấu vết làm tăng hiệu suất thực mô phân tích đánh giá kết Hướng phát triển đề tài Trong khuôn khổ thời gian có hạn nên luận văn tập trung nghiên cứu số thuật toán cache đánh giá hiệu liệu cache thay đổi số thông số Trong thời gian tới tác giả tiếp tục nghiên cứu sâu thuật toán cache khác Thêm vào cịn số vấn đề khác cache cần nghiên cứu sâu như: Ứng dụng cache hệ sở liệu Cache web site Chất lượng dịch vụ… Để hoàn thành đồ án em xin chân thành cảm ơn thầy giáo TS Nguyễn Viết Nguyên giảng viên Viện Điện tử viễn thông - Đại học Bách Khoa Hà Nội bảo tận tình giúp đỡ em suốt trình làm đồ án Em mong nhận ý kiến bảo quý báu thầy cơ, ý kiến đóng góp bạn bè để em kịp thời bổ sung, sửa chữa thiếu sót Em xin chân thành cảm ơn! 76 TÀI LIỆU THAM KHẢO Bach, M J., The Design of the UNIX Operating System, Prentice-Hall, 1986 Baker, M G., Hartman, J H., Kupfer, M D., Shirriff, K W., and Ousterhout, J K., "Measurements of a Distributed File System," Proceedings of the 13th ACM Symposium on Operating System Principles, October 1991, pp 198-212 Korner, K., "Intelligent Caching for Remote File Service," ICDCS, May 1990, pp 220-226 Leffler, S J., McKusick, M K., Karels, M J., and Quarterman, J S., The Design and Implementation of the Jf BSD UNIX Operating System, Addison Wesley, 1989 Makaroff, D J., and Eager, D L., "Disk Cache Performance for Distributed Systems," ICDCS, May 1990, pp 212-219 Muller, K and Pasquale, J., "A High Performance Multi-Structured File System Design," Proceedings of the 13th ACM Symposium on Operating System Principles, October 1991, pp 56-67 Ousterhout, J K., Da Costa, H., Harrison, D., Kunze, J A., Kupfer, M and Thompson, J G., "A Trace-Driven Analysis of the UNIX 4.2 BSD File System," Proceedings of the 10th ACM Symposium on Operating System Principles, December 1985, pp 15-24 Robinson, J T., and Devarakonda, M V., "Data Cache Management Using Frequency-Based Replacement," Proceedings of the ACM SIGMETRICS Conference on Measurement and Modeling of Computer Systems, May 1990, pp 134-142 77 Rosenblum, M., and Ousterhout, J., K., "The Design and Implementation of a Log-Structured File System," Proceedings of the 13th ACM Symposium on Operating System Principles, October 1991, pp 115 10 Venkat Rangan, P., and Harrick, M Vin, "Designing File Systems for Digital Video and Audio," Proceedings of the 13th ACM Symposium on Operating System Principles, October 1991, pp 81-94 11 U Hahn, W Dilling, and D Kaletta Adaptive replacement algorithm for disk caches in hsm systems In 16 Int’l Symp on Mass Storage Syst., pages 128 – 140, San Diego, California, Mar 15-18 1999 12 E J O’Neil, P E O’Neil, and G Weikum The LRU-K page replacement algorithm for database buffering In Proc ACM SIGMOD’93: Int’l Conf on Mgmnt of Data, pages 297 – 306, Washington, DC, May 1993 13 Ari, M Gottwals, and D Henze SANBoost: Automated SAN-level caching in storage area networks In Proceedings of the 1st International Conference on Autonomic Computing (ICAC ’04), pages 164–171, 2004 14 E J O’Neil, P E O’Neil, and G Weikum The LRU-K page replacement algorithm for database disk buffering In Proceedings of the 1993 ACM SIGMOD International Conference on Management of Data, pages 297– 306, 1993 15 Sibel Adali, K Selỗuk Candan, Yannis Papakonstantinou, and V S Subrahmanian Query Caching and Optimization in Distributed Mediator Systems Proc ACM SIGMOD International Conference on Management of Data, Montreal, Quebec, Canada, June 1996 78 16 Shaul Dar, Michael J Franklin, Björn Þór Jónsson, and Divesh Srivastava, Michael Tan Data Caching and Replacement Proc Very Large Data Bases Conference, Bombay, India, 1996 17 C Mohan Caching Technologies for Web Applications Tutorial at Very Large Data Bases Conference, Roma, Italy, 2001 http://www.almaden.ibm.com/u/mohan/Caching_VLDB2001.pdf 18 SimpleScalar SimpleSclar home page [Online] [Cited: March 26, 2008.] http://www.simplescalar.com 19 Al-Issa, Khalid A Simplescalar Installation guide [Online] [Cited: den 26 March 2008.] http://www.studiokhalid.com/simplescalar/simplescalar.htm 79 PHỤ LỤC Phụ lục 1: tệp tin mô (*.c) #define TAB_SIZE #define CACHE_SIZE 1048576 16384 /* MB */ /* 16 kB */ int main(void) { int int int A[TAB_SIZE]; sum; i, j; /* * Initialization */ sum = 0; for (i = 0; i < TAB_SIZE; i++) { A[i] = 1; } /* * Data referencing */ for (i = 0; i < TAB_SIZE - CACHE_SIZE; i++) { for (j = 0; j < 5; j++) { sum += A[i]; sum += A[i+CACHE_SIZE]; } } printf("Sum = %d\n", sum); return 0; } 80 Phụ lục 1: ví dụ trace file (*.tr) sim-cache: SimpleScalar/PISA Tool Set version 3.0 of August, 2003 Copyright (c) 1994-2003 by Todd M Austin, Ph.D and SimpleScalar, LLC All Rights Reserved This version of SimpleScalar is licensed for academic non-commercial use No portion of this work may be used by any commercial entity, or for any commercial purpose, without the prior written permission of SimpleScalar, LLC (info@simplescalar.com) sim: command line: /home/ubuntu/simplescalar/simplesim-3.0/sim-cache cache:il1 il1:16:32:2:l -cache:il2 none -cache:dl1 dl1:16:32:2:l cache:dl2 none -tlb:itlb none test1 sim: simulation started @ Mon Mar 26 11:49:26 2012, options follow: sim-cache: This simulator implements a functional cache simulator Cache statistics are generated for a user-selected cache and TLB configuration, which may include up to two levels of instruction and data cache (with any levels unified), and one level of instruction and data TLBs No timing information is generated # -config # load configuration from a file # -dumpconfig # dump configuration to a file # -h false # print help message # -v false # verbose operation # -d false # enable debug message # -i false # start in Dlite debugger -seed # random number generator seed (0 for timer seed) # -q false # initialize and terminate immediately # -chkpt # restore EIO trace execution from # -redir:sim # redirect simulator output to file (non-interactive only) # -redir:prog # redirect simulated program output to file -nice # simulator scheduling priority -max:inst # maximum number of inst's to execute -cache:dl1 dl1:16:32:2:l # l1 data cache config, i.e., {|none} -cache:dl2 none # l2 data cache config, i.e., {|none} -cache:il1 il1:16:32:2:l # l1 inst cache config, i.e., {|dl1|dl2|none} -cache:il2 none # l2 instruction cache config, i.e., {|dl2|none} -tlb:itlb none # instruction TLB config, i.e., {|none} -tlb:dtlb dtlb:32:4096:4:l # data TLB config, i.e., {|none} -flush false # flush caches on system calls -cache:icompress false # convert 64-bit inst addresses to 32bit inst equivalents 81 # -pcstat (mult uses ok) # profile stat(s) against text addr's The cache config parameter has the following format: :::: random - Examples: name of the cache being defined number of sets in the cache block size of the cache associativity of the cache block replacement strategy, 'l'-LRU, 'f'-FIFO, 'r'-cache:dl1 dl1:4096:32:1:l -dtlb dtlb:128:4096:32:r Cache levels can be unified by pointing a level of the instruction cache hierarchy at the data cache hiearchy using the "dl1" and "dl2" cache configuration arguments Most sensible combinations are supported, e.g., A unified l2 cache (il2 is pointed at dl2): -cache:il1 il1:128:64:1:l -cache:il2 dl2 -cache:dl1 dl1:256:32:1:l -cache:dl2 ul2:1024:64:2:l Or, a fully unified cache hierarchy (il1 pointed at dl1): -cache:il1 dl1 -cache:dl1 ul1:256:32:1:l -cache:dl2 ul2:1024:64:2:l sim: ** starting functional simulation w/ caches ** Sum = 10321920 sim: ** simulation statistics ** sim_num_insn 493920285 # total number of instructions executed sim_num_refs 87822277 # total number of loads and stores executed sim_elapsed_time 49 # total simulation time in seconds sim_inst_rate 10080005.8163 # simulation speed (in insts/sec) il1.accesses 493920285 # total number of accesses il1.hits 493919274 # total number of hits il1.misses 1011 # total number of misses il1.replacements 979 # total number of replacements il1.writebacks # total number of writebacks il1.invalidations # total number of invalidations il1.miss_rate 0.0000 # miss rate (i.e., misses/ref) il1.repl_rate 0.0000 # replacement rate (i.e., repls/ref) il1.wb_rate 0.0000 # writeback rate (i.e., wrbks/ref) il1.inv_rate 0.0000 # invalidation rate (i.e., invs/ref) dl1.accesses 87822372 # total number of accesses dl1.hits 87432769 # total number of hits dl1.misses 389603 # total number of misses dl1.replacements 389571 # total number of replacements dl1.writebacks 131497 # total number of writebacks dl1.invalidations # total number of invalidations 82 dl1.miss_rate 0.0044 dl1.repl_rate 0.0044 repls/ref) dl1.wb_rate 0.0015 dl1.inv_rate 0.0000 invs/ref) dtlb.accesses 87822372 dtlb.hits 87819321 dtlb.misses 3051 dtlb.replacements 2923 dtlb.writebacks 1025 dtlb.invalidations dtlb.miss_rate 0.0000 dtlb.repl_rate 0.0000 repls/ref) dtlb.wb_rate 0.0000 dtlb.inv_rate 0.0000 invs/ref) ld_text_base 0x00400000 ld_text_size 73568 bytes ld_data_base 0x10000000 base ld_data_size 8304 uninit'ed `.bss' size in bytes ld_stack_base 0x7fffc000 (highest address in stack) ld_stack_size 16384 ld_prog_entry 0x00400140 ld_environ_base 0x7fff8000 address ld_target_big_endian non-zero if big endian mem.page_count 1050 mem.page_mem 4200k allocated mem.ptab_misses 1050 misses mem.ptab_accesses 2151784292 mem.ptab_miss_rate 0.0000 # miss rate (i.e., misses/ref) # replacement rate (i.e., # writeback rate (i.e., wrbks/ref) # invalidation rate (i.e., # # # # # # # # total number of accesses total number of hits total number of misses total number of replacements total number of writebacks total number of invalidations miss rate (i.e., misses/ref) replacement rate (i.e., # writeback rate (i.e., wrbks/ref) # invalidation rate (i.e., # program text (code) segment base # program text (code) size in # program initialized data segment # program init'ed `.data' and # program stack segment base # program initial stack size # program entry point (initial PC) # program environment base address # target executable endian-ness, # total number of pages allocated # total size of memory pages # total first level page table # total page table accesses # first level page table miss rate 83 Phụ lục 3: Hướng dẫn cài đặt simplescalar Phần mềm simplescalar cài đặt phần mềm simplescalar hệ điều hành Linux windows Trong phần tác giả giới thiệu cài đặt Ubuntu Trước hết cần download gói source code sau địa www.simplescalar.com để tiến hành cài đặt: - simplesim-3v0d.tgz - simpleutils-990811.tar.gz - gcc-2.7.2.3.ss.tar.gz - simpletools-2v0.tgz Bước 1: Thiết lập biến môi trường Tạo thư mục simplescalar Thư mục thư mục gốc cài đặt chứa tồn cơng cụ SimpleScalar Thư mục nên đặt /home//simplescalar Mở cửa sổ terminal đánh: uname -a Để biết phiên hệ điều hành cài đặt (i386/i686) Tùy thuộc vào giá trị nhận sử dụng HOST=i686-pc-linux HOST=i386-pc-linux $ export HOST=”ở bên trên” $ export IDIR=/home/YOUR_USER_NAME/simplescalar $ export TARGET=sslittle-na-sstrix Đảm bảo cài đầy đủ gói tin sau: • flex • bison • build-essential 84 Nếu chưa cài sử dụng dòng lệnh sau để cài “sudo apt-get install ” Bước 2: Tiến hành cài đặt Copy tất gói source code download vào thư mục gốc simplescalar đứng thư mục gốc Cài đặt simple tools: Giải nén file simpletools-2v0.tgz xóa thư mục gcc $ cd $IDIR $ tar xzvf simpletools-2v0.tgz $ rm -rf gcc-2.6.3 Cài đặt SimpleUtils Giải nén file simpleutils-990811.tar.gz: $ tar xzvf simpleutils-990811.tar.gz $ cd simpleutils-990811 Trước build, cần phải sửa số lỗi sau: Trong thư mục “ld” mở file “ldlex.l” thay yy_current_buffer YY_CURRENT_BUFFER Có thể thực câu lệnh sau: $ find -type f -print0 | xargs -0 sed -i -e ’s,yy_current_buffer,YY_CURRENT_BUFFER,g’ $ /configure –host=$HOST –target=$TARGET –with-gnuas –with-gnu-ld –prefix=$IDIR $ make 85 $ make install Cài đặt Simulator Giải nén gói tin simplesim-3v0d.tgz thực lệnh bên dưới: $ cd $IDIR $ tar xzvf simplesim-3v0d.tgz $ cd simplesim-3.0 $ make config-pisa $ make Sau cài đặt thành cơng thử câu lệnh: $ /sim-safe tests/bin.little/test-math Cài đặt GCC Cross-Compiler cho kiến trúc SimpleScalar Đây bước quan trọng phải thực thật xác Tiến hành cài đặt theo bước sau: $ cd $IDIR $ tar xzvf gcc-2.7.2.3.ss.tar.gz $ cd gcc-2.7.2.3 $ export PATH=$PATH:/home/YOUR_USER_NAME/simplescalar/sslittlena-sstrix/bin $ /configure –host=$HOST –target=$TARGET –with-gnuas –with-gnu-ld –prefix=$IDIR Trước thực tiết cần phải sửa số lỗi: 86 Mở file Makefile dòng 130 thay “–I/usr/include” vào cuối dòng Để thực chạy dòng lện sau $ gedit Makefile Mở file protoize.c dòng 60, thay “#include ” “#include ” Để thực sử dụng câu lệnh sau: $ chmod +w protoize.c $ gedit protoize.c Mở file “obstack.h” dòng số 341 Thay *((void **) o->next_free)++=((void *)datum); Bằng *((void **) o->next_free++)=((void *)datum); Để thực sử dụng câu lênh $ chmod +w obstack.h $ gedit obstack.h Copy patched file thư mục “patched” đưa vào vị trí tương ứng bên thực theo câu lệnh: 87 $ cp /patched/sys/cdefs.h /sslittle-nasstrix/include/sys/cdefs.h $ cp /sslittle-na-sstrix/lib/libc.a /lib/ $ cp /sslittle-na-sstrix/lib/crt0.o /lib/ Download file (http://www.igoy.in/wp-content/uploads/2009/09/arranlib.tar.gz), giải nén đưa vào thư mục $IDIR/sslittle-na-sstrix/bin Đồng thời phải đảm bảo tất file thư mục có quyền “execution & write permission” Để kiểm tra dùng câu lệnh: $ cd $IDIR/sslittle-na-sstrix/bin ls -al (nếu file mà chưa có quyền sử dụng câu lệnh sau để thay:chmod +w , chmod +x ) Sau kiểm tra xong, thực câu lệnh: $ make Tiếp tục nhận số lỗi Sửa lỗi sau: Mở file insn-output.c, bỏ dấu “\” cuối dòng 675, 750 823 Để mở file sử dụng câu lệnh: $ gedit insn-output.c $ make Mở file objc/sendmsg.c, dòng 35 thêm đoạn code “#define STRUCT_VALUE 0” Cách thực sau: 88 $ cd $IDIR/gcc-2.7.2.3/objc $ chmod +w sendmsg.c $ gedit sendmsg.c $ cd $ make LANGUAGES="c c++" CFLAGS="-O" CC="gcc" Lỗi cuối cần phải sửa, mở file cxxmain.c, xóa bỏ dịng vị trí 29782979, nội dung dịng là: char * malloc (); char * realloc (); Để thực sử dụng câu lệnh: $ chmod +w cxxmain.c $ gedit cxxmain.c Tiếp tục thực câu lệnh $ make LANGUAGES="c c++" CFLAGS="-O" CC="gcc" $ make install LANGUAGES="c c++" CFLAGS="-O" CC="gcc" Kiểm tra Để kiểm tra, tạo file với tên hello.c có nội dung sau: #include main (void) { printf(“Kiem tra mo phong”); } Thực câu lệnh: 89 $ $IDIR/bin/sslittle-na-sstrix-gcc -o hello hello.c $ $IDIR/simplesim-3.0/sim-safe hello Và kết trả bên dưới: sim: ** starting functional simulation ** My name is Tran Thi Van Nga sim: ** simulation statistics ** sim_num_insn 9242 # total number of instructions executed sim_num_refs 4328 # total number of loads and stores executed sim_elapsed_time # total simulation time in seconds sim_inst_rate 9242.0000 # simulation speed (in insts/sec) ld_text_base 0×00400000 # program text (code) segment base ld_text_size 71968 # program text (code) size in bytes ld_data_base 0×10000000 # program initialized data segment base ld_data_size 8528 # program init’ed `.data’ and uninit’ed `.bss’ size in bytes ld_stack_base 0×7fffc000 # program stack segment base (highest address in stack) ld_stack_size 16384 # program initial stack size ld_prog_entry 0×00400140 # program entry point (initial PC) ld_environ_base 0×7fff8000 # program environment base address address ld_target_big_endian # target executable endian-ness, non-zero if big endian mem.page_count mem.page_mem 26 # total number of pages allocated 104k # total size of memory pages allocated mem.ptab_misses 26 # total first level page table misses mem.ptab_accesses 495046 # total page table accesses mem.ptab_miss_rate 0.0001 # first level page table miss rate 90 ... văn TRẦN THỊ VÂN NGA TÊN ĐỀ TÀI LUẬN VĂN THUẬT CACHING TRONG QUẢN TRỊ MẠNG LƯU TRỮ Chuyên ngành: Kỹ thuật điện tử tin học LUẬN VĂN THẠC SĨ KHOA HỌC KỸ THUẬT ĐIỆN TỬ TIN HỌC NGƯỜI HƯỚNG DẪN KHOA... tác giả chọn luận văn ? ?Thuật caching quản trị mạng lưu trữ? ?? nghiên cứu sâu đánh giá hiệu liệu caching Mục đích nghiên cứu luận văn • Tìm hiểu lý thuyết cache • Nghiên cứu số thuật tốn cache • Nghiên... CHƯƠNG 3: THUẬT TOÁN CACHING TRONG HỆ THỐNG LƯU TRỮ TẬP TIN 58  3.1 Giới thiệu 58  3.2 Các thuật toán thay cache đĩa cứng 59  3.2.1 Thuật toán LRU 59  3.2.2 Thuật

Ngày đăng: 28/02/2021, 08:37

Xem thêm:

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w