Lecture Notes in Computer Science Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen
Editorial Board David Hutchison Lancaster University, UK Takeo Kanade Carnegie Mellon University, Pittsburgh, PA, USA Josef Kittler University of Surrey, Guildford, UK Jon M. Kleinberg Cornell University, Ithaca, NY, USA Alfred Kobsa University of California, Irvine, CA, USA Friedemann Mattern ETH Zurich, Switzerland John C. Mitchell Stanford University, CA, USA Moni Naor Weizmann Institute of Science, Rehovot, Israel Oscar Nierstrasz University of Bern, Switzerland C. Pandu Rangan Indian Institute of Technology, Madras, India Bernhard Steffen University of Dortmund, Germany Madhu Sudan Microsoft Research, Cambridge, MA, USA Demetri Terzopoulos University of California, Los Angeles, CA, USA Doug Tygar University of California, Berkeley, CA, USA Gerhard Weikum Max-Planck Institute of Computer Science, Saarbruecken, Germany
5574
Arrems Hua Shih-Liang Chang (Eds.)
Algorithms and Architectures for Parallel Processing 9th International Conference, ICA3PP 2009 Taipei, Taiwan, June 8-11, 2009 Proceedings
13
Volume Editors Arrems Hua Shih-Liang Chang National Taiwan University of Science and Technology Department of Computer Science and Information Engineering Taipei City 106, Taiwan, ROC E-mail:
[email protected]
Library of Congress Control Number: 2009930109 CR Subject Classification (1998): D, F.1-3, C, I.6 LNCS Sublibrary: SL 1 – Theoretical Computer Science and General Issues ISSN ISBN-10 ISBN-13
0302-9743 3-642-03094-7 Springer Berlin Heidelberg New York 978-3-642-03094-9 Springer Berlin Heidelberg New York
This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. springer.com © Springer-Verlag Berlin Heidelberg 2009 Printed in Germany Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper SPIN: 12718498 06/3180 543210
Message from the General and Program Committee Chairs ICA3PP 2009 It is our pleasure to welcome you to the proceedings of the 9th International Conference on Algorithms and Architectures for Parallel Processing (ICA3PP 2009). This conference was organized by the National Taiwan University of Science and Technology and the National United University. The National Taiwan University of Science and Technology (NTUST), the university hosting the ICA3PP 2009 conference, was established in 1974, serving as a leading educational institution in the field of science and technology in Taiwan. NTUST is located in Taipei very close to the Taipei 101 building, the highest building in the world; also, it is in the vicinity of the National Palace Museum, which houses hundreds of thousands of Chinese antiques and art works. Currently, NTUST has more than 8,000 students including about 1,000 international students, and it continues to evolve as one of the leading science and technology universities in the world. The conference provided an excellent technical program on the latest research results and the state of practice in algorithms and architectures for parallel processing in multiple tracks that included cluster, grid and fault-tolerant computing; distributed scheduling and load balancing; high-performance scientific computing; tools and environments for parallel and distributed software; modeling and analysis; security issues, etc. In total, the conference received 243 submissions from researchers and practitioners from 30 countries. Each paper was carefully reviewed by at least two reviewers based on its originality, significance, correctness, relevance, and clarity of presentation. Among the high-quality submissions, we accepted 80 regular papers. All of the selected papers are included in the proceedings. We believe that the conference was successful and fruitful for all the participants, and that it provided many opportunities for exchanging information during breaks, lunches, a welcome reception and social activities. We would like to take this opportunity to thank the members of the Organizing Committee, and especially the Program Committee Chairs and members for their hard and excellent work toward making this conference a success. We would also like to thank the Honorary Chairs, Shi-Shuenn Chen, Lung-Sheng Steven Lee, and Der-Tsai Lee, the Steering Committee Chairs, Andrzej Goscinski, Yi Pan and Wanlei Zhou, the General Chair, Wanlei Zhou and the members of ICA3PP 2008 for their guidance and support. Special thanks go to our sponsors including the National Taiwan University of Science and Technology, National United University, Ministry of Education, National Science Council, Institute of Information Science, Academia Sinica for their generous financial contributions to the conference. Finally, we would like to thank the keynote speakers and the authors for their excellent papers contained herein. Shi-Jinn Horng General Chair Chin-Chuan Han and Ge-Ming Chiu Program Committee Chairs
Organization
Honorary Chairs Shi Shuenn Chen Lung-Sheng Steven Lee Der-Tsai Lee
National Taiwan University of Science and Technology, Taiwan National United University, Taiwan Academia Sinica, Taiwan
General Chair Shi Jinn Horng
National United University, National Taiwan University of Science and Technology, Taiwan
Program Chairs Ge Ming Chiu Chin Chuan Han
National Taiwan University of Science and Technology, Taiwan National United University, Taiwan
Publication Chairs Hsing Kuo Pao Rong Jian Chen
National Taiwan University of Science and Technology, Taiwan National United University, Taiwan
Publicity Chairs Anu Bourgeois Yuh-Jye Lee Jui-Lin Lai
Georgia State University, USA National Taiwan University of Science and Technology, Taiwan National United University, Taiwan
Local Arrangements Chairs Yuh Jye Lee Yuh Horng Shiau
National Taiwan University of Science and Technology, Taiwan National United University, Taiwan
Registration and Finance Chairs Wei Chung Teng Fu Tsai Huang
National Taiwan University of Science and Technology, Taiwan National United University, Taiwan
VIII
Organization
Steering Committee Chairs Andrzej Goscinski Yi Pan Wanlei Zhou
Deakin University, Australia Georgia State University, USA Deakin University, Australia
Program Committee Jemal Abbawajy Selim Akl Joseph Arul Mark Baker Amnon Barak Maarten Boasson Arndt Bode Xiaojun Cao Jiannong Cao Peter Cappello Kuo Tsai Chang Ruey-Feng Chang Gen-Huey Chen Jianer Chen Yingying Chen Hsuang-Chang Chiang Francis Chin Kenneth Chiu Jose Cunha Alfredo Cuzzocrea Erik D'Hollander Eliezer Dekel Robert Dew Marios Dikaiakos Jack Dongarra Alberto de la Encina José A. Fernández-Zepeda Len Freeman Jung-Sheng Fu Chryssis Georgiou Teofilo Gonzalez Ashwin Gumaste Ken Hawick Ken-Chung Ho Michael Hobbs Bo Hong Susumu Horiguchi Hsi-Chin Hsin Ching-Hsien Hsu
Deakin University, Australia Queen's University, Canada Fu Jen Catholic University, Taiwan The University of Reading, UK Hebrew University of Jerusalem, Israel University of Amsterdam, The Netherlands Technical University of Munich, Germany Georgia State University, USA Hong Kong Polytechnic University, Hong Kong University of California, Santa Barbara, USA National United University, Taiwan National Taiwan University, Taiwan National Taiwan University, Taiwan Texas A&M University, USA Rutgers University, USA National United University , Taiwan University of Hong Kong, Hong Kong State University of NY at Binghamton, USA New University of Lisbon, Portugal University of Calabria, Italy Ghent University, Belgium IBM Haifa Research Laboratory, Israel Deakin University, Australia University of Cyprus, Cyprus University of Tennessee, USA Universidad Complutense de Madrid, Spain CICESE, Mexico University of Manchester, UK National United University, Taiwan University of Cyprus, Cyprus University of California, Santa Barbara, USA Indian Institute of Technology, Bombay, India Massey University, New Zealand National United University, Taiwan Deakin University, Australia Drexel University, USA Tohoku University, Japan National United University, Taiwan Chung Hua University, Taiwan
Organization
Feng-Long Huang Ali Hurson Weijia Jia Hong Jiang Tzong-Wann Kao Krishna Kavi Zvi Kedem Wayne Kelly Tohru Kikuno Jacek Kitowski Michael Langston Gwo-Chuan Lee Laurent Lefevre Keqin Li Kuan-Ching Li Cho-Chin Lin Pangfeng Liu Thanasis Loukopoulos Praveen Madiraju Christine Morin Koji Nakano Michael Palis Marcin Paprzycki Weizhong Qiang Rajeev Raje Michel Raynal Justin Rough Barry Rountree Srinivas Sampalli Eunice Santos Yiannakis Sazeides Edwin Sha Jackie Silcock Ming-Yang Su Chengzheng Sun Rajshekhar Sunderraman Yong-Meng Teo Gabor Terstyanszki Jerry Trahan Hsin-Han Tung Ramachandran Vaidyanathan Vassos Vassiliou Jianping Wang
IX
National United University, Taiwan Pennsylvania State University, USA City University of Hong Kong, Hong Kong University of Nebraska at Lincoln, USA Technology and Science Institute of Northern Taiwan, Taiwan The University of North Texas, USA New York University, USA Queensland University of Technology, Australia Osaka University, Japan AGH University of Science and Technology, Cracow, Poland University of Tennessee, USA National United University, Taiwan INRIA, France State University of NY at New Paltz, USA Providence University, Taiwan National Ilan University, Taiwan National Taiwan University, Taiwan University of Thessaly, Greece Marquette University, USA IRISA/INRIA, France Hiroshima University, Japan Rutgers University, USA SWPS and IBS PAN, Poland Huazhong University of Science and Technology, China Purdue University, USA IRISA, France Deakin University, Australia University of Georgia, USA Dalhousie University, Canada Virginia Tech University, USA University of Cyprus, Cyprus University of Texas at Dallas, USA Deakin University, Australia Ming Chuan University, Taiwan Nanyang Technological University, Singapore Georgia State University, USA National University of Singapore, Singapore University of Westminster, UK Louisiana State University, USA National United University, Taiwan Louisiana State University, USA University of Cyprus, Cyprus City University of Hong Kong, Hong Kong
X
Organization
Neng-Chung Wang Yuh-Rau Wang Greg Wickham Chin-Hsiung Wu Jie Wu Yu-Chi Wu Yue Wu Roman Wyrzykowski Chengzhong Xu Chang-Biau Yang Chao-Tung Yang Laurence T. Yang Jui-Cheng Yen Albert Zomaya Jun Zou
National United University, Taiwan St. John's University, Taiwan GrangeNet, Australia Shih Chien University Kaohsiung Campus, Taiwan Florida Atlantic University, USA National United University, Taiwan University of Electronic Sci and Tech, China Czestochowa University of Technology, Poland Wayne State University, USA National Sun Yat-sen University, Taiwan Tunghai University, Taiwan St. Francis Xavier University, Canada National United University, Taiwan University of Sydney, Australia Chinese University of Hong Kong, China
Table of Contents
Bioinformatics in Parallel Computing Length Encoded Secondary Structure Profile for Remote Homologous Protein Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yen-Chu Hsu, Chien-Ming Chen, Tun-Wen Pai, Jyh-Fu Jeng, Chin-Hua Hu, and Wen-Shyong Tzou
1
Cluster, Grid and Fault-Tolerant Computing A Process Scheduling Analysis Model Based on Grid Environment . . . . . Huey-Ming Lee, Tsang-Yean Lee, Ching-Hao Cheng, and Chia-Hsien Chung
12
A Resource Broker with Cross Grid Information Services on Computational Multi-grid Environments . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chao-Tung Yang, Wen-Jen Hu, and Kuan-Chou Lai
20
Fleet: An Effective System for Publish/Subscribe Service over P2P Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chyouhwa Chen, Chia-Liang Tsai, and Kun-Cheng Tsai
32
Implementation of a Performance-Based Loop Scheduling on Heterogeneous Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chao-Tung Yang and Lung-Hsing Cheng
44
The Hierarchical Path-Selection Scheme Based on Multihoming NEMO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Long-Sheng Li, Gwo-Chuan Lee, Jhu-Shyuan Mei, and Cing-Long Chen
55
Clusterdistributed Parallel Operating Systems Middleware A Software Transactional Memory Service for Grids . . . . . . . . . . . . . . . . . . Kim-Thomas M¨ oller, Marc-Florian M¨ uller, Michael Sonnenfroh, and Michael Sch¨ ottner An Empirical Study on the Performance Issues on the Clustered Client-Server Computing Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yu-Hung Hsiao and Han-Jyun Su DR: Divided Ring Leader Election Algorithm . . . . . . . . . . . . . . . . . . . . . . . . Mehdi Vojdani and Yaser Taj
67
79 90
XII
Table of Contents
Dependability Issues in Computer Networks and Communications Construct the Load-Balanced Topology in NEMO . . . . . . . . . . . . . . . . . . . . Long-Sheng Li, Gwo-Chuan Lee, Li-Keng Kang, and Jhu-Shyuan Mei
100
Energy-Efficient Clustering in Wireless Sensor Networks . . . . . . . . . . . . . . Po-Jen Chuang, Sheng-Hsiung Yang, and Chih-Shin Lin
112
Maximally Local Connectivity on Augmented Cubes . . . . . . . . . . . . . . . . . Y-Chuang Chen, Meng-Hung Chen, and Jimmy J.M. Tan
121
Dependability Issues in Distributed and Parallel Systems A Cluster-Based Data Routing for Wireless Sensor Networks . . . . . . . . . . Hao-Li Wang and Yu-Yang Chao
129
Distributed Scheduling and Load Balancing A Energy Efficient Scheduling Base on Dynamic Voltage and Frequency Scaling for Multi-core Embedded Real-Time System . . . . . . . . . . . . . . . . . . Xin Huang, KenLi Li, and RenFa Li
137
Effect of Database Server Arrangement to the Performance of Load Balancing Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jian-Bo Chen, Tsang-Long Pao, and Kun-Dah Lee
146
Industrial Applications A Block-Based Watermarking Method Using Wavelet Coefficient Quantization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Wei-Hung Lin, Yuh-Rau Wang, and Shi-Jinn Horng
156
A Digital Watermarking Method Using Binary Cluster . . . . . . . . . . . . . . . . Wei-Hung Lin, Yuh-Rau Wang, and Shi-Jinn Horng
165
A Novel Blind Watermarking Using Hybrid Embedding Technique . . . . . Wei-Hung Lin, Yuh-Rau Wang, and Shi-Jinn Horng
175
An Analysis of Fire Frame Processing and Video Dynamic Features . . . . Lin Shi, Xinyu Liu, and Pei Liu
182
Intelligent Laboratory Resource Supply Chain Conceptual Network Model with Process and Information Integration, Visibility and Flexibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chin-Ming Hsu and Hui-Mei Chao
190
Table of Contents
XIII
Information Security Internet A New Windows Driver-Hidden Rootkit Based on Direct Kernel Object Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Woei-Jiunn Tsaur, Yuh-Chen Chen, and Being-Yu Tsai An Agent-Based English Auction Protocol Using Elliptic Curve Cryptosystem for Mobile Commerce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yu-Fang Chung, Tzer-Shyong Chen, Yu-Ting Chen, Chiu-Chan Lee, and Szu-Wen Wang
202
214
Authenticated Key Exchange Protocol in One-Round . . . . . . . . . . . . . . . . . Xing-Lan Zhang
226
Digital Image Watermarking for Malicious Attack . . . . . . . . . . . . . . . . . . . . Wei-Hung Lin, Yuh-Rau Wang, Shi-Jinn Horng, and Tzong-Wann Kao
234
Hierarchical Time-Bound Key Management for Mobile Agents . . . . . . . . . Yu-Fang Chung, Tzer-Shyong Chen, Chia-Chao Ho, Yi-Hsuan Yeh, and Hsiu-Chia Ko
242
Key Tree and Chinese Remainder Theorem Based Group Key Distribution Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jie Zhou and Yong-hao Ou Effective DDoS Attacks Detection Using Generalized Entropy Metric . . . Ke Li, Wanlei Zhou, Shui Yu, and Bo Dai
254
266
Multi-core Programming Software Tools A Fast and Flexible Sorting Algorithm with CUDA . . . . . . . . . . . . . . . . . . Shifu Chen, Jing Qin, Yongming Xie, Junping Zhao, and Pheng-Ann Heng
281
A Parallel Simulated Annealing Approach for Floorplanning in VLSI . . . Jyh-Perng Fang, Yang-Lang Chang, Chih-Chia Chen, Wen-Yew Liang, Tung-Ju Hsieh, Muhammad T. Satria, and Chin-Chuan Han
291
VERTAF/Multi-Core: A SysML-Based Application Framework for Multi-Core Embedded Software Development . . . . . . . . . . . . . . . . . . . . . . . . Pao-Ann Hsiung, Chao-Sheng Lin, Shang-Wei Lin, Yean-Ru Chen, Chun-Hsien Lu, Sheng-Ya Tong, Wan-Ting Su, Chihhsiong Shih, Chorng-Shiuh Koong, Nien-Lin Hsueh, Chih-Hung Chang, and William C. Chu
303
XIV
Table of Contents
The Impact of Resource Sharing Control on the Design of Multicore Processors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chen Liu and Jean-Luc Gaudiot
315
Multi-medium in Parallel Computing Real-Time Ray Tracing with CUDA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Min Shih, Yung-Feng Chiu, Ying-Chieh Chen, and Chun-Fa Chang
327
Parallel Distributed Databases Concurrent Operations for Accessing an XML Document in a Multi-user Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jeang-Kuo Chen and Kuan-Chang Lu
338
Parallel Algorithms A Shape Recognition Scheme for Wireless Sensor Networks Based on a Distance Field Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yang Yang, Satoshi Fujita, and Sayaka Kamei
350
A Low Communication Overhead and Load Balanced Parallel ATPG with Improved Static Fault Partition Method . . . . . . . . . . . . . . . . . . . . . . . . K.-W. Yeh, M.-F. Wu, and J.-L. Huang
362
An Efficient Parallel Sorting Algorithm on Metacube Multiprocessors . . . Yamin Li, Shietung Peng, and Wanming Chu
372
An On-Line Parallel Algorithm for Node Ranking of Trees . . . . . . . . . . . . Chia-Wei Lee, Justie Su-Tzu Juan, and Tai-Lung Wu
384
An Overview of Prophet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Zheng Chen, Yin-Liang Zhao, Xiao-Yu Pan, Zhao-Yu Dong, Bing Gao, and Zhi-Wen Zhong
396
Fast License Plate Localization Using Discrete Wavelet Transform . . . . . . Yuh-Rau Wang, Wei-Hung Lin, and Shi-Jinn Horng
408
Fast Parallel Molecular Solution for DNA-Based Computing: The 0-1 Knapsack Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sientang Tsai
416
Fast Parallel Montgomery Binary Exponentiation Algorithm Using Canonical-Signed-Digit Recoding Technique . . . . . . . . . . . . . . . . . . . . . . . . . Chia-Long Wu
428
Fault-Free Cycles in Conditional Faulty Folded Hypercubes . . . . . . . . . . . Che-Nan Kuo and Sun-Yuan Hsieh
439
Table of Contents
XV
Research on Parallel HW/SW Partitioning Based on Hybrid PSO Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yue Wu, Hao Zhang, and Hongbin Yang
449
Unfolding of Multirate Data-Flow Graph to Compute Iteration Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Daniel Yuh Chao
460
Parallel Algorithms for Solving Markov Decision Process . . . . . . . . . . . . . . Qi Zhang, Guangzhong Sun, and Yinlong Xu
466
Parallel Algorithms for the Weighted Distance Transform on Linear Arrays with a Reconfigurable Pipelined Bus System . . . . . . . . . . . . . . . . . . Horng-Ren Tsai
478
Parallel Particle Swarm Optimization with Adaptive Asynchronous Migration Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Zhi-hui Zhan and Jun Zhang
490
Parallel Architectures MTCrossBit: A Dynamic Binary Translation System Using Multithreaded Optimization Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . Xiaolong Li, Deen Zheng, Ruhui Ma, Alei Liang, and Haibing Guan
502
VLSI Architecture for Fast Memetic Vector Quantizer Design on Reconfigurable Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sheng-Kai Weng, Chien-Min Ou, and Wen-Jyi Hwang
513
Parallel IO Systems and Storage Systems SnapCDP: A CDP System Based on LVM . . . . . . . . . . . . . . . . . . . . . . . . . . Xiaoguang Liu, Gang Wang, Feng Wang, and Yongzhi Song
525
Performance of Parallel Distributed Computing Systems A Divide-and-Conquer Strategy and PVM Computation Environment for the Matrix Multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ming-Chang Lee
535
A Sharable Storage Service for Distributed Computing Systems in Combination of Remote and Local Storage . . . . . . . . . . . . . . . . . . . . . . . . . . MinHwan Ok
545
An Advanced NoP Selection Strategy for Odd-Even Routing Algorithm in Network-on-Chip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minghua Tang and Xiaola Lin
557
XVI
Table of Contents
An Implementation of a Framework for Open Distributed Computing . . . Chia-Chu Chiang Evaluating a Dependable Sharable Atomic Data Service on a Planetary-Scale Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chryssis Georgiou, Nicolas Hadjiprocopiou, and Peter M. Musial
569
580
Scientific Applications A GPU-Based Simulation of Tsunami Propagation and Inundation . . . . . Wen-Yew Liang, Tung-Ju Hsieh, Muhammad T. Satria, Yang-Lang Chang, Jyh-Perng Fang, Chih-Chia Chen, and Chin-Chuan Han
593
A Paralleled Large-Scale Astronomical Cross-Matching Function . . . . . . . Qing Zhao, Jizhou Sun, Ce Yu, Chenzhou Cui, Liqiang Lv, and Jian Xiao
604
A Power Peer-Based Reputation Scheme for Mobile P2P Systems . . . . . . Xu Wu, Jingsha He, Chia-Hu Chang, and Fei Xu
615
An Algorithm Evaluating System Stability to Process . . . . . . . . . . . . . . . . Qing Zhou, Fang Yu, and Binqiang Wang
626
An Efficient Algorithm for the Shortest Path Problem with Forbidden Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chiun-Chieh Hsu, Da-Ren Chen, and Hua-Yuan Ding Finding Object Depth Using Stereoscopic Photography . . . . . . . . . . . . . . . Yu-Hua Lee and Tai-Pao Chuang
638 651
Self-healing Self-protecting and Fault-Tolerant Systems A Lightweight Buffer Overflow Protection Mechanism with Failure-Oblivious Capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tz-Rung Lee, Kwo-Cheng Chiu, and Da-Wei Chang
661
Fault-Tolerant Hamiltonicity of Augmented Cubes under the Conditional Fault Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sun-Yuan Hsieh and Yi-Ru Cian
673
Tools and Environments for Parallel and Distributed Software Development The Design and Implementation of Z Language Editor . . . . . . . . . . . . . . . . Xiaolei Gao
684
Table of Contents
XVII
Web Service A Semantic-Aware Attribute-Based Access Control Model for Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Haibo Shen A P2P Service Management Model for Emergency Response Using Virtual Service Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Feng Yang, Hui Wen, Wei Cheng, Kangkang Zhang, and Peiguang Lin
693
704
A Web 2.0 and Open Source Approach for Management and Sharing of Multimedia Data-Case of the Tzu Chi Foundation . . . . . . . . . . . . . . . . . . . Jian-Hung Chen and Hsiu-Hsun Yang
715
Adaptive Link Cost Reduction by Generic Topology Construction in Ad-Hoc Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reu-Ching Chen and Cheng-Min Lin
721
An Efficient Data Dissemination Scheme for Sensor Networks . . . . . . . . . . Po-Jen Chuang and Bo-Yi Li Dynamically Maintaining Duplicate-Insensitive and Time-Decayed Sum Using Time-Decaying Bloom Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yu Zhang, Hong Shen, Hui Tian, and Xianchao Zhang Lead Scoring Client’s Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yun Ling and Chongyi Ye
729
741 751
Minimizing the Limitations of GL Analyser of Fusion Based Email Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Md. Rafiqul Islam and Wanlei Zhou
761
A Medical Diagnosis Decision Support System Based on Bayesian Theorem and Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chung C. Chang and Hsueh-Ming Lu
775
Analysis on an Energy Efficient Routing Algorithm for Wireless Sensor Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yung-Fa Huang, Tan-Hsu Tan, Yau-Der Wang, Neng-Chung Wang, and Ding Yin Reliable Greedy Forwarding in Obstacle-Aware Wireless Sensor Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ming-Tsung Hsu, Frank Yeong-Sung Lin, Yue-Shan Chang, and Tong-Ying Juang Recursive Dual-Net: A New Universal Network for Supercomputers of the Next Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Yamin Li, Shietung Peng, and Wanming Chu
786
797
809
XVIII
Table of Contents
Using XML for VLSI Physical Design Automation . . . . . . . . . . . . . . . . . . . Fong-Ming Shyu, Po-Hsun Cheng, and Sao-Jie Chen
821
A New Constant Storage Self-healing Key Distribution with Revocation in Wireless Sensor Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Wei Du, Mingxing He, and Xiao Li
832
Design a Hardware Mechanism to Utilize Multiprocessors on a Uni-processor Operating System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slo-Li Chu, Chih-Chieh Hsiao, and Pin-Hua Chiu
844
Refinement Proposal of the Goldberg’s Theory . . . . . . . . . . . . . . . . . . . . . . . J´erome Gallard, Adrien L`ebre, Geoffroy Vall´ee, Christine Morin, Pascal Gallard, and Stephen L. Scott
853
Variable Dimension Space Audio Scrambling Algorithm Against MP3 Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Huan Li, Zheng Qin, Liping Shao, Shanjun Zhang, and Bin Wang
866
Author Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
877
Length Encoded Secondary Structure Profile for Remote Homologous Protein Detection Yen-Chu Hsu1, Chien-Ming Chen1, Tun-Wen Pai1, Jyh-Fu Jeng2, Chin-Hua Hu2,3, and Wen-Shyong Tzou3 1
Department of Computer Science and Engineering, National Taiwan Ocean University, No. 2, Peining Road, Keelung 20224, Taiwan, R.O.C.
[email protected] 2 Center for Marine Bioscience and Biotechnology, National Taiwan Ocean University, No. 2, Peining Road, Keelung 20224, Taiwan, R.O.C. 3 Institute of Bioscience and BioTechnology, National Taiwan Ocean University, No. 2, Peining Road, Keelung 20224, Taiwan, R.O.C.
Abstract. Protein data has an explosive increasing rate both in volume and diversity, yet many of its structures remain unresolved, as well their functions remain to be identified. The conventional sequence alignment tools are insufficient in remote homology detection, while the current structural alignment tools would encounter the difficulties for proteins of unresolved structure. Here, we aimed to overcome the combination of two major obstacles for detecting remote homologous proteins: proteins with unresolved structure, and proteins of low sequence identity but high structural similarity. We proposed a novel method for improving the performance of protein matching problem, especially for mining remote homologous proteins. In this study, existing secondary structure prediction techniques were applied to provide the locations of secondary structure elements of proteins. The proposed LESS (Length Encoded Secondary Structure) profile was then constructed for segment-based similarity comparison in parallel computing. As compared to a conventional residue-based sequence alignment tool, detection of remote protein homologies through LESS profile is favourable in terms of speed and high sequence diversity, and its accuracy and performance can improve the deficiencies of the traditional primary sequence alignment methodology. This method may further support biologists in protein folding, evolution, and function prediction. Keywords: protein sequence comparison, secondary structure element alignment, dynamic programming, length encoded profile, protein folding.
1 Introduction The identification of homologous, sequences that share common ancestry, is essential for gene annotation, function prediction, and comparative genomics. Traditionally, homology is defined in vertical descent evolutionary perspective, i.e. by speciation and gene duplication [6, 7]. New genes evolve through the duplication and modification of A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 1–11, 2009. © Springer-Verlag Berlin Heidelberg 2009
2
Y.-C. Hsu et al.
existing genes. As a result, genes that share common ancestry tend to have similar structures and functions. In genome analysis, assignment of protein function is based on postulated homology as recognized by high sequence similarity. Nowadays, the most powerful method for inferring the biological function of a gene, or the protein that it encodes, is by sequence similarity searching on sequence databases. Most of the sequence comparison tools, for example, BLAST [1], PSI-BLAST [2], ClustalW [9], etc., rely on the computational identification of similarity between a protein of unknown function and one of known function. With these tools, however, the detection of remote homology by amino acid sequence has proven to be insufficient [13]. In general, most reliable results were obtained upon sequence identity above 40% and matched with a known profile; otherwise, errors would occur at lower sequence identity, especially to those of remote homologies across species[19]. Structural alignment is much more accurate than amino acid sequence comparisons, especially when the sequence similarity is low [10, 13]. However, current protein structure-to-structure comparison tools [8, 10, 11, 14, 15, 17, 18] are developed based on 3D structural comparison among proteins. They are not applicable to those proteins without determined structures. Biologists have identified that many genes in humans have orthologous in yeast and E. coli through similarity search [12,16]. Conservation of structures among proteins involved in initial suggests that fundamental features of replication complexes are maintained in all eukaryotes [16]. As the entire genomes from lower organisms become available, protein sequence comparison provides an even more effective tool for understanding biological function. However, two major obstacles in homology search still remain when the protein structures are unresolved, and only high sequence identity can be found in structurally similar proteins. To tackle with the combination of both constraints, a preliminary solution is offered in this research. Here we present a novel model for similarity comparison of the proteins of unresolved structures. The new approach first predicts the unresolved protein structure from amino acid residues into secondary structure elements (SSEs). Followed by statistical analysis of encoding lengths, the Length Encoded Secondary Structure (LESS) profile is then constructed within a segment-based representation. For a given query protein, its corresponding LESS profile is transformed and pairwisely aligned in parallel way. All the maximal matches are retrieved from the target protein dataset according to the ranked alignment scores. In this research, we examine the performance by comparing our result with one of the conventional sequence comparison tools.
2 Materials and Methods 2.1 Mining Cytochrome P450 Proteins from C. intestinalis Cytochrome P450 (abbreviated CYP or P450) is a very large and diverse superfamily of hemoproteins found in all domains of life [4]. CYP uses a plethora of both exogenous and endogenous compounds as substrates in enzymatic reactions. The most common reaction catalyzed by CYP is a monooxygenation reaction. CYP enzymes have been identified from all lineages of life, including mammals, birds, fish, insects, worms, sea squirts, sea urchins, plants, fungi, slime molds, bacteria and archaea. More than 8,000 distinct CYP sequences are known as of February 2008.
Length Encoded Secondary Structure Profile for Remote Homologous Protein Detection
3
The Human Genome Project has identified more than 63 human genes encoding various CYP enzymes. Many animals have even more CYP genes than humans do. For example, mice have 101 CYP genes, and sea urchins are estimated to have as many as 120 CYP genes. With rapid advances in biotechnology, gene and genome sequencing is far outpacing biochemical characterization of enzymatic function, many genes with close homology to CYPs with known function remains to be discovered. The Ciona intestinalis (C. intestinalis) genome is the smallest of any experimentally manipulable chordate. It provides a good system for exploring the evolutionary Table 1. List of proteins included in the novel dataset (randomly selected from the SCOP database). There were six superfamilies categorized into four major classes : all alpha, all beta, alpha+beta, alpha/beta. 5%12ENCUUKHKECVKQPNGXGNU
%NCUU
(QNF
5WRGTHCOKN[
2TQVGKPU 2&$
CNNCNRJC
%[VQEJTQOG2
%[VQEJTQOG2
F\#LR\#LHD#GWR# SF#J\#K\Q#NHM# WGF#P#QFQ#IYK# P#KQ#WG#PT# RQ#RS#TQ#VSP#
CNNDGVC
*GCVUJQEMRTQVGKP M& *52 RGRVKFGDKPFKPI FQOCKP
*GCVUJQEMRTQVGKP M& *52 RGRVKFGDKPFKPI FQOCKP
EMT#FI#FMZ#FM[# FM\#JUE#
CNRJC DGVC
CNRJCDGVC
P#D#DQ#ELY# EO#H[#IJG# KF#K#K#MWX# OI#O#OLC# #E[N%Q#0 #E[N%Q#0 OM#PUN#QP#RJ# CE[NVTCPUHGTCUGU 0CV CE[NVTCPUHGTCUGU 0CV RWC#S[#SUO#SUQ# SUV#TQ#U\#VKS# WO#WHJ#XJU#[IJ# LL#KKE#NT\#PG# DL#DX#DGN#F[# F[V#F\C#G#ISX# JJ#JK#MH#MO# 40CUG#NKMG 40CUG#NKMG MX\#O#O#PZ# QL#RW#TO#TPH# TTC#WP#TPH#TUC# DC# EXT#HL#ISH#KG$ LZS#M#M#MOE# %CURCUGNKMG %CURCUGNKMG O#POS#POU#PY$ R[Q#SFW#SVP#UJL# CY#CY#DD#DVO# EK#JI#JVK#KH# MX#OL#ON#OQ# 6+/DGVCCNRJC 6TKQUGRJQURJCVG P#PG[#QZ#TT# DCTTGN KUQOGTCUG 6+/ TV#UY#VEF#VKO# VOJ#VRJVRY#VTG# YO#[FX#[RK#DVO#
4
Y.-C. Hsu et al.
origins of the chordate lineage, from which all vertebrates sprouted. In the past decade, the complete genome of this organism has been sequenced; however, its protein structures remain unresolved, as well as many of its functions still remain unknown. In this empirical study, with our proposed method, C. intestinalis is taken as our pilot experiment to find the potential homology to CYP2D (100817353-CYP2D and AAO49806-CYP2D) and CYP17A1 (P05093-CYP17A1). CYP2D and CYP17A1 belong to the subfamilies of CYP, where CYP2D is an enzyme involved in the metabolism of xenobiotics in the body, and CYP17A1 plays an important role with the hydroxylase activity. Currently, in C. intestinalis, only 72 out of total 20,150 genes have proven or hypothesized to be associated with CYP related functions and all the other CYP related genes are yet to be discovered. 2.2 A Novel Dataset for Protein Sequence Classification To demonstrate and evaluate effectiveness of the proposed method for protein sequence comparison, a novel dataset comprised six superfamilies that were randomly selected from the Structural Classification of Proteins (SCOP) database. It consisted of 129 protein structures within all alpha, all beta, alpha+beta, or alpha/beta classes. We will utilize the protein sequence information as our input data only, and the structural information will be applied for final verification processes. Table 1 lists all collected structures in details. 2.3 Proposed LESS Model The proposed model is composed of two modules, the secondary structure prediction and LESS modules, as illustrated in Fig. 1. Details are described as follows.
Fig. 1. System flowchart
Length Encoded Secondary Structure Profile for Remote Homologous Protein Detection
5
2.3.1 Secondary Structure Prediction Module In the absence of empirical protein structure, to build a 3D model of a protein, prediction of the secondary structure provides the possible locations of α-helices, and β-strands within a protein or protein family. For any protein sequence without determined structure, SSpro [3] is applied to predict its secondary structure locations in this study. In fact, any robust and accurate prediction method is applicable in the proposed system as long as all the query and target sequences under evaluation employing the same method for predicting locations of secondary structure elements. 2.3.2 LESS Module As we are targeting on protein comparison at low sequence similarity, LESS is proposed to fuzzy reconstruct the predicted protein secondary structure. As the name implies, the predicted SSE segments are transformed into a profile with length information. For an organism, the length distribution of various types of SSEs (H/E/C) to the occurring amount is statistically analyzed. To preserve equal distribution and probabilities of encoded SSEs within the consideration of length factor, the total occurring amount of predicted SSEs is averagely divided into designated groups. In this research, each type of SSE is divided into 6 groups and assigned with a specified length code, H0~H5, E0~E5, and C0~C5, respectively. A predicted secondary structure sequence is then reconstructed into the LESS profile according to its corresponding code. Hence, the length of predicted secondary structure is reduced, and with LESS profile, the vaguer structural information is retrieved and the similarity comparison can be performed parallelly for proteins categorized in various representative clusters in advance. 2.4 Secondary Structure Prediction To illustrate an example, the total of 20,150 protein sequences of C. intestinalis were retrieved from Ensembl [5] and the SSpro was applied for secondary structure prediction. The amounts of 20,057 sequences were successfully predicted, while system errors occurred for the rest of 93 sequences. Here, the total of 20,057 sequences that successfully predicted were applied as our targeting dataset for LESS encoding and remote homologous protein matching. The SSpro [3] is a server for protein secondary structure prediction, which embeds the correlation into one single recursive neural network. It takes the query of a protein sequence and output the predicted 3-class secondary structures which ‘H’ represents α-helix, ‘E’ as β-strand, and ‘C’ as loop element. The performance accuracy reaches around 78%, which is relatively high comparing with other SSE prediction methods. 2.5 LESS Profile Construction Fig. 2 illustrates the length distribution of each SSE structure in C. intestinalis. Table 2 shows the mapping between conventional SSEs and LESS codes. The average residue number of the C. intestinalis genome is about 400 residues per protein, where the length was reduced to about 45 coded characters averagely after transformed to its LESS profile.
6
Y.-C. Hsu et al.
Fig. 2. (a) Distribution diagram of α-helix element in C. intestinalis. The X-axis represents the length of helix element in genome of C. intestinalis, and Y-axis represents the occurring number of predicted α-helices. (b) Distribution diagram of β-strand element in C. intestinalis. (c) Distribution diagram of loop element in C. intestinalis. Table 2. Mapping between conventional SSEs and LESS profiles of C. intestinalis 5VTWEVWTG
өJGNKZ
%QPXGPVKQPCN 55'U NGPIVJÆ .'55%QFGU *`*Æ* *`*Æ* *`*Æ* *`*Æ* *`*Æ* *`*ЌʳÆʳ˛ˈ
5VTWEVWTG
%QPXGPVKQPCN 55'U NGPIVJÆ .'55%QFGU '`'Æ' 'Æ' 'Æ' 'Æ' 'Æ' '`'ЌʳÆ'
ӪUVTCPF
the
function smooth(smooth_level, input_string) counter = 1 while counter
Mj
then
it is available.
where Mi : remaining memory size of resource node; Mj : required memory size of job; • Resource evaluation component (REC): - evaluates the most suitable node, it consists of the following two steps: Table 4. Contents of CPU level
CPU type
CPU level
Quad-core CPU
High
Dual-core CPU
Middle
Single-core CPU
Low
(1)
16
H.-M. Lee et al.
Step1. selects resource nodes by the CPU level of job request, as shown in Table 3 from the result of RSEC. We divided CPU level into three levels, as shown in Table 4; Step2. selects the node where CPU usage is lowest from the result of Step1. - sends the evaluation result to the request node. 2.2 Execute Process Scheduling Analysis Module (EPSAM) There are two sub-modules in EPSAM, saying message process sub-module (MPSM) and job process sub-module (JPSM), as shown in Fig. 5. The MPSM sends job request to supervisor grid node, and receives the evaluating result from supervisor grid node. Then it will send the result to JPSM. The JPSM transfers job to the selected node. It also receives job transfer from other nodes. EPSAM MPSM
User
JPSM
Supervisor Node
Execute Node
Fig. 5. Framework of the EPSAM
2.2.1 Message Process Sub-Module (MPSM) There are two components in MPSM, saying message send component (MSC) and message receive component (MRC), as shown in Fig. 6. MPSM MSC
MRC
Execute Node
Supervisor Node
Fig. 6. Framework of the MPSM
The functions of these two components are as follows: • Message send component (MSC): - sends job request to supervisor grid node; - sends executed result to the request node. • Message receive component (MRC): - receives the evaluating result from supervisor grid node; - sends the evaluation result to JPSM.
JPSM
A Process Scheduling Analysis Model Based on Grid Environment
17
2.2.2 Job Process Sub-Module (JPSM) There are two components in JPSM, saying job process component (JPC) and job receive component (JRC), as shown in Fig. 7. JPSM Execut e Node
JPC
Execute Node
JRC
MPSM
.
Fig. 7. Framework of the JPSM
The functions of these two components are as follows: • Job process component (JPC): - processes jobs and saves job data, as shown in Table 5; - while the load of node is high, JPC will transfer job to selected resource node and update job table; - sends executed result to MSC while job from request node has finished. • Job receive component (JRC): - receives the result of transfer job from destination node; - receives job transfer from other nodes; - updates job table. Table 5. Contents of job table Job name
Request node name
required memory size
Destination node name
Receive time
Finish time
3 Model Implementation At first, the CPU usage of node A is very high. There are still five jobs waiting for executed. The CPU usage of node B and node C are lower, as shown in Table 6. We transferred jobs of A to B and C by using PSAM. Table 6. The result of implementation Time
Before t1
Node
A
waiting jobs
5 100 %
CPU usage Average CPU utilization
B
t1 to t2 C
0 0 9 25 % % 45%
t2 to t3
After t3
A
B
C
A
B
C
A
B
C
3 100 %
0 39 %
0 55 %
1 100 %
0 58 %
0 77 %
0 100 %
0 84 %
0 56 %
65%
78%
80%
18
H.-M. Lee et al.
Ⅰ
CPU utilization
( ) Load-Balancing According to our experimental result, we can see the loading of B and C were enhanced, and the average CPU utilization of grid was also enhanced, as shown in Fig. 8. The number of waiting jobs in high-loading node was reduced, as shown in Table 6. Therefore, we can make load-balancing of all grid nodes in the system by using our model.
Time (s) Fig. 8. The average CPU utilization
Ⅱ
( ) Integrated Performance Via implementing our model, we can reduce total executed time by making loadbalancing, as shown in Table 7, and have better system performance. Table 7. Total executed time Method
Total executed time (second)
Without PSAM
138.21 (second)
Using PSAM
103.34 (second)
4 Conclusion If jobs and load distributions are not uniform, the load of some grid nodes may be heavy and jobs in high-loading nodes may wait for a long time. If we want to have good performance in the system on grid environment, we should have load-balancing of all grid nodes in the system. In this paper, we propose a process scheduling analysis model based on grid environment. When the load of the node is high, the proposed model, PSAM, can transfer jobs to the most suitable node which selected by supervisor grid node. By this model, we can make all grid nodes be load-balancing. Therefore, we can reduce the number of waiting jobs in high-loading grid node, and enhance CPU usage of idle
A Process Scheduling Analysis Model Based on Grid Environment
19
nodes. In addition, we also can reduce total executed time. Via implementing this model, we can improve the grid environment performance efficiently. Acknowledgments. This work was supported in part by the National Science Council, Taiwan, under grant NSC-95-2745-M-034-007–URD.
References 1. Iosup, A., Epema, D.H.J., Franke, C., Papaspyrou, A., Schley, L., Song, B., Yahyapour, R.: On Grid Performance Evaluation using Synthetic Workloads. In: Frachtenberg, E., Schwiegelshohn, U. (eds.) JSSPP 2006. LNCS, vol. 4376, pp. 232–255. Springer, Heidelberg (2007) 2. Silberschatz, A., Gagne, G., Galvin, P.B.: Operating System Principles, 7th edn. John Wiley &Sons (Asia) Pte Ltd., Chichester (2004) 3. Miller, B.P., Callaghan, M.D., Cargille, J.M., Hollingsworth, J.K., Irvin, R.B., Karavanic, K.L., Kunchithapadam, K., Newhall, T.: The Paradyn Parallel Performance Measurement Tool. IEEE Computer 28(11), 37–46 (1995) 4. Sanjay, H., Vadhiyar, S.: Performance modeling of parallel applications for grid scheduling. Journal of Parallel and Distributed Computing 68(8), 1135–1145 (2008) 5. Li, H., Groep, D., Wolters, L.: Workload characteristics of a multi-cluster supercomputer. In: Feitelson, D.G., Rudolph, L., Schwiegelshohn, U. (eds.) JSSPP 2004. LNCS, vol. 3277, pp. 176–194. Springer, Heidelberg (2005) 6. Lee, H.-M., Hsu, C.-C., Hsu, M.-H.: A Dynamic Supervising Model Based on Grid Environment. In: Khosla, R., Howlett, R.J., Jain, L.C. (eds.) KES 2005. LNCS, vol. 3682, pp. 1258–1264. Springer, Heidelberg (2005) 7. Lee, H.-M., Lee, T.-Y., Yang, C.-H., Hsu, M.-H.: An Optimal Analyzing Resources Model Based on Grid Environment. WSEAS Transactions on Information Science and Applications 3(5), 960–964 (2006) 8. Lee, H.-M., Lee, T.-Y., Hsu, M.-H.: A Process Schedule Analyzing Model Based on Grid Environment. In: Gabrys, B., Howlett, R.J., Jain, L.C. (eds.) KES 2006. LNCS (LNAI), vol. 4253, pp. 938–947. Springer, Heidelberg (2006) 9. Globus (2008), http://www.globus.org 10. Foster, I., Kesselman, C., Tuecke, S.: GRAM: Key concept (July 2008), http:// www-unix.globus.org/toolkit/docs/3.2/gram/key/index.html 11. Foster, I., Kesselman, C.: The Grid 2: Blueprint for a new computing infrastructure, pp. 25–53. Morgan Kaufmann, San Francisco (2004) 12. Foster, I., Kesselman, C.: Gloubs: A Metacomputing Infrastructure Toolkit. International Journal of Supercomputer Application 11(2), 115–128 (1997)
A Resource Broker with Cross Grid Information Services on Computational Multi-grid Environments∗ Chao-Tung Yang1,∗∗, Wen-Jen Hu1, and Kuan-Chou Lai2 1
Department of Computer Science, Tunghai University Taichung, 40704, Taiwan (ROC) {ctyang,g97350004}@thu.edu.tw 2 Department of Computer Science and Information Engineering, National Taichung University Taichung, Taiwan (ROC)
[email protected]
Abstract. Grid computing is now in widespread use, which integrates geographical computing resources across multiple virtual organizations to achieve high performance computing. In this paper, we present a new grid architecture, which integrates multiple computational grids, named Multi-Grid, from different virtual organizations. The proposed architecture could solve the large-scale computational problem. Due to gathering information across different grids has the imprecise problem, the accuracy of information probably affects the computational efficiency. Thus, this paper proposes a cross-grid information service approach to gather resource information. Furthermore, a gathering algorithm, which could balance the query frequency and the resource information accuracy, is present to reduce the load of information servers. Finally, we implement a resource broker with cross-grid information services on multi-grid computational environments.
1 Introduction Grid technology plays an important role in high performance computing. Grid systems integrate distributed computing resources to provide supercomputer-like computing environments [1, 3, 4, 14]. There are more and more proposed grid projects such as Globus, Condor, LEGION, Grid PP, EGEE, P-Grid, DutchGrid, ESnet, and Grid Bus [25-33]. But some of virtual organizations have no the adequate of computing resources, because of the size of virtual organizations. In this paper, we propose a multi-grid architecture to solve the above problem. When a new grid joins in the multi-grid environment by the proposed system, any user could use the entire multi-grid resources. This approach could help these virtual organizations to possess more computing resources without any extra overhead. We also provide a user-friendly web portal which integrates with the resource broker [6, 7, 13-17], the cross grid information service, and the monitoring service, called “Multi-Grid Resource Broker.” The main function of the resource broker is to ∗ ∗∗
This work is supported in part by National Science Council, Taiwan R.O.C., under grants no. NSC 96-2221-E-029-019-MY3, NSC 97-3114-E-007-001, and NSC 97-2622-E-029-003-CC2. Corresponding author.
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 20–31, 2009. © Springer-Verlag Berlin Heidelberg 2009
A Resource Broker with Cross Grid Information Services
21
match the available resources to the user’s requirement. The resource broker helps users to select suitable resources according to user preferences and job characteristics. In our architecture, we chose the Globus Toolkit [1, 24] to be the middleware of grids. Although Globus provides a monitor tool, called MDS [1], we use “Ganglia” [10, 12, 20-23] as the monitor tool in the multi-grid system. Moreover, we propose a Cross-Grid Information Service (CGIS), which describe how to integrate the information in different grids. An information query algorithm is also proposed for adjusting information update time dynamically according to the information fluctuation to reduce the traffic overhead in the information collecting stage. The contribution of this paper is to construct a multi-grid platform, which integrates three grid systems including the Tiger Grid, the Medical Grid, and the Bio Grid [15, 20-22], and furthermore, to design and implement a Multi-Grid Resource Broker [19].
2 Implementation of Multi-grid There are two important issues on integrating different grid systems into a multi-grid environment, which include the authentication and the information gathering. For authentication to access another grid in the multi-grid environment, CA Server exchanges the authentication. We also built a web portal to help users to join the multigrid environment by registration. Collecting the resource status from different grids considers many issues, such as the heterogeneity of the monitors, the accuracy of collected information, and the real-time information [18]. They are described as follows. 2.1 Cross CA The Globus Toolkit authentication is issued by the certificate of GSI. Each user and service is certificated to identify and authenticate the trust between users or services [25]. If two parties have the certificate and both of them trust the CAs, then these two parties could trust each other. This is known as the mutual authentication. There were simple steps to accomplish the cross-grid CA. When a grid tries to register into the multi-grid system (Tiger server as our multi-grid server), the administrator of this grid must upload CA-Packages to the multi-grid server; and the new-join grid exchanges the information of CA server with the multi-grid Server. The steps of exchanging Cross-grid CAs are shown in Figure 1. 2.2 Cross Grid Information Service The monitor tool is the important component in a grid environment [8-12]. A monitor tool could help grid administrator to manage and monitor the machines. On the other hand, the middleware could gather the resource information to find the suitable resource by the monitor tool. There are common monitor tools, such as MDS, Ganglia, Cacti, and Condor [23, 25, 26, 34]. In a multi-grid environment, grids use different monitor tools with different information formats. Therefore, we define a new information format to translate different monitor formats. The proposed format is called IDL (Information Describing Language), as shown in Figure 2. It is responsible to exchange and translate resource information among grids, and to perform the posttransfer filtering to ensure that only necessary information is passed to clients, end users, and software components.
22
C.-T. Yang, W.-J. Hu, and K.-C. Lai
Fig. 1. Steps of joining into the Multi-Grid system
Fig. 2. Information Describing Language
The CGIS consists of three layers: the Core Service Layer, the Translator Layer, and the Resource Layer. The Core Service Layer contains the Agent, Filter, Getter and Setter, and Gather. These components are installed in every grid environment for information gathering and maintenance. The Translator Layer supports a variety of format conversion monitor tool, such as Ganglia, Cacti, and MDS. The information in different monitor tools is transformed into the IDL format. The Resource Layer describes resource information from different grid environments. In this study, it includes Tiger Grid, Medical Grid, and Bio Grid.
A Resource Broker with Cross Grid Information Services
23
Fig. 3. Cross Grid Information Service system architecture
2.3 Resource Broker This study implements a resource broker with the cross-grid information service on the multi-grid computational environment. The resource broker discovers and evaluates multi-grid resources, and makes the decision of job submission depending on the job requirement. The system architecture of the resource broker is shown in Figure 4. Users could easily make use of our resource broker through a common Grid portal [6, 7, 13-17]. When a grid joins into the multiple-grid system, the grid administrator should register into the web portal and provide the personal file and the related information of the grid, which contains the CA package, the grid-mapfile of LDAP, and the machine lists. The web portal interface is shown in Figure 5. The multi-grid system deploys the environment according to the registration information, and then assigns a resource broker account to a single grid user. This account could access the resource supported by the resource broker in the multi-grid environment, Figure 4 shows the concept. The Monitor Service could monitor the resources supported by the multi-grid resource broker. We provide the interface to observe the status of HostInfo, Daemons, and Ganglia. The HostInfo lists the common information by parsing the Information Describing Language file, as shown in Figure 6. Daemon Status inspects the status of
24
C.-T. Yang, W.-J. Hu, and K.-C. Lai
Fig. 4. Resource Broker system architecture
a variety of services, as shown in Figure 7. Ganglia only collect the status of grid resources. In this study, we rewrite the Ganglia codes and modify the setting to support the multiple grids, as shown in Figure 8. Besides, a grid user could execute a parallel program by the workflow service [16] on the Multi-Grid Resource Broker, as shown in Figures 9 and 10.
Fig. 5. Register at Multi-Grid Server
Fig. 6. Multi-Grid Monitor - Host List
A Resource Broker with Cross Grid Information Services
Fig. 7. Multi-Grid Monitor - Daemon Status
Fig. 9. Submit a job
25
Fig. 8. Multi-Grid Monitor – Ganglia
Fig. 10. Assign the machine of grids to execute jobs
3 Algorithm for Information Service A grid information system should be able to effectively gather the resource information for users or middleware. In the Cross Grid Information Service (CGIS), we design an adaptive information query algorithm. If the CGIS could retrieve resource information immediately, the resource information could be consistent with the actual situation; however, too short retrieve times would cause the heavy system loading. The concept of the proposed algorithm is to calculate the dynamic information variation between the last two periodically gathered information. The larger variation implies that there is a bigger chance to gather out-of-date information since the information is changed often currently. Thus we could use the gathering-by-query approach to solve the above problem. In this approach, we use a mathematical formula to illustrate our idea. The parameters used in this algorithm are listed in the following: Without lost of generality, let T0, T1, …, Ti be the time serial when the CGIS gets the information request periodically. And assume that the information query request is arrival at time Ti+1. Infi: the resource information queried from IDL file at time Ti. IVj: the variation percentage of type j information from Ti-1 to Ti. RV: the resource variation percentage of all dynamic information from Ti-1 to Ti. Tinterval: the information gathering period. Tfresh: the time duration for the information to be fresh (which means this information is not out-of-date).
26
C.-T. Yang, W.-J. Hu, and K.-C. Lai
While receiving information request at time Ti+1, we use the last two gathered information at Time Ti and Ti-1 to calculate the information variation. Since there are many resource types in a single IDL file (e.g., CPU loading, memory free, disk free, etc…), we calculate the j type information variation IVj of the last two records as follows. ⎧ Inf i - Inf i −1 , if Inf i ≥ Inf i −1 ⎪ Inf i ⎪ IV j = ⎨ ⎪ Inf i - Inf i −1 , if Inf < Inf i i −1 ⎪⎩ Inf i −1
(1)
Then we calculate the variation among all resource type j by RV =
j = num 1 × ∑ IV j num 1
(2)
Beside the information variation, another key point to determine whether the information out-of-date is the query arrival time. When the time interval from query arrivals to the last gathering time decreases, the chance to get a out-of–date information decreases. Therefore, after receiving the information query request, we determine each type of the request Reqj to check whether this information is dynamic (e.g., the memory free size is dynamic). When the characteristic of the information is static (i.e., it does not change over time), the pre-gathered information is then used to answer the query. When the characteristic of the information is dynamic, we calculate the time period Tclose from the arrival time of this information query to the last periodical gathered time as follows.
Tclose = CurrentTime − Ti
Fig. 11. Adaptive query information algorithm
(3)
A Resource Broker with Cross Grid Information Services
27
When Tclose decreases, there is less possibility for the historical record to be out-ofdate. Therefore, the historical record could be used directly. Here, we define the threshold Tfresh for the information to be fresh as the following equation.
T fresh = (1 − RV ) × Tint erval
(4)
If the Tclose is less or equal to Tfresh, it means that the historical information is still fresh to answer the query directly. Otherwise, we use the gathering-by-query approach to prevent out-of-date issues. The detailed algorithm is shown in Figure 11.
4 Experimental Results In this study, the proposed multi-grid system consists of the Tiger Grid, Medical Grid, and Bio Grid. We choose the Medical Grid and Bio Grid as our experimental environment. Table 1 and Table 2 show the number of CPU/core, speed (MHz) and memory sizes (MB). The Medical Grid consists of 57 processors located at 5 universities. The Bio Grid consists of 22 processors located at 1 university. We implemented the CGIS on the Medical Grid and the Bio Grid. The experiments are performed on the two grids for gathering experiment results in different grid systems. We assume that the times to send requests are 25, and each request is send Table 1. Resource Status in Medicare Grid Site THU CHU FCU NTHU PU
Number of CPU/Core 32 8 14 12 4
Total Speed (MHz) 73,600 8,000 24,000 15,172 7,302
Total Memory (MB) 8,192 1,024 11,264 6,144 4,096
Table 2. Resource Status in Bio Grid Site
infobio mbio01 bio01 bio02 bio03 bio04 bio05 bio06 bio07 bio08 bio09
Number of CPU/Core 2 2 2 2 2 2 2 2 2 2 2
Total Speed (MHz) 2,793 2,058 2,793 2,058 2,058 2,058 2,010 2,058 2,793 2,793 2,793
Total Memory (MB) 1,024 1,024 1,024 1,024 1,024 1,024 1,024 1,024 1,024 1,024 1,024
28
C.-T. Yang, W.-J. Hu, and K.-C. Lai
Fig. 12. Resource loading of resource A in 60 minutes
Fig. 13. Resource loading of resource B in 60 minutes
randomly in 60 minutes. We also assume that the information gathering period is 5 minutes which refer to the Ganglia update time. We compare our algorithm in real grid environment. The different system loading of resource A and resource B are shown in Figures 17 and 18. In this study, we compare the adaptive information query algorithm applied in CGIS with the gathering-by-query strategies. The details of strategies are shown as fellows: Gathering-by-query (GBQ) approach: In this strategy, CGIS gathers the resource information immediately from the cross-grid environment after obtaining the request from other components. The retrieved information would be saved by an IDL file in the database on time. Periodical-gathering approach: The difference between the periodicalgathering approach and the gathering-by-query strategy is the informationupdate time period. After receiving the request from other components, CGIS would not retrieve information immediately. The information would be updated periodically. As shown in Figures 13 and 15, the adaptive information query algorithm is better than the other two strategies. In this paper, we set the times of sending requests are 25. In the gathering-by-query strategy, CGIS retrieves resource information immediately. In the periodical-gathering strategy, most of the times are used to retrieve data rather than read history file, this approach reduces the access time. We could use the gathering-by-query approach in the single-grid environment, but the data transfer time in the cross-grid environment is much longer than that in the single-grid environment. So we try to balance the query frequency and the information accuracy. The accuracy of the adaptive information query approach is shown in Figures 14 and 16. Our algorithm reduces the data retrieving time and obtains a better accuracy. At the same time, there are few retrieving times and better accuracy on the resource A with a few system’s loading peaks. The average accuracies on resource A and B are 81% and 87%; and the requests were sent randomly in 60 minutes. To show that the average accuracy are not depended on time series, we calculate the average accuracy on 20 minutes, 40 minutes, 60 minutes, 80 minutes, 100 minutes and 120 minutes. The experimental results are shown in Figure 17.
A Resource Broker with Cross Grid Information Services
29
100
Information accuracy(%)
90 80 AIQ
70 60
PeriodicalͲ gathering
50 40
QueryͲbyͲ Gather
30 20 10 0 0:00
0:20
0:40
1:00
Time
Fig. 14. Information retrieval times on resource A
Fig. 15. The variety of information accuracy on resource A 100
Information accuracy(%)
90 80 AIQ
70 60
PeriodicalͲ gathering
50 40
QueryͲbyͲ Gather
30 20 10 0 0:00
0:20
0:40
1:00
Time
Accuracy(%)
Fig. 16. Information retrieval times on resource B
Fig. 17. The variety of information accuracy on resource B
100 90 80 70 60 50 40 30 20 10 0
resource A resource B
20
40
60
80
100
120
Experiment time (mins)
Fig. 18. The variety of average accuracy for different experiment time
5 Conclusion and Future Work In this paper, we construct a multi-grid computational grid platform, which integrates the three grids, and propose an effectively information gathering method. Users could monitor the status of the multi-grid and execute the workflow by the web portal to achieve high-performance computing without any comprehend complicated instructions. When more and more virtual organizations join into the multi-grid environment, the computing resource would progressively grow up. In the future, we focus on the approach for efficiently gathering the information among different grids.
30
C.-T. Yang, W.-J. Hu, and K.-C. Lai
Because of that the accuracy of gathered information would indirectly affect the efficiency of computing, using P2P technique for information exchanging could improve the above question in the entire system.
References 1. Foster, I., Kesselman, C.: Globus: A Metacomputing Infrastructure Toolkit. International Journal of Supercomputer Applications 11(2), 115–128 (1997) 2. Laszewski, V., Foster, I., Gawor, J., Lane, P.: A Java commodity grid kit. Concurrency and Computation: Practice and Experience 13, 645–662 (2001) 3. Czajkowski, K., Fitzgerald, S., Foster, I., Kesselman, C.: Grid Information Services for Distributed Resource Sharing. In: Proceedings of the Tenth IEEE International Symposium on High-Performance Distributed Computing. IEEE press, Los Alamitos (2001) 4. Foster, I., Karonis, N.: A Grid-Enabled MPI: Message Passing in Heterogeneous Distributed Computing Systems. In: Proceedings of 1998 Supercomputing Conference (1998) 5. Tang, J., Zhang, M.: An Agent-based Peer-to-Peer Grid Computing Architecture. In: First International Conference on Semantics, Knowledge and Grid, 2005, SKG 2005, p. 57 (November 2005) 6. Aloisio, G., Cafaro, M.: Web-based access to the Grid using the Grid Resource Broker portal. Concurrency Computation: Practice and Experience (14), 1145–1160 (2002) 7. Krauter, K., Buyya, R., Maheswaran, M.: A taxonomy and survey of grid resource management systems for distributed computing. Software Practice and Experience (32), 135–164 (2002) 8. Baduel, L., Matsuoka, S.: Peer-to-Peer Infrastructure for Autonomous Grid Monitoring. In: Parallel and Distributed Processing Symposium (2007) 9. Kim, D.-H., Kang, K.-W.: Design and Implementation of Integrated Information System for Monitoring Resources in Grid Computing. In: Computer Supported Cooperative Work in Design, CSCWD 2006 (2006) 10. Sacerdoti, F.D., Katz, M.J., Massie, M.L., Culler, D.E.A.C.D.E.: Wide area cluster monitoring with Ganglia. In: Proceedings of 2003 IEEE International Conference on Cluster Computing, 2003, pp. 289–298 (2003) 11. Chung, W.-C., Chang, R.-S.: A new mechanism for resource monitoring in grid computing. Future Generation Computer Systems (accepted manuscript) (available online April 29, 2008) (in press) 12. Yang, C.T., Chen, T.T., Chen, S.Y.: Implementation of Monitoring and Information Service Using Ganglia and NWS for Grid Resource Brokers. In: Proceedings of 2007 IEEE Asia-Pacific Services Computing Conference, Tsukuba, Japan, December 11-14, 2007, pp. 356–363 (2007) 13. Yang, C.T., Lai, C.L., Shih, P.C., Li, K.C.: A resource broker for computing nodes selection in grid computing environments. In: Jin, H., Pan, Y., Xiao, N., Sun, J. (eds.) GCC 2004. LNCS, vol. 3251, pp. 931–934. Springer, Heidelberg (2004) 14. Yang, C.T., Shih, P.C., Li, K.C.: A high-performance computational resource broker for grid computing environments. In: 19th International Conference on Advanced Information Networking and Applications, AINA 2005, vol. 2, pp. 333–336 (2005) 15. Yang, C.T., Li, K.C., Chiang, W.C., Shih, P.C.: Design and Implementation of TIGER Grid: an Integrated Metropolitan-Scale Grid Environment. In: Proceedings of tdhe 6th IEEE International Conference on PDCAT 2005, December 2005, pp. 518–520 (2005)
A Resource Broker with Cross Grid Information Services
31
16. Yang, C.T., Lin, C.F., Chen, S.Y.: A Workflow-based Computational Resource Broker with Information Monitoring in Grids. In: Fifth International Conference on Grid and Cooperative Computing (GCC 2006), pp. 199–206 (2006) 17. Yang, C.T., Chen, S.Y., Chen, T.T.: A Grid Resource Broker with Network BandwidthAware Job Scheduling for Computational Grids. In: Cérin, C., Li, K.-C. (eds.) GPC 2007. LNCS, vol. 4459, pp. 1–12. Springer, Heidelberg (2007) 18. Yang, C.T., Shih, P.C., Chen, S.Y.: A Domain-Based Model for Efficient Measurement of Network Information on Grid Computing Environments. IEICE - Trans. Inf. Syst. E89-D, 738–742 (2006) 19. Multi Grid, http://gamma2.hpc.csie.thu.edu.tw/ 20. Tiger Grid, http://gamma2.hpc.csie.thu.edu.tw/ganglia/ 21. Medical Grid, http://eta1.hpc.csie.thu.edu.tw/ganglia/ 22. Bio Grid, http://140.128.98.25/ganglia/ 23. Ganglia, http://ganglia.sourceforge.net/ 24. Java CoG Kit, http://wiki.cogkit.org/ 25. Globus, http://www.globus.org/ 26. Condor, http://www.cs.wisc.edu/condor/ 27. LEGION, http://www.cs.virginia.edu/~legion/ 28. GridPP, http://www.gridpp.ac.uk/ 29. EGEE, http://www.eu-egee.org/ 30. P-Grid, http://www.p-grid.org/ 31. DutchGrid, http://www.dutchgrid.nl/ 32. ESnet, http://www.es.net/ 33. GridBus, http://www.gridbus.org/ 34. Cacti, http://www.cacti.net/
Fleet: An Effective System for Publish/Subscribe Service over P2P Networks Chyouhwa Chen1, Chia-Liang Tsai1, and Kun-Cheng Tsai2 1
Department of Computer Science and Information Engineering, National Taiwan University of Science and Technology
[email protected] 2 Institute for Information Industry, Taiwan, R.O.C.
[email protected]
Abstract. We propose a new Publish/Subscribe system, called Fleet, that seamlessly combines a novel subscription mapping scheme and a structured overlay network address space partitioning technique to build an effective content-based publish/subscribe (pub/sub) system over a distributed hash table (DHT) overlay. Fleet employs an explicit mechanism to deal with skewed popularity distributions in subscriptions and events, which spreads the load generated by hot attributes across a multitude of peers. The address space partitioning event delivery mechanism expedites event delivery. Fleet strikes an ideal balance between subscription storage cost and event delivery cost, and is more scalable in the number of events, subscriptions, schema attributes, and number of system nodes. Keywords: distributed hash table, P2P Networks, peer-to-peer protocols, structured overlay networks.
1 Introduction Content-based publish/subscribe [2,3,6,7,8,10,13,15,18,19] is becoming increasingly popular for information dissemination from event publishers to event subscribers. Subscribers register their interests in events through subscriptions by using a set of predicates or constraints over event attributes in a subscription language. An event instance published by a publisher specifies values of a set of attributes associated with the event using a similar set of predicates or constraints. Upon receiving an event, the pub/sub system is responsible for finding the subscriptions that match the event and delivers the event to the matched subscribers. In this manner, subscriptions act as filters for subscribers to select desired events out of all possible events published. The subscription language is made up from a content-based pub/sub schema, which is defined as S = { A1 , A2 ,..., An } , where each Ai corresponds to an attribute. Each
attribute has a name, type, and domain and is usually denoted by a tuple [name,type, min, max]. The type could be integer, float, string, etc. The min and max values define the range of values that can be taken by an attribute. An event e is of the form e = { A1 = c1 , A2 = c2 ,..., An = cn } , where Ai ∈ S . A subscription is a conjunction of predicates or constraints involving only equality operators. Each constraint in a A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 32–43, 2009. © Springer-Verlag Berlin Heidelberg 2009
Fleet: An Effective System for Publish/Subscribe Service over P2P Networks
33
subscription has a name, type, operator, and constant value or a range and specifies the constant value or range allowed for an attribute. An example subscription is s = ( A1 = 100) ∧ (2 ≤ A3 ≤ 5) . An event e satisfies or matches a subscription s if each constraint in s is satisfied by the value of the corresponding attribute contained in e. One general strategy for pub/sub system design, called the rendezvous strategy, is to create mapping functions from events and subscriptions to peer nodes that guarantee that the matched events and subscriptions meet in at least one peer node[2]. Clearly, if a subscription is mapped to and stored at a certain node n in the network, and later on, an event satisfying the subscription is published, then the event must also be mapped to the same node n as well, so that the satisfaction of the event can be checked against the subscription and delivered to its subscriber. This requirement that destination nodes must overlap for subscriptions and matched event mappings is called the “strict mapping intersection rule.” Another variant of the general strategy is to make sure that the routes followed by published events and by subscriptions intersect in at least one node[3]. These type of mapping functions is said to satisfy the “extended mapping intersection rule.” Collectively, we call the peer nodes where subscriptions are stored and later potential events are delivered for matching the rendezvous nodes (RNs). The rendezvous strategy is general and encompasses a wide range of systems. In this paper we’ll focus on designs that employ “strict mapping intersection rule.” The subscription and event mapping functions may be broadly classified into several categories[15]. z z
z
Pure attribute name-based (PAN): The pure attribute-name-based mappings are based on attribute names appearing in the subscriptions and events. Pure attribute value-based (PAV): The pure attribute-value-based mappings are based on all possible values among selected attributes in the subscriptions, and usually require too much storage overhead because the number of subscription replications created is based on hashing all possible values. Mixed name and value based scheme: The mixed mappings combine the previous two schemes and are based on selected attribute name and values in the subscriptions and events.
Each mapping scheme has its own strengths and weaknesses. For example, when the number of attribute names is in the dozens[15,19], the pure attribute-name-based schemes would store the subscriptions only on a small number of peer nodes, which take sole responsibilities in the operation of a pub/sub system. This is contrary to the spirit of P2P systems. However, when the number of attributes is large, the pure attribute name-based scheme may be a reasonable choice. For systems based on pure attribute-value based mapping functions, the risk of subscription bloat is high and must be carefully avoided. A popular method to combat the subscription bloat problem is to “quantize”[21] the attribute values, so the number of subscriptions created is reduced. Hybrid name and value-based mappings are another possible method to reduce the number of subscription replications. There have been many attempts at designing distributed publish/subscribe systems over distributed hash tables (DHTs) as DHT systems possess many nice properties in scalability, fault-tolerance, and self-organization. In these systems, peers are assigned responsibilities to cooperate in storing subscriptions and routing events to subscribers
34
C. Chen, C.-L. Tsai, and K.-C. Tsai
in a distributed manner. For DHT-based systems, the mapping functions project subscriptions and events onto keys or addresses in the DHT address space which are then managed by rendezvous nodes. In this paper, we propose Fleet, an efficient and scalable system built on top of DHTs that is more scalable, and strikes an ideal balance in the tradeoff between storage and event delivery costs.
2 Related Work This paper focuses on designs following the general rendezvous node strategy over the Chord structured overlay network [2,15,19], which is a simple and elegant architecture over which the rendezvous node strategy can be implemented. Chord allows enough flexibility to enable many interesting variants of the mapping functions to be devised, with different performance implications. In the following we will present proposals specifically targeting implementation over Chord. We will briefly discuss three of the proposals. In [2], Baldoni et al proposed three types of mapping functions. The first type requires much storage overhead because the number of subscription replications created is based on hashing all possible values of all the constraints in a subscription. The second type is a variant of the first type. The third type is based on the observation that many subscriptions exhibit strong selectivity in one of the attributes, which allow only a small portion of all possible values. Mapping a subscription using the most selective attribute reduces subscription replications. Therefore, the third type maps a subscription by using its most selective constraint. In [15], the IIM scheme proposes to “quantize” [21] the attribute domain values, or partition the domain into a number of sub-ranges. Subscription with range attributes are then replicated once in each sub-range. The representative values selected for each sub-range might be the smallest or the middle values in each partitioned sub-range. Similar ideas for range query processing have also been proposed previously [12]. The same paper also proposes Hybrid, which is a mixed name and value-based scheme. Hybrid randomly selects a constraint. It replicates the subscription according to the attribute name if the selected constraint is of range value type, and according to the constraint is of equality type. In Ferry [19], a novel address space partitioning mechanism is proposed for subscription installation and delivery. The overlay address space is portioned into disjoint segments, with each one assigned to and managed by an overlay node, called rendezvous points (RP). Each segment’s RP node is the peer whose ID is the smallest among all peers in the segment. Each subscription is stored on exactly one RP node, without replication in Ferry, in the form of a pair (SID,s), where SID is the subscriber’s node ID and s is the subscription itself. In Ferry’s PredRP subscription installation scheme, which is the more efficient one among the two proposed, each subscription is stored at the RP node, among all RP nodes, which is the most immediate predecessor of the SID. That is, RP nodes are responsible for subscriptions falling into its responsible segments only. Afterwards, when an event is published, the event is first replicated and then sent to all the RP nodes for subscription matching against the subscriptions stored therein. The matching operation on each RP node
Fleet: An Effective System for Publish/Subscribe Service over P2P Networks
35
produces a list of SIDs representing the subscriptions satisfied by the event. With a list of SIDs, each RP node delivers the event to the subscribers in its own segment, using the embedded packet forwarding tree in the underlying Chord DHT. The RP node itself is the root of the embedded tree, at level 0. The level 1 nodes are those peers in the finger table whose IDs fall into the segment managed by the root RP node, and so on. The event delivery then starts from the RP node which sends out the event and a SID list along its finger table links. A peer, upon receiving the message, checks to see if the SID list contains a subscriber ID matching its own ID. If it does, it delivers the event to its local applications/users. It also partitions the remaining list of SIDs, if any, according to its own neighbor nodes and sends each partitioned list of remaining SIDs to the corresponding neighbors to continue the delivery of the event.
3 Fleet System Design The design of Fleet is based on a number of rationales. First, Fleet embodies a novel architecture for pub/sub that decouples the logical roles for subscription storage and event delivery played by RN nodes in all previous systems. In Fleet, RN nodes are responsible for subscription storage and event matching only. RP nodes partition the structured overlay network address space, and are responsible solely for event delivery, given a list of SIDs. In this manner, faster event delivery is achieved, while system workload is spread out to more peers. Secondly, to handle the load balancing issue for popular attributes that exhibit skewed distributions, a data driven approach to solve the problem is adopted. The attribute-value partition tree mechanism, which was previously proposed and used in range query processing, is used in Fleet to spread the load for subscription storage and matching for popular attributes over multiple nodes. Thirdly, a novel mapping function for subscription installation is proposed which has two features. First, the notion of dominating attribute[2,4] is used extensively for subscription installation to reduce the subscription bloat problem. Those attributes involving equality operator or with the smallest value ranges are preferentially selected for subscription installation. Second, the mapping function is a mixed attribute name and value scheme. This design exploits the scalability property of the underlying P2P overlay, so that every node may take responsibility in the pub/sub process. In the following, we first introduce the notion of value partition tree and then present the components in Fleet in detail. 3.1 Skewed Subscription Name and Value Distributions Handling Based on Value Partition Tree
It is commonly observed that attributes in the subscriptions and events are much more popular than others, often following the Zipf’s distirbution. To handle the most popular attributes, the value partition tree [5] mechanism is used so that subscriptions would not be concentrated on a small number of nodes. The multi-attribute value partition tree scheme enables spreading of workload to multiple peers in a controlled manner effectively, depending on the desired degree of spreading.
36
C. Chen, C.-L. Tsai, and K.-C. Tsai
For example, Figure 1 depicts the value partition tree for the single attribute “retractions.” The attribute has [0~99] as its domain, which has been partitioned across 12 nodes. In Fleet, only a number of most popular attribute combinations have associated value partition trees created for them. This is because the few most popular combinations already account for a large portion of the total number of subscriptions. In addition, it is required that all nodes have knowledge of all the value partition trees constructed. Requiring all nodes to keep information regarding only a few value partition trees would be a reasonable assumption.
Fig. 1. An example value partition tree for a popular attribute
3.2 Algorithms for Subscription Installation, Event publishing, Event Matching and Delivery
The subscription installation algorithm is depicted in Figure 2. As mentioned, the design is based on the notion of dominating attributes. Therefore, subscriptions are divided into three categories according to constituent constraints. First, subscriptions containing equality-type constraints are replicated only once according to the constant value specified in the equality constraint. Second, subscriptions containing very popular attribute combinations that have associated value partition trees are treated in an attribute name-based manner. An example will be shown later. Thirdly, the rest of the subscriptions, which contain only less popular attributes, will be replicated according to am attribute that specifies the smallest range value among all rangevalued attributes in the subscription. In this manner, Fleet creates only relatively small number of replications, resulting in the reduction of total storage and event matching costs, as will be shown later. As an illustration for the operation involving the value partition tree, consider the subscription s= {25 ≤ retraction < 50} to be installed. After consulting the associated value partition tree for attribute “retraction,” it is found that the subscription should be installed on nodes with Kautz ID 021, 101, 102 and 120. Copies of the subscription are then sent to nodes responsible for hashed values of those IDs: h(021), h(101), h(102) and h(120).
Fleet: An Effective System for Publish/Subscribe Service over P2P Networks
37
Algorithm Subscription_installation( s ) 1). If any constraint equality-type Ai = c
in
the
subscription
s
is
of
2). Store s in the successor broker of h( Ai , c) 3). Else if any combination of the attributes has an associated value partition tree 4). Store s according to its value partition tree 5). Else //all the constraints are of rang-query-type clow ≤ Ai ≤ chigh , 6).
Pick the attribute which is the dominating attribute in s 7). B = Index(Vlow ( Ai ), Ai ) 8). While B ≤ Index(Vhigh ( Ai ), Ai ) 9). Store s in the successor broker of h(B); 10). B = B + ⎡⎢ (Vmax ( Ai ) − Vmin ( Ai )) / | Interval ( Ai ) |⎤⎥ Fig. 2. Fleet subscription installation algorithm
Lines 6~10 handle the less popular range-valued attributes in the subscriptions. The approach adopted is to quantize the attribute values and store the subscriptions only at nodes responsible for those quantized attribute values, similar to the approaches used in [12,15]. The definition for the notions used is shown in Table 1. There are two aspects to a quantization scheme for each attribute A : the initial value and the quantization step size ∆ A . To spread the subscriptions to more nodes, it is important that the quantized starting values are randomized across attributes. In Table 1. The definition for the notions used
Vequal ( Ai )
The constant value c in an equality-type constraint Ai = c in a subscription
Vmin ( Ai ) / Vmax ( Ai )
The lower/upper bound value in an attribute’s domain of values
Vlow ( Ai ) / Vhigh ( Ai )
The lower/upper bound value in a rangevalued constraint c1 < Ai < c2
Index(v, Ai )
The quantized value obtained after quantization of v for attribute Ai
Interval ( Ai )
The set of all quantization values for attribute Ai
| Interval ( Ai ) |
The size of the set Interval ( Ai )
38
C. Chen, C.-L. Tsai, and K.-C. Tsai
Fleet, the quantized starting value for each attribute A is initialized by the introduction of some randomization as: Index(Vlow ( A), A) = Vlow ( A) − h( A)%∆ A , where
h() is the Chord hashing function. With respect to quantization step size design for these attributes, ideally, a suitable step size ∆ A should be chosen for each attribute A depending on the desired replication level for the particular attribute. However, as the attribute specific quantization step scheme is more complex, attribute specific quantization step design is left for future research. To publish an event, the algorithm executed at a node is shown in Figure 4. If the event involves attribute combinations that have associated value partition trees, the event must be delivered according to the associated value partition tree first, because the subscriptions stored there are not stored in any other nodes. Then for each constraint in the event, the event is delivered to the node responsible for the hashed value of the constant value specified in the constraint. Algorithm Publish_event(Event e) 1). For all combinations of the attribute names having associated value partition trees 2). Find the RN node responsible for the event according to the value partition trees 3). Deliver e to the designated RN node 4). For each attribute Ai in the event e, 5). Deliver e to the successor broker of h( Ai , c) Fig. 3. Fleet event publishing algorithm
The event matching algorithm executed at each RN node is shown in Figure 6, when a published event is received. Match_event() is a simple linear subscription matching algorithm, since it is not the main focus of this paper. A number of efficient sublinear algorithms have been proposed for event matching[1,11, 17]. Usually, these algorithms merge similar subscriptions into a tree or use hashing techniques to enable efficient subscription retrieval. How to incorporate those techniques into Fleet will be investigated in future work. Algorithm Match_event(Event e) 1). For all subscription in the node’s subscription store 2). Check to see if e satisfies each subscription 3). Collect those satisfied into a SID list 4). Partition the SID list according to the RP node IDs, and send each partitioned list to the appropriate RP Fig. 4. Algorithm Match_event()
Fleet: An Effective System for Publish/Subscribe Service over P2P Networks
39
For the final event delivery from RP nodes to the subscribers, Fleet adopts the same strategy as Ferry. However, the choice of which peers may serve as RP nodes is considerably more unrestricted in Fleet.
4 Performance Evaluation Using a pub/sub system simulator, we compare the performance of Fleet, Ferry, IIM, and Hybrid. We use the realistic workload generator developed in the Siena project to avoid biasing any particular scheme. As a first evaluation of our approach, we have chosen to have the top 5 most popular attribute combinations to have associated value partition trees. The set of experiments performed include the following. (1) Total subscription storage cost and total computation (event matching) cost: The total storage cost is defined to be the total number of subscription replicas installed on the network nodes for a pub/sub system. The total computation cost is the total number of matching operations performed between events and subscriptions by RN nodes. (2) Distribution of subscription storage cost and event matching cost: The distribution of the subscriptions is illustrated by number of subscriptions on the top 100 nodes with the most number of subscriptions. The distribution of the matching cost is illustrated by number of matching operations performed by the top 100 nodes that perform the most number of such operations. (3) Average Event delivery cost: The average number of hops needed along the complete path for event delivery, from event publisher nodes to the subscribers.
The default parameters used in the experiments are as follows. The number of peer nodes is 1000, the number of subscriptions is 50,000, the number of events in the system is 100,000. The quantization step size for attributes is 10. The number of attributes is 1000, distributed according to the Zipf’s distribution. The domain size for integer and floating point attributes are both 0~5000. Note that a larger number of attributes are used in our experiments, to be more consistent with realistic workloads. 4.1 Total Subscription Storage Cost and Total Event Matching Cost
The total number of subscriptions installed in the system is shown in Figure 5. The horizontal axis is the prevalence of equality operators on subscriptions, which is varied from 100% to 0%, with 0% denoting the scenario where all constraints are of range value types. The vertical axis is the number of times the total number of subscriptions created by each system relative to the originally issued number of subscriptions. As Ferry and Hybrid do not replicate subscriptions, their values are 1 in the Figure. The simple quantization scheme proposed by IIM results in more significant subscription replication bloat, while Fleet shows a modest level of replication bloat. When the prevalence of the equality operator is 100%, none of the systems replicate subscriptions. The replication becomes progressively more when the subscriptions consist of more and more proportions of non-equality operators.
40
C. Chen, C.-L. Tsai, and K.-C. Tsai
14 12 10 Ferry
8
Hybrid IIM
6
Fleet
4 2 0 100%
75%
50%
25%
0%
Fig. 5. Total number of subscriptions installed by each scheme
Figure 6 depicts the total amount of computation by all systems. The vertical axis is the number of times the total number of event matching performed by each system relative to the originally issued number of events multiplied by the number of subscriptions. Ferry’s performance is exactly as expected, because every event is matched against every subscription exactly once. As subscriptions are more evenly spread and to more nodes in Fleet and Hybrid, they requires very little total computation cost.
Fig. 6. Total amount of computation in each scheme
4.2 Distribution of Subscription Storage Cost and Event Matching Cost
The cumulative percentage of subscription replications on nodes, which are ranked in decreasing number of subscription stored order, is shown in Figure 7. Clearly, in Ferry, subscription replications are concentrated among a few nodes. Hybrid can spread the subscriptions to more nodes relative to IIM, due to the large number of attribute names in our scenario. However, Fleet can spread the subscriptions not only to the most number of peers in the system, but also the load more evenly among the peers.
Fleet: An Effective System for Publish/Subscribe Service over P2P Networks
41
1.2 1 0.8 0.6 0.4 Ferry_0 Hybrid_0
0.2
IIM_0 Fleet_0
0 0
100
200
300
400
500
600
700
Fig. 7. Cumulative percentage of subscription replication distribution among nodes
1.2 1 0.8 0.6 0.4 Ferry_0 Hybrid_0
0.2
IIM_0 Fleet_0
0 0
100
200
300
400
500
600
700
Fig. 8. Cumulative percentage of computation cost distribution among nodes
More significantly, Fleet can spread the computation cost more evenly as well. The cumulative percentage of event matching cost is shown in Figure 8. It can be seen that, in both Ferry and Hybrid, only a small number of nodes performs the majority of the total matching operations. Fleet again performs the best by spreading the computation cost more evenly among the nodes. 4.3 Event Delivery Cost
The event delivery cost performance results are shown in Figure 9. Even though Fleet requires events to travel from event publisher nodes to RN nodes, and then to their subscribers via RP nodes, the average number of hops required is still comparable to Ferry, and much less than those in Hybrid and IIM. This result clearly demonstrates the effectiveness of an architecture that separates event matching from event delivery.
42
C. Chen, C.-L. Tsai, and K.-C. Tsai
Fig. 9. Average number of hops for event delivery
5 Conclusions and Future Work In this paper, we have demonstrated the effectiveness of the Fleet design. Fleet strikes a nice balance between subscription replication and event matching computation workload, and excels in load balancing, and event delivery efficiency. For our future work, there are many areas that require further investigation. First, we plan to investigate the scalability property of Fleet, when the overlay network has many more nodes, attributes, and subscriptions. Second, we plan to investigate the impact of degree of subscription and event skew on system performance. Based on the result, we can clearly decide how many value partition trees should be constructed beforehand. Third, we plan to incorporate features from other event matching algorithms into our mapping functions to achieve even better effectiveness. Fourth, the Zipf parameter for the subscriptions must be estimated. A number of approaches have been proposed in the literature. For example, Beehive[16] employs a combination of local measurement and limited aggregation. In [22], first the total number of events is estimated by gossip based sampling protocol. Then the rate for individual events is estimated. Finally, the impact of different number of RP nodes and their positioning over the underlying structured network have on system performance must be investigated.
References 1. Aguilera, M.K., Strom, R.E., Sturman, D.C., Astley, M., Chandra, T.D.: Matching events in a content-based subscription system. In: Proceedings of the eighteenth annual ACM symposium on Principles of distributed computing (1999) 2. Baldoni, R., Marchetti, C., Virgillito, A., Vitenberg, R.: Content-Based Publish-Subscribe over Structured Overlay Networks. In: ICDCS (2005) 3. Castelli, S., Costa, P., Picco, G.P.: Large-Scale Content-Based Routing in a Multidimensional Space. In: INFOCOM 2008 (2008) 4. Cai, M., Frank, M., Chen, J., Szekely, P.: MAAN: A Mulit-Attribute Addressable Network for Grid Information Services. Journal of Grid Computing 2(1), 3–14 (2004)
Fleet: An Effective System for Publish/Subscribe Service over P2P Networks
43
5. Li, D., Cao, J., Lu, X., Chen, K.: Efficient Range Query Processing in Peer-to-Peer Systems. IEEE Transactions on Knowledge and Data Engineering (accpted, 2009) 6. Carzaniga, A., Rosenblum, D.S., Wolf, A.L.: Design and Evaluation of a Wide-Area Event Notification Service. ACM Trans. on Computer Systems 19(3), 332–383 (2001) 7. Carzaniga, A., Rutherford, M.J., Wolf, A.L.: A Routing Scheme for Content-Based Networking. In: Proceedings of IEEE INFOCOM 2004, Hong Kong, China (March 2004) 8. Carzaniga, A., Wolf, A.L.: Forwarding in a Content-Based Network. In: Proceedings of ACM SIGCOMM, Karlsruhe, Germany, pp. 163–174 (August 2003) 9. Carzaniga, M.J.R., Wolf, A.L.: A Benchmark Suite for Distributed Publish/Subscribe Systems. Technical Report CU-CS-927-02, Department of Computer Science, University of Colorado (April 2002) 10. Chockler, G., Melamed, R., Tock, Y., Vitenberg, R.: Constructing scalable overlays for pub-sub with many topics. In: Proceedings of the twenty-sixth annual ACM symposium on Principles of distributed computing (2007) 11. Fabret, F., Jacobsen, A., Llirbat, F., Pereira, J., Ross, K., Shasha, D.: Filtering algorithms and implementation for very fast publish/subscribe systems. ACM SIGMOD Record 30(2) (June 2001) 12. Gao, J., Steenkiste, P.: An Adaptive Protocol for Efficient Support of Range Queries in DHT-based Systems. In: Proceedings of the 12th IEEE International Conference on Network Protocols (2004) 13. Gupta, A., Sahin, O.D., Agrawal, D., El Abbadi, A.: Meghdoot: Content-based publish/Subscribe over P2P networks. In: Jacobsen, H.-A. (ed.) Middleware 2004. LNCS, vol. 3231, pp. 254–273. Springer, Heidelberg (2004) 14. Li, D.S., Lu, X.C., Wu, J.: FissionE: A Scalable Constant Degree and Low Congestion DHT Scheme Based on Kautz Graphs. In: Proc. IEEE INFOCOM, pp. 1677–1688 (2005) 15. Lo, S.C., Chiu, Y.T.: Design of Content-Based Publish/Subscribe Systems over Structured Overlay Networks. IEICE Trans. on Information and Systems E91-D(5), 1504–1511 (2008) 16. Ramasubramanian, V., Sirer, E.G.: Beehive: O(1) Lookup Performance for Power-Law Query Distributions in Peer-to-Peer Overlays. In: Proceedings of Networked System Design and Implementation (NSDI), San Francisco, California (March 2004) 17. Wu, K.-L., Yu, P.S.: Efficient query monitoring using adaptive multiple key hashing. In: Proceedings of the eleventh international conference on Information and knowledge management, McLean, Virginia, USA, November 04-09 (2002) 18. Yang, X., Hu, Y.: A DHT-based Infrastructure for Content-based Publish/Subscribe Services. In: Seventh IEEE International Conference on Peer-to-Peer Computing (2007) 19. Zhu, Y., Hu, Y.: Ferry A P2P-Based Architecture for Content-Based Publish/Subscribe Services. IEEE Transactions on Parallel and Distributed System 18(5) (2007) 20. http://www.the-gdf.org 21. Sayood, K.: Introduction to Data Compression, 3/e. Academic Press, London (2005) 22. Rao, W., Chen, L., Fu, A.W.-C., Bu, Y.: Optimal proactive caching in peer-to-peer network: analysis and application. In: Proceedings of the sixteenth ACM conference on Conference on information and knowledge management, November 06-10 (2007)
Implementation of a Performance-Based Loop Scheduling on Heterogeneous Clusters* Chao-Tung Yang** and Lung-Hsing Cheng **
High-Performance Computing Laboratory Department of Computer Science, Tunghai University, Taichung, 40704, Taiwan ROC {ctyang,g96350033}@thu.edu.tw
Abstract. Cluster computing systems usually connect several commodity computers in local-area networks to form a single, unified resource for parallel computing. Loop scheduling and load balancing on parallel and distributed systems are critical problems that are difficult to cope with, especially on the emerging heterogeneous clusters. In this aspect, an important issue is how to assign tasks to nodes so that the nodes’ loads are well balanced. In this paper, we propose a performance-based approach that partitions loop iterations according to the performance weighting of cluster nodes. A heterogeneous cluster was built to verify the proposed approach, and two kinds of application program were implemented for execution on this testbed. Experimental results show that the proposed approach performs better than previous schemes.
1 Introduction Cluster computing systems usually connect several commodity computers in local-area networks to form a single, unified resource for parallel computing [2], [4], [14]. As more and more inexpensive personal computers (PC) become available, clusters of PCs are becoming alternatives to the supercomputers many research projects cannot afford. As computer architectures become more and more diverse and heterogenic, and computer expiration rates are higher than before, we can put old and unused computers to efficient use in our research. Therefore, it is natural because of the fast development of information technology that clusters consist of computers with various processors, memories and hard disk drives. However, it is difficult to deal with such heterogeneity in a cluster [5], [9], [11], [13], [16]-[18], [20], [22], [24], [25]. Loop scheduling and load balancing on parallel and distributed systems are critical problems that are difficult to cope with, especially on the emerging heterogeneous PC-based clusters [6], [7]. In this aspect, an important issue is how to assign tasks to nodes so that the nodes’ loads are well balanced. Conventional self-scheduling loop approaches [12] include static scheduling and dynamic scheduling. However, the former considers computing nodes homogeneous resources, and thus not suitable for heterogeneous environments, and the latter, especially self-scheduling, can still be improved [8], [22], [23], [24], [26]. *
This work is supported in part by National Science Council, Taiwan R.O.C., under grants no. NSC 96-2221-E-029-019-MY3 and NSC 97-2622-E-029-003-CC2. ** Corresponding author. A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 44–54, 2009. © Springer-Verlag Berlin Heidelberg 2009
Implementation of a Performance-Based Loop Scheduling on Heterogeneous Clusters
45
Previous researchers proposed some useful self-scheduling schemes applicable to PC-based clusters [8], [23], [26] and grid computing environments [22], [24]. These schemes consist of two phases. In the first phase, system configuration information is collected, and some portion of the workload is distributed among slave nodes according to their CPU clock speeds [22] or HINT measurements [8], [23], [24]. After that, the remaining work load is scheduled using some well-known self-scheduling scheme, such as GSS [12]. The performance of this approach depends on an appropriate choice of scheduling parameters since it estimates node performance using only CPU speed or HINT benchmark, which are factors affecting node performance. In [8], an enhanced scheme, that dynamically adjusts scheduling parameters according to system heterogeneity, is proposed. Intuitively, we may want to partition loop iterations according to CPU clock speed. However, the CPU clock is not the only factor which affects node performance. Many other factors also have dramatic influences, such as the amount of memory available, the cost of memory accesses, and the communication medium between nodes. Using the intuitive approach will result in degraded performance if the performance estimation is not accurate. In this paper, we propose a general approach that utilizes performance functions to estimate performance weights for each node. To verify the proposed approach, a heterogeneous cluster was built, and three types of application program, matrix multiplication, and Mandelbrot set computation [1], were implemented for execution on this testbed. Empirical results show that for heterogeneous cluster environments, the proposed approach obtained improved performance compared to previous schemes. The rest of this paper is organized as follows. In Section 2, we introduce several typical and well-known self-scheduling schemes, and a famous benchmark used to analyze computer system performance. In Section 3, we define our model and describe our approach. Next, our system configuration is specified and experimental results on two types of application program are presented in Section 4. Concluding remarks and future work are given in Section 5.
2 Background In general, dynamic scheduling is more suitable for load balancing. However, the runtime overhead must be taken into consideration. The schemes we focus on in this paper are self-scheduling, members of a large class of adaptive and dynamic centralized loop scheduling schemes. In a common self-scheduling scheme, p denotes the number of processors, N denotes total iterations and f() is a function for producing the chunk-size at each step. The design of function f depends on the scheduling strategy of the scheme, and its output is the chunk-size for the next iteration. For example, in GSS [11], f is defined as the number of iterations remaining in a parallel loop divided by the number of available processors. At the i-th scheduling step, the master computes the chunk-size Ci and the remaining number of tasks Ri, (1)
46
C.-T. Yang and L.-H. Cheng
where f() may have more parameters than just i and p, such as Ri-1. The master assigns Ci tasks to an idle slave and the load imbalance will depend on the execution time gap between the nodes [9], [11]. Different ways of computing Ci have given rise to various scheduling schemes. The most notable examples are Pure Self-Scheduling (PSS), Chunk Self-Scheduling (CSS), Factoring Self-Scheduling (FSS), Guided SelfScheduling (GSS), and Trapezoid Self-Scheduling (TSS) [10], [12], [21]. Table 1 shows the various chunk sizes for a problem with iterations numbering N=1024 and processors numbering p=4. Table 1. Partition size examples Scheme PSS CSS(128) GSS [9] FSS [11] TSS [15]
Partition size 1, 1, 1, 1, 1, 1, 1, 1, 1, …, 1 128, 128, 128, 128, 128, 128, 128, 128 256, 192, 144, 108, 81, 61, 46, 34, 26, … 128, 128, 128, 128, 64, 64, 64, 64, 32, … 128, 120, 112, 104, 96, 88, 80, 72, 64, …
In [22], the authors revise known loop self-scheduling schemes to fit all heterogeneous PC clusters environment when loops are regular. An approach is proposed for partitioning loop iterations in two phases and it achieves good performance in any heterogeneous environment: partition α% of the workload according to CPU clock performance weighting in the first phase and the remainder (100-α)% of the workload according to known self-scheduling in the second phase. The experimental results are from a cluster environment with six nodes in which the fastest computer was 6 times faster than the slowest ones in CPU-clock cycles. Various α values were applied to matrix multiplication with the best performance obtained at α=75. The HPC Challenge (HPCC) is a useful computer benchmarking tool [3]. It first examines the performance of HPC architectures using kernels with more challenging memory access patterns than High Performance Linpack (HPL). It also augments the TOP500 list. It provides benchmarks that bound the performance of many real applications as a function of memory access characteristics – e.g. spatial and temporal locality. Unlike conventional benchmarks, the HPCC benchmark consists of 7 basic tests, including HPL, DGEMM, STREAM, PTRANS, Random Access, FFT, and Communication bandwidth and latency. In our work, we use the HPL measurement as a performance value and include it in our algorithm.
3 Proposed Approach In this context, we propose to partition α% of the workload according to CPU clock speed performance weighting and HPCC [3] measurement of all nodes, and dispatch the remaining workload via some well-known self-scheduling scheme, such as GSS [12].To use this approach, we need to know the real computer performance on the HPCC benchmark. We can then distribute appropriate workloads to each node and achieve load balancing. The more accurate the estimation is, the better the load balance will be.
Implementation of a Performance-Based Loop Scheduling on Heterogeneous Clusters
47
To estimate node performance, we define a performance weighting (PW) for node j as (2) where Vi , 1 < i < M, is a variable of the performance weighting. In this paper, our PW for node j is defined as (3) where S is the set of all cluster nodes, CSi is the CPU clock speed of node i, and is a constant attribute. HPLi is the HPL measurement of HPCC, this value is analyzed above; β is the ratio between the two values. With this approach, the computing node with better performance gets more data to process. Note that parameter α should not be too large or too small. If it is too large, the dominant computer will not finish its work, and if it is too small, the dynamic scheduling overhead will be significant. In any case, good performance cannot be attained without an appropriate α value. We propose an algorithm for performance-based loop scheduling in heterogeneous cluster environments based on workload distribution and node performance information. This algorithm employs a message-passing paradigm, and consists of two modules: a master module and a slave module. The master module makes scheduling decisions and dispatches workloads to slaves, which then process the assigned work. This algorithm is just a skeleton, and detailed implementations, such as data preparation, parameter passing, etc., might differ according to the requirements of the various applications. Our algorithm consists of several steps. First, relevant information is acquired. Then, the Performance Weighting is calculated. Next, α percent of the total workload is statically scheduled according to the performance ratio among all slave nodes. Finally, the remainder of the workload is dynamically scheduled by some well-known self-scheduling scheme for load balancing.
4 Experiments and Results We implemented three classes of application in C language, with message passing interface (MPI) directives to parallelize code segments for execution on our testbed: Matrix Multiplication and Mandelbrot Set Computation. The former has regular workloads, the latter irregular workloads. We built a heterogeneous cluster consisting of eleven nodes. The hardware and software configurations are specified in Table 2 and Table 3, respectively. Figures 1 and 2, show the network route state and topology of heterogeneous cluster, respectively. In our experiments, we first collected HPL measurements for all nodes, and then investigated the impact of parameters α, β, on performance. Parameters α and β are set by the programmer and choosing appropriate values adaptable to dynamic environments is difficult. In this work, the master node also participated in computation.
48
C.-T. Yang and L.-H. Cheng Table 2. Hardware configuration
Hostname
Processor Model
amd64-dual21 amd64-dual11 amd64-dual31 Xeon2 Quad1 omega Circa amd-mpdual1 condor1 condor2 s1
Dual-Core AMD Opteron(tm) Processor 2212 AMD Opteron(tm) Processor 246 AMD Opteron(tm) Processor 246 Intel(R) Xeon(TM) Intel(R) Core(TM)2 Quad Q6600 Intel(R) Xeon(TM) AMD Athlon(tm) MP 2000+ AMD Athlon(tm) MP 2000+ Intel(R) Pentium(R) 4 Intel(R) Pentium(R) 4 Intel(R) Xeon(R) CPU E5310
# of CPU
Mem Size
NIC
OS version
4
2GB
1G
2.6.21-1.3194.fc7
2 2 2 4 2 2 2 2 2 8
2GB 2GB 1.5GB 2GB 512MB 1GB 2GB 512MB 512MB 4GB
1G 1G 1G 1G 1G 100M 100M 100M 100M 1G
2.6.21-1.3194.fc7 2.6.18-1.2798.fc6 2.6.15-1.2054_FC5 2.6.23.1-42.fc8 2.6.15-1.2054_FC5 2.6.21-1.3194.fc7 2.6.18-1.2798.fc6 2.6.18-1.2798.fc6 2.6.18-1.2798.fc6 2.6.24.4-64.fc8
Table 3. CPU clock speeds and OS, compiler, and LAM/MPI versions Hostname
Clock
BogoMIPS
HPCC
amd64-dual21 amd64-dual11 amd64-dual31 xeon2 quad1 Omega Circa amd-mpdual1 condor1 condor2 s1
2000.080 MHz 1992.128 MHz 1991.652 MHz 3056.757 MHz 2699.986 MHz 3000.240 MHz 1666.794 MHz 1666.787 MHz 2806.465 MHz 2806.471 MHz 1596.476 MHz
4000.31 3983.54 3983.45 6112.98 5399.77 6000.62 3333.05 3333.77 5613.16 5613.14 3192.85
11.68 Gflops (N=15k) 6.376 Gflops (N=15k) 6.100 Gflops (N=15k) 5.312 Gflops (N=13k) 24.61 Gflops (N=15k) 5.372 Gflops (N=7k) 3.732 Gflops (N=10k) 3.837 Gflops (N=13k) 3.302 Gflops (N=7k) 3.317 Gflops (N=7k) 14.39 Gflops (N=20k)
LAM/MPI Version lam-7.1.2-10.fc7 lam-7.1.2-10.fc7 lam-7.1.2-8.fc6 lam-7.1.2-1.fc5 lam-7.1.2-10.fc7 lam-7.1.2-1.fc5 lam-7.1.2-10.fc7 lam-7.1.2-8.fc6 lam-7.1.2-8.fc6 lam-7.1.2-8.fc6 lam-7.1.2-10.fc7
2. amd64-dual11 10. condor2 1. amd64-dual21 3. amd64-dual31 9. condor 1
8. amd-mpdual1
140.128.98.250 4. xeon2
140.128.101.250 163.23.59.254 140.128.102.250
5. quad1
6. omega
11. s1 7. circa
Fig. 1. Network route state
GNU C Compiler gcc-4.1.2-27.fc7 gcc-4.1.2-27.fc7 gcc-4.1.1-30 gcc-4.1.0-3 gcc-4.1.2-33 gcc-4.1.1-51.fc5 gcc-4.1.2-12 gcc-4.1.1-30 gcc-4.1.1-30 gcc-4.1.2-13.fc6 gcc-4.1.2-33
Implementation of a Performance-Based Loop Scheduling on Heterogeneous Clusters
49
Fig. 2. Network topology
We implemented the proposed scheme for Matrix Multiplication. The Master module is responsible for distributing workloads. When a slave node becomes idle, the master node sends two integers to it representing the beginning and end pointers to an assigned chunk. In other words, every node has a local copy of the input matrices, so data communication is not significant in this kind of implementation. This means the communication cost between the master and the slave is low, and the dominant cost is the matrix multiplication computation. Figures 3 and 4 show how parameters influence performance results. In the experiment, we found that the proposed schemes got better performance when α was 30 and β had various optimum values based on scheduling. After selecting α and β values we carried out a set of experiments with them, and compared the results with previous scheduling. Each experiment was run ten times and the average fetched in order to achieve better accuracy. We first investigated execution times on the heterogeneous cluster for the GSS group, then for the FSS group, and finally for the TSS group. In our experiments, the execution times for static partitioning (matstat) were orders of magnitude worse than any of the dynamic approaches and made the results of the dynamic systems very difficult to distinguish visually from one another, so we state them as follows: matrix size 1024×1024 cost 57.83 seconds, matrix size 2048×2048 cost 251.7 seconds, and matrix size 4096×4096 cost 1853.27 seconds. Figures 6-8 show execution times for the conventional scheme (mat*ss), dynamic hybrid (matn*ss0-2), and the proposed scheme (matn*ss3-4), on the FSS, GSS, and TSS group approaches with input matrix sizes 1024×1024, 2048×2048 and 4096×4096. Experimental results show that the
50
C.-T. Yang and L.-H. Cheng
matngss0
matnfss0
matntss0
matngss3
700
) c e s ( e im T n o ti u c e x E
600
300
500
) 250 c e S ( 200 e im 150 T n o ti 100 u c e x 50 E 0
400 300 200 100 0 0
10
20
30
40
50 60 a Value
70
80
90
5 .2 8 3 3
350
150
matngss0
6 .0 4 4 2
matngss2
7 .9 0 4 2
2 .9 7 0 2
1 .8 3 4 2
0.3
3 .9 6 0 2
matngss1 matngss4
9 .9 4
7 .7 3
6 9 2
8 .9 2
8 .7 3
1 .9 2
1 .8 6 3
2 .8 8 2
6 6 . 1 2
8 7 . 1 2
0 .5 6 2
0.4
0.5 0.6 ß Value
0.7
7 4 . 1 2
0.8
0.9
1
Matrix Multiplication 9 .2 8 1 2
matfss matnfss0
100 50
matntss3
Fig. 4. Execution times for parameter β influence on matrix multiplication performance with matrix size 4096×4096
250
matngss3 200
0.2
300
matgss
250
0.1
Matrix Multiplication
400
) c e (s e tim n tio u c e x E
0
100
Fig. 3. Execution times for parameter α influence on matrix multiplication performance with matrix size 4096×4096
300
matnfss3
350
200
) c e (s e m 150 ti n tio u c e 100 x E
matnfss2
2 .1 3 5 2 4 2 . 9 0 2
4 5 . 1 4 3 .2 8 9 1
2 6 .2 7 9 1
matnfss3 matnfss1 matnfss4
50 1 .5 3
3 .7 3
6 .9 2
8 .7 2
4 .7 3
1 .8 2
3 .2 5 2
1 .1 8 2
5 .7 1 2
4 .4 2 2
4 .5 7 2
5 .2 2 2
0
0 1024×1024
2048x2048 Matrix size
4096x4096
Fig. 5. Execution times for the proposed matrix multiplication scheduling compared with previous GSS group schemes
1024×1024
2048x2048 Matrix size
4096x4096
Fig. 6. Execution times for the proposed matrix multiplication scheduling compared with previous FSS group schemes
proposed scheduling scheme got better performance than the static and previous schemes. Note that on the 4096×4096 matrix, our approach achieved speedups of 1.17, 1.27 and 1.07 over GSS, FSS and TSS in non-master participation, and speedups of 1.17, 1.22 and 1.05 in master participation. A Mandelbrot set is a problem involving the same computation on different data points with different convergence rates [1], [9]. Named after Benoit Mandelbrot, the Mandelbrot set is a fractal, a class of objects that display self-similarity at various scales. Magnifying a fractal reveals small-scale details similar to its large-scale characteristics. Although the Mandelbrot set is self-similar at magnified scales, its small-scale details are not identical to the whole. In fact, the Mandelbrot set is infinitely complex. Yet the process of generating it is based on an extremely simple equation involving complex numbers. This operation derives a resultant image by processing an input matrix, A, where A is an image of m pixels by n pixels. The resultant image is one of m pixels by n pixels. The proposed scheme was implemented for Mandelbrot set computation. The master module is responsible for workload distribution. When a slave node becomes idle, the master node sends two integers to it representing the beginning and end
Implementation of a Performance-Based Loop Scheduling on Heterogeneous Clusters
250
7 .9 4 7 2
Matrix Multiplication
300 mattss
1 .7 0 5 2
5 .2 6 6 2
4 .2 3 3 2
6 .6 5 4 2
manngss3 4 .6 3 3 2
mannfss3
51
manntss3
400 350
matntss0 ) c e s ( e tim n tio u c e x E
200
) 300 c e 250 s( e 200 im T n 150 o ti u c 100 e x 50 E
matntss2 matntss3
150
matntss1 matntss4
100
50 3 .0 3
3 .1 4
8 .6 2
9 .6 2
0 .7 3
8 .8 2
2 8 . 8 2
2 1 . 8 2
3 .4 6 2
8 5 . 8 2
1 .4 6 2
6 6 . 8 2
0
0 1024×1024
2048x2048 Matrix size
4096x4096
Fig. 7. Execution times for the proposed matrix multiplication scheduling compared with previous TSS group schemes
0
10
20
30
40
50 60 a Value
70
80
90
100
Fig. 8. Execution times for parameter α influence on Mandelbrot set computation performance at image size 2048×2048
pointers to an assigned chunk. As in the matrix multiplication implementation, this keeps communication costs between the master and the slave low, and the dominant cost is the Mandelbrot set computation. In this application, the workloads for outer loop iterations are irregular because the number of executions required for convergence is not fixed. Therefore, the workload distribution performance depends on the degree of variation between iterations. Figures 8 and 9 show how parameters influence performance results. In this experiment, we found that the proposed schemes got better performance when α was 40 and β was about 0.7. After selecting α and β values, we carried out a set of experiments with them and compared the results with previous scheduling. Each experiment was averaged over ten time runs in order to achieve better accuracy. We first investigated GSS group execution times on the heterogeneous cluster, then FSS group execution times, and finally TSS group execution times. In this experiment, static partitioning (manstat) execution times were: image size 512×512 cost 194.04 seconds, image size 1024×1024 cost 688.1 seconds, and image size 2048×2048 cost 3125.3 seconds. Figures 10-12 show execution times for the static (manstat), conventional (man*ss), and dynamic hybrid (mann*ss0-2) schemes, and for the proposed scheme (mann*ss3-4), on the FSS, GSS, and TSS group approaches with input image sizes of 512×512, 1024×1024, and 2048×2048. Experimental results show the proposed scheduling scheme got better performance than the static and previous schemes. Master node participation in computation didn’t raise the performance in our experiments. Note that on image size 2048×2048, our approach achieved speedups of 1.17, 1.27 and 1.07 over GSS, FSS and TSS in non-master participation and of 1.17, 1.22 and 1.05 in master participation. The largest size used in these experiments was 2048×2048, which is not very big, but wastes a great deal of time when run with a node. It is hard to experiment with bigger sizes due to memory capacity and cache considerations but we may find that the bigger the size the greater the efficiency. Note that in a heterogeneous environment, manngss2 performed worse than any other schemes merely because the adaptive α value is not suitable to this environment.
52
C.-T. Yang and L.-H. Cheng
manngss3
mannfss3
Mandelbrot set
300
manntss3
6 .4 3 6 2
250 mangss
250
4 .5 2 0 2
manngss0
200 ) c e S ( 150 e im T 100 n o it u c 50 e x E
manngss2
200
) c e s ( e 150 tim n o ti u c 100 e x E
manngss1
0.2
0.3
0.4
0.5 0.6 ß Value
0.7
0.8
0.9
Mandelbrot set
8 .2 3 1
6 .3 0 5
3 .5 7 1
9 5 . 2 1
6 3 . 2 1
1 .4 7 6
6 .3 0 5
9 .2 8 4
7 .8 2 1
5 4 . 2 1
9 .0 7 4
1 .1 7 4
512x512
5 1 . 4 6
1024x1024 Image size
2048x2048
Fig. 10. Execution times for the proposed Mandelbrot set scheduling and previous GSS group schemes Mandelbrot set
300
8 8 . 2 6 2
2 250
manfss
250
mannfss0 200 ) c e (s e m 150 ti n tio u c e 100 x E 50
2 .1 3 8 1
mannfss2 mannfss3 mannfss1
9 .3 2 1
4 .8 0 1
0 6 . 7 1
6 .7 8
3 .5 0 1
.6 4 4 9 .7 8
6 .1 0 4
6 .8 7 6 2 6 . 2 3
0 .2 9 3
mantss manntss0
3 .7 2 6 1
7 5 . 1 3 1
mannfss4
6 .9 4 4 1
0
1
Fig. 9. Execution times for parameter β influence on Mandelbrot set computation performance at image size 2048×2048 300
8 .3 8 5 1
manngss4
0 0.1
8 .7 5 4 1
manngss3
50
0
9 0 . 2 9 1
7 .7 7 5 1
9 .3 9 3 1
0 7 . 3 3
200 ) c e (s e 150 tim n tio u c 100 e x E 50
7 6 . 2 7 1
manntss2 manntss3 manntss1
4 .1 2 6 1
3 .4 1 5 1
7 .1 6 5 1
6 .5 0 5 1
manntss4
3 .5 0 1
9 .7 0 1
6 5 . 7 1
8 9 . 8
0 .6 0 1
.9 1 4 2 4 . 9
3 .1 0 4
8 .1 7 6
6 .0 8 3
1 .0 0 4
1 .6 8 3
0
0 512x512
1024x1024 Image size
2048x2048
Fig. 11. Execution times for the proposed Mandelbrot set scheduling and previous FSS group schemes
512x512
1024x1024 Image size
2048x2048
Fig. 12. Execution times for the proposed Mandelbrot set scheduling and previous TSS group schemes
5 Conclusion In this paper, we proposed a heuristic scheme that combines the advantages of static and dynamic loop scheduling schemes, and compared it with previous algorithms in experiments on two types of application program in heterogeneous cluster environments. Our approach is also less sensitive to α values than previous schemes, i.e., more robust. In each case, our approach obtained performance improvement over previous schemes.
References [1] [2] [3] [4]
Introduction To The Mandelbrot Set, http://www.ddewey.net/mandelbrot/ The Scalable Computing Laboratory (SCL), http://www.scl.ameslab.gov/ HPC Challenge Benchmark, http://icl.cs.utk.edu/hpcc/ Baker, M., Buyya, R.: Cluster Computing: The Commodity Supercomputer. International Journal of Software Practice and Experience 29(6), 551–575 (1999) (2002) [5] Beaumont, O., Casanova, H., Legrand, A., Robert, Y., Yang, Y.: Scheduling divisible loads on star and tree networks: results and open problems. IEEE Transactions on Parallel and Distributed Systems 16, 207–218 (2005)
Implementation of a Performance-Based Loop Scheduling on Heterogeneous Clusters
53
[6] Bennett, B.H., Davis, E., Kunau, T., Wren, W.: Beowulf Parallel Processing for Dynamic Load-balancing. In: Proceedings on IEEE Aerospace Conference, vol. 4, pp. 389–395 (2000) [7] Bohn, C.A., Lamont, G.B.: Load balancing for heterogeneous clusters of PCs. Future Generation Computer Systems 18, 389–400 (2002) [8] Cheng, K.-W., Yang, C.-T., Lai, C.-L., Chang, S.-C.: A Parallel Loop Self-Scheduling on Grid Computing Environments. In: Proceedings of the 2004 IEEE International Symposium on Parallel Architectures, Algorithms and Networks, KH, China, May 2004, pp. 409–414 (2004) [9] Chronopoulos, A.T., Andonie, R., Benche, M., Grosu, D.: A Class of Loop SelfScheduling for Heterogeneous Clusters. In: Proceedings of the 2001 IEEE International Conference on Cluster Computing, pp. 282–291 (2001) [10] Hummel, S.F., Schonberg, E., Flynn, L.E.: Factoring: a method scheme for scheduling parallel loops. Communications of the ACM 35, 90–101 (1992) [11] Li, H., Tandri, S., Stumm, M., Sevcik, K.C.: Locality and Loop Scheduling on NUMA Multiprocessors. In: Proceedings of the 1993 International Conference on Parallel Processing, vol. II, pp. 140–147 (1993) [12] Polychronopoulos, C.D., Kuck, D.: Guided Self-Scheduling: a Practical Scheduling Scheme for Parallel Supercomputers. IEEE Trans. on Computers 36(12), 1425–1439 (1987) [13] Post, E., Goosen, H.A.: Evaluation the parallel performance of a heterogeneous system. In: Proceedings of 5th International Conference and Exhibition on High-Performance Computing in the Asia-Pacific Region (HPC Asia 2001) (2001) [14] Sterling, T., Bell, G., Kowalik, J.S.: Beowulf Cluster Computing with Linux. MIT Press, Cambridge (2002) [15] Shih, W.-C., Yang, C.-T., Tseng, S.-S.: A Performance-based Parallel Loop Scheduling on Grid Environments. The Journal of Supercomputing 41(3), 247–267 (2007) [16] Shih, W.-C., Yang, C.-T., Tseng, S.-S.: A Performance-Based Parallel Loop SelfScheduling on Grid Environments. In: Jin, H., Reed, D., Jiang, W. (eds.) NPC 2005. LNCS, vol. 3779, pp. 48–55. Springer, Heidelberg (2005) [17] Shih, W.-C., Yang, C.-T., Tseng, S.-S.: A Hybrid Parallel Loop Scheduling Scheme on Grid Environments. In: Zhuge, H., Fox, G.C. (eds.) GCC 2005. LNCS, vol. 3795, pp. 370–381. Springer, Heidelberg (2005) [18] Shih, W.-C., Yang, C.-T., Tseng, S.-S.: A Performance-Based Approach to Dynamic Workload Distribution for Master-Slave Applications on Grid Environments. In: Chung, Y.-C., Moreira, J.E. (eds.) GPC 2006. LNCS, vol. 3947, pp. 73–82. Springer, Heidelberg (2006) [19] Shih, W.-C., Yang, C.-T., Tseng, S.-S.: A Hybrid Parallel Loop Scheduling Scheme on Heterogeneous PC Clusters. In: Proceedings of the 6th International Conference on Parallel and Distributed Computing, Applications and Technologies (PDCAT 2005), December 5-8, 2005, pp. 56–58 (2005) [20] Tang, P., Yew, P.C.: Processor self-scheduling for multiple-nested parallel loops. In: Proceedings of the 1986 International Conference on Parallel Processing, pp. 528–535 (1986) [21] Tzen, T.H., Ni, L.M.: Trapezoid self-scheduling: a practical scheduling scheme for parallel compilers. IEEE Transactions on Parallel and Distributed Systems 4, 87–98 (1993) [22] Yang, C.-T., Chang, S.-C.: A Parallel Loop Self-Scheduling on Extremely Heterogeneous PC Clusters. Journal of Information Science and Engineering 20(2), 263–273 (2004)
54
C.-T. Yang and L.-H. Cheng
[23] Yang, C.-T., Cheng, K.-W., Shih, W.-C.: On Development of an Efficient Parallel Loop Self-Scheduling for Grid Computing Environments. Parallel Computing 33(7-8), 467– 487 (2007) [24] Yang, C.-T., Cheng, K.-W., Li, K.-C.: An Enhanced Parallel Loop Self-Scheduling Scheme for Cluster Environments. The Journal of Supercomputing 34(3), 315–335 (2005) [25] Yang, C.-T., Cheng, K.-W., Li, K.-C.: An Efficient Parallel Loop Self-Scheduling on Grid Environments. In: Jin, H., Gao, G.R., Xu, Z., Chen, H. (eds.) NPC 2004. LNCS, vol. 3222, pp. 92–100. Springer, Heidelberg (2004) [26] Yang, C.-T., Shih, W.-C., Tseng, S.-S.: Dynamic Partitioning of Loop Iterations on Heterogeneous PC Clusters. The Journal of Supercomputing 44(1), 1–23 (2007)
The Hierarchical Path-Selection Scheme Based on Multihoming NEMO Long-Sheng Li1, Gwo-Chuan Lee2, Jhu-Shyuan Mei1, and Cing-Long Chen1 1
Dept. of Computer Science and Information Engineering, National Chiayi University, Taiwan (R.O.C) 2 Dept. of Computer Science and Information Engineering, National United University, Taiwan (R.O.C)
[email protected],
[email protected],
[email protected]
Abstract. The Network Mobility (NEMO) protocol allows a mobile network (MONET) to move around and maintains session connectivity of nodes in the MONET. In real world, the topology of the MONET may be very complex. To increase session reliability of the MONET, the concept of multihoming in NEMO is proposed. In the multihoming environment, the MONET has more than one path to connect to the Internet and these paths can be maintained simultaneously. But the loop routing problem may occur in such an environment. In this paper, we proposed a Hierarchical Path-Selection Scheme to prevent the loop routing problem. We add the nested level and ClusterHead ID information to Router Advertisement (RA) messages. The MONET doesn’t form the loop routing and achieves fault-tolerant and load-balanced goal by the proposed scheme. Keywords: Multihoming, Network Mobility, Loop prevention, Load balance.
1 Introduction NEMO (Network Mobility) is an extension protocol of Mobile IPv6 (MIPv6) [2]. It enables Mobile Networks to attach to different points in the Internet and allows the session continuity for every node in the Mobile Networks while moving around. With the development of NEMO, many interesting applications may come true, such as using a mobile device to connect to the Internet on the bus, train or Metropolitan Rapid Transit (MRT) system. 1.1 The Basic NEMO Architecture The Internet Engineering Task Force (IETF) NEMO working group has standardized the NEMO Basic Support Protocol in RFC 3963 [1]. There is at least one mobile router (MR) in a Mobile Network. The MR dynamically changes its point of attachment to the infrastructure while moving around. It also maintains a bi-directional tunnel to its Home Agent (HA). MR is responsible for all external communications of all nodes in a Mobile Network. The Mobile Router is also the default gateway for the A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 55–66, 2009. © Springer-Verlag Berlin Heidelberg 2009
56
L.-S. Li et al.
Mobile Network. All traffic between the nodes in the Mobile Network and Correspondent Nodes (CNs) is delivered via the bi-directional tunnel. When the MR moves away from the home link and attaches to a new access router (AR), it acquires a Careof Address (CoA) from the visited link. As soon as the MR determines a CoA, it immediately sends a Binding Update message to its Home Agent. When the Home Agent receives this Binding Update, it creates a cache entry binding the MR’s Home Address (HoA) to the CoA at the current point of attachment. 1.2 Multihoming in Mobile Network The MR of a mobile network requires a reliable access to the internet. The general solution is that the MONET has several MRs (or the MR has several interfaces) to connect to the internet. In such a situation, the MONET has more than one path to route to the Internet and these paths can be maintained simultaneously. The MONET with such an ability is called the multihoming [3][4][6]. In the multihomed environment, the MONET should maintain multiple bi-directional tunnels between MR(s) and HA(s). Achieving the Multihoming has many advantages for the Mobile Network, such as fault-tolerant and load-balancing. In some cases, it may be necessary to divert packets from a bi-directional tunnel to an alternative bi-directional tunnel when the connecting bi-directional tunnels fail, or to balance traffic load among multiple tunnels [4][5]. 1.3 Motivation In the real world, the topology of MONET may form the nested NEMO [1][3][6]. In the nested NEMO, A MONET could be connected to another MONET. The whole structure likes a tree topology. When the nested NEMO extended to the multihoming environment, it may cause some problems. A nested MONET may be attached more than two different MRs simultaneously, thus the aggregated network no longer forms a tree topology. In such a topology, an infinite loop within the MONET occurs. Additionally, to achieve a load balancing goal of MONET, the visited MR (or MN) should has an ability to choose the most suitable MR (with the lowest traffic load) as the primary path based on receiving RA messages. So a path-selection scheme is required for the visited MR (or MN) to select the most suitable path among multiple MRs [5]. Also, we want to achieve the fault-tolerant goal in the multihoming NEMO. A scheme which provides fault-tolerance is necessary too. In this paper, we propose a Hierarchical Path-selection Scheme. The proposed scheme provides fault-tolerance, load balancing and routing loop prevention for the Nested NEMO with multihoming. We add some useful information to the RA message. According to the information, the visited MR (or MN) knows the status of all parent MRs (or ARs) which the visited MR (or MN) connects to.
2 Related Works 2.1 Nested NEMO A mobile network is said to be nested when a mobile network (sub- MONET) is attached to another mobile network (root-MONET) [1][3][6]. The aggregated hierarchy of mobile networks becomes a nested mobile network.
The Hierarchical Path-Selection Scheme Based on Multihoming NEMO
57
2.2 Analysis of the Multihoming in NEMO In the NEMO terminology, a MONET is considered as multihoming when MONET is communicated to the Internet via multiple paths. There are several configurations to construct the multihoming mobile networks [7]. These configurations are classified by three parameters, named x, y, z. x means the number of MRs in a MONET. y means the number of HAs which serving the MONET. z means the number of MNPs of MONET. For example, case (n, 1, 1) means “n MRs, single HA, single MNP”. [7] also shows issues in the multihoming NEMO, such as Fault Tolerance, Multiple Bindings/Registrations, Loop Prevention in Nested Mobile Networks, and Prefix Ownership…etc. “Loop Prevention in Nested Mobile Networks” is the issue on all of configurations [7]. So it is an important issue in multihoming NEMO. 2.3 Hierarchy Information in Router Advertisement for Nested NEMO The Nested MONET has Router Advertisement (RA) confliction problem [10]. Hierarchical Mobile Router Advertisement (HMRA) is proposed to solve this problem. The visited MR can know the hierarchy information of MR who sends the RA message. [13] introduced an issue that if the visited node insides a hierarchical topology. [13] proposed to add a new option: Level in RA messages. This option allows every MN to know the level of parent-MR in nested MONET. The topology of the nested NEMO will form a directed tree graph by the Tree Discovery (TD) scheme [15]. The loops don’t occur in such a tree topology. In TD, every MR advertises Tree Information Option (TIO) in the RA message. MRs form a tree topology based on various metrics (the tree depth and preference). MR must ignore RAs that are received from other routers located deeper within the same tree. 2.4 Load Balance Topology in NEMO Balanced Topology Constructions in the NEMO proposed a dynamic load balancing scheme [11]. [11] proposed to add some information to the BU and RA messages. According to this information, MRs/MNs can connect to the AR/MR with less traffic load. [9] proposed a Multiple Mobile Router Management (MMRM) mechanism for multihoming MONET. MMRM allows nodes in MONET to be connected to the Internet via multiple MRs. In the proposed mechanism, MR can dynamically join and leave the MONET. MRs cooperate with each other in order to share the traffic load. 2.5 Multihoming [8] proposed two schemes to for the multihoming MONET. The case which discussed in [8] is that the MR has two interfaces and each interface has a CoA from AR, Two interfaces belong to two different HAs. By proposed two schemes in [8], all connectivities of MONET can be continued even though one of interfaces fails. [12] described a Token based Duplicate Network Detection mechanism. This mechanism allows multiple Home Agents to detect whether the MONET is split and it solves one of the Multihoming issues called the Prefix Ownership problem.
58
L.-S. Li et al.
2.6 Routing Loop in Nested Mobile Networks When egress and ingress interfaces of a MR are all wireless, a mobile router can listen to the RA message from its child mobile router. It causes a RA confliction problem [7][15]. In the general case, arbitrary attachment of Mobile Routers could form a routing loop. For example, in Fig 1, assume a nested NEMO where MR1 is connected to the infrastructure, and MR3 is attached to MR2. The MR2 can hear both RAs of MR3 and MR1 on its egress interface. If MR2 selects MR3, MR2 and MR3 form a loop routing. Thus MR2, MR3 are disconnected from their Home Agents. To avoid such a loop case in the nested NEMO, the ideas of the proposed schemes in [13], HMRA [10], and Tree Discovery [15] can be used.
Fig. 1. A Route Loop Problem
Fig. 2. A Problem of Tree Discovery
2.7 Summary To avoid the loop routing, the easy way is to organize the wireless network topology as a hierarchical topology. It is because the hierarchy topology is a tree-based topology. It cannot find a loop path in the tree-based topology. [15] proposed the hierarchical network structure to avoid the loop routing. If a visited MR attachs to multiple trees, it binds multiple Tree IDs. The Tree ID field is defined as a 128-bit unsigned integer [15]. It’s clearly that the field length is not enough and not flexible to record all Tree IDs. In this case, the visited MR doesn’t know which Tree ID should be set in the RA message. If we suppose that MR sends the RA message with only one of Tree IDs randomly, the loop may occur as in Fig 2. So TD is not suitable for the multihoming NEMO.
3 Hierarchical Path-Selection Scheme To achieve Loop Prevention and construct load balance topology in Nested Mobile Networks, we propose a Hierarchical Path-Selection Scheme for the nested NEMO multihoming. In NEMO multihoming, the MONET has several route paths to the Internet. The MONET has several MRs or has one MR with multiple interfaces. In our proposed scheme, we focus on the case that the MONET has one MR with multiple interfaces. We add some extension information to RA messages. According to this information, the visited MR (or MN) knows the nested level and traffic status of all Routers which the visited MR (or MN) connects to.
The Hierarchical Path-Selection Scheme Based on Multihoming NEMO
59
3.1 Multihoming The MR can bind multiple active CoAs. However, the NEMO basic protocol doesn’t support binding multiple CoAs to one HoA. The easiest way for a MR to bind multiple CoAs to a HoA is the extended scheme, MCoA[14], of the Mobile IPv6. If the mobile node (or mobile router) wants to register multiple bindings, it generates a BID for each CoA. The BID is required to be stored in the binding cache and binding update list structure. The Binding Identifier mobility option is used to carry the BID information. The option format is shown in Fig 3.
Fig. 3. BID Mobility Option [19]
Fig. 4. Multiple Care-of Address Registration [14]
Fig 4 illustrates the configuration where the mobile node obtains multiple care-of addresses at foreign links. NEMO is an extension of the Mobile IPv6. MCoA can also be use in the NEMO environment. In our proposed scheme, all MRs can use the MCoA protocol. Thus the MR achieves multihoming. 3.2 Modification for RA messages In the NEMO basic support protocol, the visited MN (or MR) decides a CoA by listening the RA message. To support our proposed schemes, we make some extension information to the RA message. We add a new option to the RA message, which contains the Nested level, ClusterheadID (CID) list. The option format is shown in Fig 5.
Fig. 5. The New option in the Router Advertisement message
60
L.-S. Li et al.
This option is included in the RA message. The Option Type = 11 means this option is the information for our proposed Hierarchical Path-Selection Scheme. The Length is the length of the option in bytes. The M flag is the type of the router. M=1 means the router is a mobile router. M=0 means the router is an access router at the fixed network domain. The T flag is 1 means the router is a top level mobile router. T=0 means the router is not a top level mobile router. The ClusetheadID (CID) list contains all CID information. All MRs in the MONET maintain this list. CID is the identification of a tree topology. CID is the top level mobile router’s HoA. For example, if a MR connected two trees, its RA message will contain two CIDs in the CID List field. The path ID means the identifier of the parent MR. It’s an 8 bit unsigned value. The Nested Level means the level in the tree topology. 3.3 The Steps of Propose Scheme Operation We add a new option in RA messages, and therefore the visited MR can know the tree information which its parent-MR(s) owns. In our proposed scheme, the trees and hierarchy information can be recorded in RA messages. When MR is in the overlapping place between multiple routers, it can receive multiple RA messages. Thus MR can start up the Hierarchical Path-Selection Scheme to select suitable access router(s). 3.3.1 Initialization In our proposed scheme, the received RA messages contain the new option which is described in the previous section. According to the extension of the RA message, the MR can know parent-MR(s)’s CID list. The actions of MR are described in the follow. 1.
If two (or more) RAs have non-duplicated CID in the CID list, MR can attach to these routers simultaneously. Thus MR can send packets through multiple paths. An example is shown in Fig 6.
Fig. 6. Every Nested level value of visited MR increase one
2. 3.
Fig. 7. The MR attach to parent MRs simultaneously
The MR records all CID list from parent MR(s). And all Nested level values in CID list are increased. An example is shown in Fig 7. When the MR receiving multiple RA messages. If two (or more) RAs include duplicated CIDs in the CID list, the MR only attaches to one router with the lowest ‘Average’ Nested Level. The ‘Average’ Nested Level is average value of all Nested Level value in the CID list. An example is shown in Fig 8.
The Hierarchical Path-Selection Scheme Based on Multihoming NEMO
Fig. 8. The MR attaches to one router with the lowest Nested Level
4.
61
Fig. 9. The visited MR chooses one of routers with more CIDs
In the case that there are (more than) two RAs which have the same Average Nested Level value and have duplicated CIDs in CID list. The MR chooses one of routers which have more CIDs. An example is shown in Fig 9.
3.3.2 The Handoff Procedure The topology of the MONET may change frequently. In the NEMO basic support protocol, the handoff occurs when the MR detects the movement [1]. The following describes the operations for MR when the handoff occurs. 1. 2.
In the case that the RA messages have non-repeated CIDs, MR can attach to these routers simultaneously. An example is shown in Fig 10. Otherwise, the receiving RA messages have repeated CID(s) with MR’s CID(s), The MR can only use the alternative path in using or the new detected path. The MR only attaches to the router with the lowest ‘Average’ Nested Level. The ‘Average’ Nested Level is average value of all Nested Level value in the CID list. It provides MR to avoid to the top level mobile router and choose the minimum hops routing path. An example is shown in Fig 11.
This scheme guarantees to prevent to construct the duplicated routing paths. The topology of the MONET prevents routing loops.
Fig. 10. The visited MR attach to multiple MRs during handoff procedure
Fig. 11. The MR makes the new link and removes the old link
3.4 Extended Topology Tuning Scheme 3.4.1 The Issue of the Proposed Scheme By our proposed scheme, it may bring the new issue to the multihoming MONET. We show Fig 12 as an example. The MR4 attaches to two parent MRs. There are three
62
L.-S. Li et al.
Fig. 12. An unbalanced topology case of multihoming MONET
Fig. 13. The Operations of Extended Topology Tuning Scheme When T=1
MRs behind the MR1. And MR5 has only one child MR. In such a network topology, it is clearly that loading of the whole MONET is unbalanced. In order to achieve the load balancing goal, we propose an extension topology scheme. 3.4.2 The Operations of Extended Topology Tuning Scheme When the MR attaches (more than) two parent MRs, it decides whether the connection to the parent MR should be removed or not. Formula (1) is the requirement equation. Max(Nested_Level) - Min(Nested_Level) > T
(1)
Max(Nested_Level) is the maximum value of Nested Level in MR’s CID list. Min(Nested_Level) is the minimum value of Nested Level in MR’s CID list. T is an unsigned integer. If the MR meets the requirement of Formula (1), it disconnects the link which has the high Nested level. Fig 13 shows the steps to tune the topology of Fig 12. Therefore, our proposed scheme achieves the load balancing goal.
4 Analysis In the Analysis, We evaluate the Average Nested Level of all MRs in the mobile network. We compare the analysis results for NEMO basic support, the proposed scheme and the extended tuning scheme. To simplify the analysis, we can consider a grid with size 2 x 2 to 10 x 10 cells. On every cross point of horizontal line and vertical line, we locate a mobile router. Two top level mobile routers, TLMR1 and TLMR2, are located at the upper left corner and the lower right corner. MRs can only attach to other MRs by one cell distance. we assume TLMR1 sends the RA messages to the child MRs. The child MRs then sends the RA messages to the neighbor MRs and to construct the MONET tree. The 3 x 3 example are shown in Fig 14 and Fig 15. TLMR2 then sends its RA message to the child MRs and construct the TLMR2 MONET tree. In the extended tuning scheme, we define a T value in the formula (1). We find out the ideal value of T in this analysis. We use two different orders to constructing every MR’s attachment, clockwise and counter clockwise. Clockwise means MRs in each level receive RAs in clockwise order. Counter clockwise means MRs in each level receive RAs in counter clockwise order.
The Hierarchical Path-Selection Scheme Based on Multihoming NEMO
Fig. 14. Constricting mobile network topology
63
Fig. 15. TLMR2 appears on the map
Fig 16 is the results with both clockwise and counter clockwise orders. The analysis results show same data. So the constructing order doesn’t affect the analysis result. With lower value of T, The extended tuning scheme reduces the average nested level of MONET. It also means that the MR can connect to the Internet via fewer hops. We also show that the number of multihoming MR increases. It means we have more chance to choice the alternative path for the data transmission. Fig 17 is the result of the case with 3 TLMRs. Besides TLMR1 and TLMR2, there is another TLMR - TLMR3, which is located at the lower left corner. There is a phenomenon that when T = 0, the value of multihoming MRs is abruptly down as shown in Fig 17. The reason is described in Fig 18. Both MR3 and MR4 have same nested level. And they have different CID. By the proposed scheme, one of them can attach to the other MR. With the extended tuning scheme and T = 0, the link between MR1 and MR2 will be removed anytime. When T=1, this phenomenon can be avoided. The topology of MONET is stable. For this experiment, we suggest the value T can be 1 to construct the most efficient load balanced topology.
16
TE N O fM ol ev eL de ste N gea re v A
5x5
5 x 5 Counter clock
5x5
5 x 5 Counter clock
7x7
7 x 7 Counter clock
7x7
7 x 7 Counter clock
9x9
9 x 9 Counter clock
9x9
9 x 9 Counter clock
11 x 11
11 x 11 Counter clock
11 x 11
10 x 10 Counter clock
19 x 19
19 x 19 Counter clock
19 x 19
19 x 19 Counter clock
25
14
R M gn i m oh til u M fo re b m u N
12 10 8 6 4 2
20
15
10
5 0
0 0
1
2
3
4
5 6 Value of T
7
8
9
10
0
1
2
3
4
5 6 Value of T
7
8
Fig. 16. Value T vs. Average nested level and Number of Multihoming MRs
9
10
64
L.-S. Li et al.
14
TE N O M fo le evL de ste N eg rae v A
5x5
5 x 5 Counter clock
5x5
5 x 5 Counter clock
7x7
7 x 7 Counter clock
7x7
7 x 7 Counter clock
9x9
9 x 9 Counter clock
9x9
9 x 9 Counter clock
11 x 11
11 x 11 Counter clock
11 x 11
11 x 11 Counter clock
19 x 19
19 x 19 Counter clock
19 x 19
19 x 19 Counter clock
35
12
R M gn i m oh til u M fo erb m u N
10 8 6 4 2 0
30 25 20 15 10 5 0
0
1
2
3
4
5 6 Value of T
7
8
9
10
0
1
2
3
4
5 6 Value of T
7
8
9
10
Fig. 17. Value T vs. Average nested level and Number of Multihoming MRs (3 TLMRs)
Fig. 18. An example when T = 0
NEMO basic support
NEMO basic support
NEMO basic support Counter clock
NEMO basic support Counter clock
The Proposed Scheme
The Proposed Scheme
20 18
R M g 14 m hoti 12 lu 10 M ofr 8 eb 6 um N 4 16
The Proposed Scheme counter clock
20
The Proposed Scheme counter clock
The Prposed Scheme with Tuning Scheme The Prposed Scheme with Tuning Scheme Counter clock
18
The Prposed Scheme with Tuning Scheme The Prposed Scheme with Tuning Scheme Counter clock
2
0
0 2x2
TE N 16 O M 14 ofl ev 12 eL 10 edt se 8 N eg 6 ar ev 4 A 2
4x4
6x6
8 x 8 10 x 10 12 x 12 14 x 14 16 x 16 18 x 18 Size of map
2x2
4x4
6x6
8 x 8 10 x 10 12 x 12 14 x 14 16 x 16 18 x 18 Size of map
Fig. 19. Grid size vs. Average Nested Level and Number of Multihoming MRs
Fig 19 shows the analysis results of Average Nested Level and the number of multihoming MRs. Fig 20 are the result with 3 TLMR. NEMO basic support doesn’t support the multihoming. So NEMO basic support provides no multihoming MR. And the both proposed schemes do. In the average nested level, we can see that the proposed scheme provide lower average nested level of MONET than the NEMO basic support. The extended tuning scheme provides the lowest nested level and the highest multihoming MRs. So our proposed scheme with Extended Topology Tuning Scheme provides better performance on constructing balanced topology of MONET.
The Hierarchical Path-Selection Scheme Based on Multihoming NEMO
NEMO basic support
NEMO basic support
NEMO basic support Counter clock
NEMO basic support Counter clock The Proposed Scheme
The Proposed Scheme
30
The Proposed Scheme counter clock
25
The Prposed Scheme with Tuning Scheme The Prposed Scheme with Tuning Scheme Counter clock
R M g 20 om hti ul 15 M ofr eb 10 um N
5
20
The Proposed Scheme counter clock
TE 18 N O 16 M 14 ofl ev 12 eL 10 edt se 8 N eg 6 ar ev 4 A 2
The Prposed Scheme with Tuning Scheme The Prposed Scheme with Tuning Scheme Counter clock
0
0 2x2
65
4x4
6x6
8 x 8 10 x 10 12 x 12 14 x 14 16 x 16 18 x 18 Size of map
2x2
4x4
6x6
8 x 8 10 x 10 12 x 12 14 x 14 16 x 16 18 x 18 Size of map
Fig. 20. Grid size vs. Average Nested Level and Number of Multihoming MRs (3 TLMRs)
5 Conclusion In this paper, we propose a Hierarchical Path-selection Scheme for the multihoming NEMO. The MONET achieves fault-tolerance by constructing multihoming MRs, and a new option is added to the Router Advertisement (RA). This new option includes the information about the Nested Level and Cluster ID list of the mobile router (MR). According to this information, the MR can select the most suitable attachment router. So the routing loop in the nested NEMO can be prevented. Additionally, we proposed an Extended Topology Tuning Scheme to construct balanced load topology of MONET. The analysis result shows that our proposed scheme provides lower average Nested Level of the MONET than the NEMO basic support protocol.
References 1. Devarapalli, V., Wakikawa, R., Petrescu, A., Thubert, P.: Network Mobility (NEMO) Basic Support Protocol, RFC 3963, IETF (January 2005) 2. Johnson, D., Perkins, C., Arkko, J.: Mobility Support in IPv6, RFC 3775, IETF (June 2004) 3. Ernst, T., Lach, H.-Y.: Network Mobility Support Terminology. RFC 4885, IETF (July 2007) 4. Ernst, T., Charbon, J.: Multihoming with NEMO Basic Support. In: International Conference on Mobile Computing and Ubiquitous Networking (ICMU) (January 2004) 5. Esaki, H.: Multi-Homing and Multi-Path Architecture Using Mobile IP and NEMO Framework. In: International Symposium on Applications and the Internet, SAINT 2004 (2004) 6. Perera, E., Sivaraman, V., Senevirtane, A.: Survey on network mobility support. ACM Mobile Computing and Communications Review 8(2), 7–19 (2004) 7. Ng, C., Ernst, T., Paik, E., Bagnulo, M.: Analysis of Multihoming in Network Mobility Support., RFC 4980, IETF (October 2007) 8. Choi, Y., Kim, B., Kim, S., In, M., Lee, S.: A Multihoming Mechanism to Support Network Mobility in Next Generation Networks. In: 2006 Asia-Pacific Conference Communications (APCC 2006), August 2006, pp. 1–5 (2006)
66
L.-S. Li et al.
9. Tsukadat, M., Emstt, T., Wakikawat, R., Mitsuyat, K.: Dynamic Management of Multiple Mobile Routers. In: Jointly held with the 2005 IEEE 7th Malaysia International Conference on Communication, 2005 13th IEEE International Conference on Networks, 2005, vol. 2 (November 2005) 10. Cho, H., Kyoung Paik, E., Choi, Y.: HMRA: Hierarchical Mobile Router Advertisement for Nested Mobile Networks. Internet Draft draft-cho-nemo-hmra-00.txt, IETF (January 2004) 11. Li, L., Kang, L.: Balanced Topology Constructions in the NEMO. In: ICC Workshops 2008. IEEE International Conference on Communications Workshops, pp. 436–440 (May 2008) 12. Chuang, J.: Detection Techniques for the Split and Merge of Mobile Networks in Multihoming Environment, master’s thesis, Dept. Communication Engineering, National Central University (July 2006) 13. Montavont, N., Noel, T., Ernst, T.: Multihoming in Nested Mobile Networking. In: SAINT 2004 Workshops. 2004 International Symposium on Applications and the Internet Workshops, January 2004, pp. 184–189 (2004) 14. Wakikawa, R., Devarapalli, V., Ernst, T., Nagami, K.: Multiple Care-of addresses Registration, draft-ietf-monami6-multiplecoa-09.txt, IETF (August 2008) 15. Thubert, P., Bontoux, C., Montavont, N., McCarthy, B.: Nested Nemo Tree Discovery. draft-thubert-tree-discovery-07.txt, IETF (August 2008)
A Software Transactional Memory Service for Grids Kim-Thomas Möller, Marc-Florian Mu ¨ller, Michael Sonnenfroh, and Michael Schöttner Institut fu ¨r Informatik, Heinrich-Heine-Universität Du ¨sseldorf ¨sseldorf, Germany Universitätsstr. 1, 40225 Du ph.: +49 211 81-10595; fax: +49 211 81-13464
[email protected]
Abstract. In-memory data sharing for grids allow location-transparent access to data stored in volatile memory. Existing Grid middlewares typ- ically support only explicit data transfer between Grid nodes. We be- lieve that Grid systems benefit from complementing traditional message- passing techniques with a data-oriented sharing technique. The latter includes automatic replica management, data consistency, and location- transparent access. As a proof of concept, we are implementing a POSIX- compatible object sharing service as part of the EU-funded XtreemOS project, which builds a Linux-based Grid operating system. In this paper we describe the software architecture of the object sharing service and design decisions including transactional consistency and peer-to-peer net- work structure. We also present preliminary evaluation results analyzing lower-bound transaction-overhead using a parallel raytracing application.
1 Introduction During the last years, a lot of Grid technologies emerged [1], including sophisticated Grid middlewares such as Globus [2], Legion [3], and UNICORE [4]. These systems, having been created in a bottom-up fashion trying to meet changing user requirements, are complex to use and administrate [5]. Nevertheless, they often do not operate transparently with respect to distribution and fault tolerance. The EU-funded XtreemOS project aims at reducing the complexity of developing Grid applications by providing a Linux-based open source Grid operating system (OS). Distributed OS services, e.g. security, resource, process management and transparent data sharing, will be integrated into the operating system. In this paper we are presenting the design and initial implementation of XtreemOS’ object sharing service (OSS), which offers interactive or computationally intensive Grid applications a location-transparent storage for volatile data. The object sharing service replicates objects to improve reliability and performance. The software architecture we propose interweaves concepts from transac- tional memory and peer-to-peer systems. Speculative transactions allow conve- nient and consistent access, while at the same time relieving programmers from complicated lock management. Super-peer-based overlay networks improve scal- ability, and a technique similar to distributed hash tables speeds A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 67–78, 2009. © Springer-Verlag Berlin Heidelberg 2009
68
K.-T. Möller et al.
up data search. In case of severe faults, the XtreemOS Grid checkpointing service will support the object sharing service. The GigaSpaces company has introduced the notion in-memory data Grid [6] for sharing volatile data in Grid environments. Their in-memory data Grid is already being deployed to end users. While their solution, like OSS, uses optimistic concurrency control, it cannot restart failed transactions transparently with respect to the application. This paper is organized as follows. After discussing related work in section 2, we present OSS’ overall architecture and its dynamic object management in section 3. Subsequently, in section 4 we describe the implementation of speculative TAs. In section 5 we discuss preliminary measurements followed by the conclusion and outlook on future work.
2 Related Work This paper draws upon ideas from four existing bodies of work: database transaction processing systems, transactional memory (TM), data sharing in Grid environments, and distributed shared memory. Due to limited space, we can compare our work only with some key ideas from these fields. 2.1 Database Transaction Processing Transactions (TAs) are a core concept in database management systems (DBMS) providing significant benefits to the database programmer [7]. In DBMS, TAs provide the properties of atomicity, consistency, isolation, and durability (ACID). We think that TAs will greatly simplify the development of generic distributed and parallel programs. In constrast to DMBS TAs, distributed program TAs usually execute less instructions and modify less state. Moreover, they do not incur the overhead of database operations. Therefore, TAs based on shared data offer a comfortable alternative for general purpose distributed programming. A wide range of implementation options for executing TAs with high throughput can be found in the literature. The work on optimistic concurrency [8] is the most relevant to the ideas we explore in this paper. Optimistic concurrency controls access to shared data without using locks by detecting conflicts and backing up TAs to ensure correct operation. In our implementation we extend the idea of optimistic concurrency from DBMS to data sharing in Grid environments. 2.2 Transactional Memory Hardware support for TM was first proposed by Herlihy et.al. [9] a decade ago. The authors substituted locking critical regions with running them encapsulated in TAs. Thus TAs were an additional feature and did not replace the existing shared memory consistency protocols. Transactional Coherence and Consistency (TCC), suggested by Hammond et al. [10], shares a lot of ideas with our approach. TCC runs TAs at most times, instead of just occasionally, replacing conventional coherence and consistency techniques. As TCC relies on a shared multi-processor machine, it can easily cope with the pressure on inter-processor communication bandwidth.
A Software Transactional Memory Service for Grids
69
We are encouraged by the existing work and the growing interest on TM [11,12]. Sun Microsystems has recently announced a new CPU with built-in support for TAs. Thus we are confident that in the near future numerous TAbased appli- cations will emerge, and our implementation shows that TM can be adapted for distributed systems, too. 2.3 Data Sharing in Grid Environments Sharing volatile data in Grid environments has been proposed by a few projects such as JuxMem [13] and Vigne [14]. The JuxMem architecture decouples the design of consistency protocols and fault-tolerance mechanisms. It supports datasharing across wide-area networks using entry consistency. However, JuxMem neither supports speculative TAs nor is it designed to support interactive distributed applications. GigaSpaces is developing a data-aware enterprise Grid [6], that is, a dis- tributed caching system as an alternative to managing state in a database. Targeting Java applications, GigaSpaces is compatible with existing Java-based shared memory technologies, which probably limits its portability. Like OSS, GigaSpaces implements optimistic concurrency control. The cache detects ver- sion conflicts and notifies the applications by means of Java runtime exceptions, but, in contrast to OSS, it cannot restart a TA transparently with respect to the application. 2.4 Distributed Shared Memory Page-based distributed shared memory systems have always been popular since the development of IVY [15] because of the synergies with virtual memory management and the locality benefit. Intel has adopted Treadmarks [16] in its OpenMP compiler [17]. Most of these systems have been implemented as userlevel libraries, but some systems, such as Plurix [18] and Kerrighed [19], are integrated into the OS kernel to build single-system images. Transactional consistency (TC) has been implemented within the Plurix OS starting in 1998. The TC model is most related to weak consistency first proposed by Dubois et.al. [20] that bundles memory writes in a sync operation. Like weak consistency, TC delays updates until the commit of a TA, but the speculative execution allows a retrospective enforcement of strong consistency.
3 Overall Architecture Targeting Grid environments, OSS must adapt to dynamic and heterogenous applications. In order to support heterogenous programming languages, OSS identifies an object with a unique ID, currently, its address in a 64-bit virtual memory. OSS partitions the application address space into the conventional local storage and the shared object space. It implements a dynamic object management that allows to create and delete objects in the shared object space. Each node can modify shared objects, so that OSS must encorce consistency for all replicas in the shared object space. OSS is designed to support different consistency models within one application. Among the multitude of potentially
70
K.-T. Möller et al.
interesting consistency models, we are currently implementing transactional consistency (TC). The latter applies optimistic concurrency control avoiding complicated lock management. We believe this is a promising model being convenient and consistent. Of course TC will not scale to an unlimited number of nodes, but when combined with other programming concepts, we expect good scalability (see also section 4.2). Nonetheless, OSS’ functional primitives allow implementing weaker consistency models as well. 3.1 Dynamic Object Allocation OSS’ object management subsystem implements two functions to create and destroy objects, named oss alloc and oss free in the style of local memory management. OSS is neutral with respect to programming languages: The function oss alloc takes the requested object size as a parameter, and returns the new object’s ID in the form of its memory address. The function oss free takes an object ID and, if the ID is valid, destroys the designated object. To make object management scale in the number of participating nodes as well as in the number of objects, OSS uses a two-stage allocation scheme, a common technique for parallel allocators [21]: Several flexible high-level allocators build upon one simple, Grid-wide low-level allocator. The Grid-wide allocator hands out objects having a fixed size of 4 KB. If an application requests an object larger than 4 KB, the allocator aggregates contiguous fixed-size objects to a larger object. A distributed table stores reservation meta-data, similarly to Mungi’s object table [22]. OSS’ object table, however, is interspersed throughout the object space, such that meta-data is spatially distributed but resides near corresponding objects. The entries of the object table encode the node that has created the belonging object, the consistency model applying to the object, and, if the object is suballocated, the identifier of the high-level allocator. For fine-grained object allocations, an application can choose among several top-level allocators. As a general-purpose allocator, we have integrated dlmalloc [23] into OSS, using the mspace abstraction to retrieve meta-data when freeing remotely allocated objects. We are currently implementing the Multiview approach [24], which counteracts false sharing between colocated objects by assigning them IDs that are unique within their access detection unit. 3.2 Replica Management Applications access local replicas of shared objects. OSS considers the node- local object mappings to be a cache of the distributed objects and tracks the consistencyrelated state of replicas in a local object table. An entry in the local object table stores an object’s state, as defined by the respective consistency model, a privileged mapping that allows to modify the object circumventing ac- cess detection, and potentially several shadow copies that store backup versions of the object. OSS constructs local mappings lazily, such that expensive memory mapping operations only take place when an application accesses a previously unknown object.
A Software Transactional Memory Service for Grids
71
To guarantee consistency among replicas, all consistency models need to de- tect object accesses. Given that objects reside in virtual memory, OSS controls the memory-management unit (MMU), a well-known and language-neutral ac- cess detection technique [25]. OSS uses Linux’ mprotect system call to modify the hardware access permission to the application’s virtual address space at page granularity. In case a memory operation exceeds the access permission granted by hardware, the Linux kernel signals a segmentation violation to OSS’ exception handler. The application-known mapping and the privileged mapping for internal use by OSS must coincide. Moreover, the Multiview approach suggests creating multiple mappings of adjacent objects, such that each object is accessible via a dedicated virtual memory page. OSS stores ranges of objects in System V shared memory segments, allowing it to map the same object repeatedly at different virtual addresses. Although MMU-based access detection is bound to page-size granularity, OSS employs several techniques to detect access to objects of different size. The shadow copies, which are created when objects are modified, not only serve to rollback aborted TAs, they also enable tracking object modifications, thus help refine page-granular object access detection. We are currently investigating how to correlate objects based on object access patterns. Although statistical analysis is difficult in a dynamic environment, we would like to determine object access groups which aggregate objects that are frequently accessed together. 3.3 Monitoring Facilities OSS supports several monitoring facilities to optimize its replica management and to allow a dynamic reorganization of the overlay network. Each node stores its monitoring information in an additional shared region, making monitoring data easily accessible from any peer. OSS registers monitoring data per node in its hierarchical naming service, which is also stored in the shared object space. Regarding replica consistency for instance, monitoring data can help determine object access groups. The performance of TM mainly depends on the rate of successful committed TAs. Conflicting TAs degrade the application’s performance, because aborted TAs have to be restarted. The conflict probability correlates with the number of modified objects and the object access pattern. Thus, profiling information gathered by the monitoring service helps the programmer identify conflicting TAs.
4 Transactions OSS’ TAs follow the standard ACID properties, except for durability, as we will discuss the next section. Isolation requires conflicting TAs to be serialized, either by a pessimistic locking or by an optimistic synchronization scheme. Pessimistic locking burdens the programmer with complex lock management and is prone to deadlocks. Like the TM community, we prefer an optimistic locking-free synchronization scheme. Using forward validation, as opposed to backward validation, OSS can dynamically choose a TA to abort in case of a conflict. OSS detects conflicts between overlapping TAs by comparing their read and write sets.
72
K.-T. Möller et al.
4.1 Transactional Consistency Sharing objects using transactional consistency bundles all accesses to the shared object space between oss bot and oss eot function calls into one atomic operation. Access to the shared space is nearly transparent for the applications, except that the developer needs to specify the beginning and end of TAs. For critical DBMS, e.g. when running bank accounting system, durability is mandatory, requiring the DBMS to save data on disk. However, for OSS’ target applications, e.g. multi-user virtual worlds, the overhead imposed by disk access is too high. After a commit, the results of a TA are stored in volatile memory only. However, the XtreemOS Grid checkpointer [26] will periodically write snapshopts to disk, therewith providing durability and fault tolerance. Of course a programmer can enforce durability by generating a checkpoint after an important OSS TA. Another publication by the authors [27] describes in detail how OSS runs TAs and how it enforces restarting failed TAs under Linux. 4.2 Scalability OSS is currently designed to support interactive distributed applications such as multi-user virtual worlds (namely Wissenheim [28]). This type of applica- tion usually requires a fast response time in network communication. Therefore, fast TA validation and restart are fundamental aspects to achieve highly scal- able transactional storage. OSS uses several techniques to reduce and hide the network latency. Regarding TA validation, OSS sends unacknowledged commits messages. This prevents idling while waiting for commit acknowledgements, and the application can go ahead while the commits are still in transfer. Sometimes this could cause receiving write sets in different order. But OSS guarantees a total order of commits by using Lamport time stamps [29]. In case a node misses a commit packet, OSS easily detects such situations and request it from its peers which in turn will reply using their TA history buffer. For scalability reasons we plan to retransmit missed network packets as close as possible to the requesting node, e.g. by its super-peer. Further techniques like pipelined TAs, easing the waiting time for the commit token, super-peer commits, replica management and several fault tolerance mechanisms are described in [27]. 4.3 Communication Subsystem The network communication subsystem is an important component for a scalable sharing service. We have decided to handle the communication among nodes with a compact two-stage-based binary-network-protocol. Thus we can avoid an expensive parsing like necessary when using text-based network-protocols, e.g. Hypertext Transfer Protocol (HTTP). The communication unit consists of two layers, the low layer for the raw data exchange over standard network protocols and the upper layer for OSS-specific data representation. This makes OSS flexible and independent from any specific transport protocol.
A Software Transactional Memory Service for Grids
73
The lower communication layer manages network connections and ensures reliable raw data exchange. Furthermore, the lower layer maps unicast as well as multicast messaging to the transport protocol among nodes. For the upper layer it is transparent whether the lower layer uses a stream- oder datagram- based transport protocol. Currently, OSS uses the Transmission Control Protocol (TCP), so it does not need to take care about reliability regarding data exchange. But we plan to study a UDP-based overlay multicast for OSS. The upper communication layer contains the functionality of sending and receiving network messages. A network message is equivalent to the upper layer’s protocol data unit (PDU) and consists of a well-defined message header and a data part. The data is subject to the combination of the type and subtype fields in the message header. The type field defines the callback network handler which has been registered before by an OSS module (e.g. consistency model), whereas the second subtype field distinguishes different network messages of the respective module. The type field also encodes whether a message is a request or reponse. Incoming requests are enqueued into a request queue, such that OSS can re- arrange messages to enforce ordering of messages and fairness of token requests. In order to achieve a flexible and highly scalable communication, network han- dlers must not block, which would result in delaying the processing of further requests. So queuing requests enables OSS to defer already processed PDUs for later reprocessing. This could be necessary if the handler itself would block while gathering information or if it sends a network request by itself. In contrast, re- sponse messages should be processed as fast as possible to minimize the local blocking time. Therefore, responses will be processed directly without queuing. Asynchronous messages can either be handled like queued requests or like un- queued response messages. OSS supports blocking as well as non-blocking request-reply cycles and asynchronous unidirectional message exchange. Furthermore, it supports forwarding messages to other nodes. Besides, the network unit is able to route packets. The difference between both methods is that routing is done at the lower layer by evaluating the PDU’s destination ID. Message forwarding is done in the upper layer and is controlled by a specific network handler. The synchronous functions, which block until an appropriate response message is received, store meta-data in an internal data structure. This data is later used to assign a received response message to its pending request and continue the corresponding blocking function call. In case of a blocking multicast message, the function call does not return until all response messages have been received.
5 Preliminary Results This section evaluates the lower-bound transaction-overhead of the OSS service using a raytracer application. The latter is based on an non-parallel application developed during a course at the MIT and which has been ported and extended to a parallel version running on top of OSS. Raytracing is suitable for parallel computing because all parts of a raytraced picture are discrete. As a consequence, a raytracer typically scales well when executed in parallel. Nevertheless, it is
74
K.-T. Möller et al.
important to remark that our modified raytracer executes TAs, and even if there are no collisions between overlapping TAs there is still network traffic caused by committing TAs. Each node commits TAs, requiring to request the commit token and to post its write set. Furthermore, each incoming commit triggers a local validation interrupting a computing TA. Of course one could easily imagine a worst case scenario, e.g. all nodes incrementing a variable. The latter will neither scale with OSS nor with other approaches. These kind of conflicts need to be addressed by the programmer. The evaluation we have performed is a distributed rendering of a raytracer scene in size of 1024x1024 pixels, as shown in Fig. 1. The setup consists of one control engine and multiple rendering engines. The control engine deploys computational segments of the scene to all raytracing engines using transactional shared objects. If a node has finished computation of a segment, it will take the next one until all segments have been computed. The rendering results of all segments are also stored in the transactional shared object space. For evaluation, we have used a 16 node cluster, each node as a rendering engine, and one additional control node, external to the cluster, deploying the segments. Each cluster node has two AMD Opteron CPUs at 1,8 GHz, 2 GB RAM, a Broadcom BCM5702X Gigabit NIC and runs a 64-bit Linux 2.6.24 kernel. The control node has an Intel Core 2 Duo CPU at 2,66 GHz, 2 GB RAM, an Nvidia Geforce 7300SE graphics card, an Intel 83541PI Gigabit NIC and runs a 64-bit Linux 2.6.25 kernel. All nodes are interconnected via switched Gigabit Ethernet.
Fig. 1. Picture of the raytraced scene
A Software Transactional Memory Service for Grids
75
We have monitored the duration of raytracing with a different number of nodes and varied the size of segments. The results are depicted in Table 1 and Fig. 2. First, we can see that the raytracer scales nearly linear with a multiple number of nodes. Second, the time difference of the three segment sizes is marginal and shows that the overhead of many token requests and write set postings are neglible. The second table depicts the elapsed time for requesting the validation token or a shared memory page. With an increasing number of rendering nodes, the Table 1. Time duration for rendering a Raytracer scene in seconds Nodes 2 4 8 16 1 Segment size 4096 Bytes 122,76 62,00 31,51 16,76 9,02 16384 Bytes 120,51 61,00 31,26 17,01 9,52 65536 Bytes 116,51 60,00 32,51 19,01 11,31
Table 2. Average page and token request time in microseconds Nodes 1 2 4 8 16 Request time Page request time 79 168 205 195 225 Token request time 0 184 363 761 1739
Fig. 2. Raytracing time duration with different number of raytracing engines and segment sizes
76
K.-T. Möller et al.
token request time highly increases and seems to be a limiting factor whereas the page request time increases at a slower rate. Currently, token requests are always sent to the last known node which had owned the token. If the receiver does not own the token anymore, it forwards the request. Because the generated picture does not overlap among nodes, most page requests can be acknowledged positive without forwarding.
6 Conclusion Sharing volatile data in a Grid environment is a useful and comfortable approach complementing traditional message passing technologies. In this paper we have presented OSS, a transactional data sharing service for grid environments, which handles data location, replication, and consistency transparently with respect to application software. Transactional memory is convenient for the programer as it implements strong consistency but avoids complicated lock management. Several optimizations can help speed up transaction-based programs, for example introducing consistency domains reducing the number of nodes being involved during the validation phase. Of course the programmer can also adjust transaction granularity to reduce collision probability. Overall we are encouraged by the preliminary evaluation of the current implementation using the parallel raytracer. These measurements show that the lower-bound transaction-overhead imposes only low overhead for properly parallelized programs. Of course there are applications with limited scalability when combined with transactions. Therefore, OSS provides support for multipe consistency models. The next steps include integration of a super-peer-based overlay network structure, a distributed hash table for data search, pipelined transactions (to hide commit latency), and more experimentation, especially with the Wissenheim world, executed in wide area networks.
References 1. Foster, I., Kesselman, C., Natrajan, A.: The Grid: Blueprint for a new computing infrastructure (1999) 2. http://www.globus.org 3. http://www.legion.virginia.edu 4. http://www.unicore.eu 5. Morin, C.: XtreemOS: a Grid operating system making your computer ready for participating in virtual organizations. In: IEEE International Symposium on object/component/service-oriented/Real-time Distributed Computing (ISORC) (2007) 6. Shalom, N.: Data-awareness and low-latency on the enterprise Grid. Technical report, GigaSpaces Technologies Inc. (2007) (Last accessed November 07, 2008) 7. Gray, J., Reuter, A.: Transaction Processing: Concepts and Techniques. Morgan Kaufmann, San Francisco (1993) 8. Kung, H.T., Robinson, J.T.: On optimistic methods for concurrency control. ACM Transactions on Database Systems 6(2) (1981)
A Software Transactional Memory Service for Grids
77
9. Herlihy, M., Moss, J.: Transactional memory: Architectural support for lock-free data structures. In: International Symposium on Computer Architecture (1993) 10. Hammond, L., Carlstrom, B., Wong, V., Hertzberg, B., Chen, M., Kozyrakis, C., Olukotun, K.: Programming with transactional coherence and consistency (TCC). In: Intl. Conference on Architectural Support for Programming Languages and Operating Systems, Boston, USA (2004) 11. Larus, J., Kozyrakis, C.: Transactional memory. Commun. ACM 51(7), 80–88 (2008) 12. Harris, T., Marlow, S., Jones, S.P., Herlihy, M.: Composable memory transactions. Commun. ACM 51(8), 91–100 (2008) 13. Antoniu, G., Deverge, J.F., Monnet, S.: How to bring together fault tolerance and data consistency to enable Grid data sharing. Concurrency and Computation: Practice and Experience (2006) 14. Jeanvoine, E., Morin, C., Leprince, D.: Vigne: Executing easily and efficiently a wide range of distributed applications in grids. In: Kermarrec, A.-M., Bougé, L., Priol, T. (eds.) Euro-Par 2007. LNCS, vol. 4641, pp. 394–403. Springer, Heidelberg (2007) 15. Li, K.: Ivy: A shared virtual memory system for parallel computing. In: Proceedings of the 1988 International Conference on Parallel Processing (August 1988) 16. Amza, C., Cox, A., Dwarkadas, S., Keleher, P., Lu, H., Rajamony, R., Yu, W., Zwaenepoel, W.: TreadMarks: Shared memory computing on networks of work- stations. IEEE Computer 29(2) (1996) 17. Hoeflinger, J.P.: Extending OpenMP to clusters. Technical report, White Paper, Intel (2006) 18. Goeckelmann, R., Schoettner, M., Frenz, S., Schulthess, P.: A kernel running in a DSM design aspects of a distributed operating system. In: IEEE International Conference on Cluster Computing, Hong Kong, China (2003) 19. Vallée, G., Lottiaux, R., Rilling, L., Berthou, J., Dutka-Malhen, I., Morin, C.: A case for single system image cluster operating systems: Kerrighed approach. Parallel Processing Letters 13(2) (2003) 20. Dubois, M., Scheurich, C., Briggs, F.: Synchronization, coherence and event ordering in multiprocessors. IEEE Computer 21(2) (1988) 21. Berger, E.D., McKinley, K.S., Blumofe, R.D., Wilson, P.R.: Hoard: a scalable memory allocator for multithreaded applications. SIGARCH Comput. Archit. News 28(5), 117–128 (2000) 22. Heiser, G., Elphinstone, K., Vochteloo, J., Russell, S., Liedtke, J.: The mungi singleaddress-space operating system, vol. 28, pp. 901–928. John Wiley & Sons, Inc., New York (1998) 23. Lea, D.: A memory allocator. Technical report, State University of New York at Oswego (2000) (Last accessed November 07, 2008) 24. Itzkovitz, A., Schuster, A.: MultiView and Millipage – fine-grain sharing in page- based dsms. In: OSDI 1999: Proceedings of the third symposium on Operating systems design and implementation, pp. 215–228. USENIX Association, Berkeley (1999) 25. Li, K., Hudak, P.: Memory coherence in shared virtual memory systems. ACM Trans. Comput. Syst. 7(4), 321–359 (1989) 26. Cortes, T., Franke, C., Jégou, Y., Kielmann, T., Laforenza, D., Matthews, B., Morin, C., Prieto, L.P., Reinefeld, A.: XtreemOS: a vision for a Grid operating system. Technical report, Barcelona Supercomputing Center (BSC), Spain (2008)
78
K.-T. Möller et al.
27. Müller, M.F., Möller, K.T., Sonnenfroh, M., Schöttner, M.: Transactional data sharing in Grids. In: PDCS 2008: 20th IASTED International Conference on Parallel and Distributed Computing and Systems, Calgary, Alberta, Canada, IASTED (November 2008) 28. Fakler, M., Frenz, S., Schoettner, M., Schulthess, P.: A demand-driven approach for a distributed virtual environment. In: Proceedings of the IEEE Canadian Conference on Electrical and Computer Engineering (2006) 29. Lamport, L.: Time, clocks, and the ordering of events in a distributed system. Commun. ACM 21(7), 558–565 (1978)
An Empirical Study on the Performance Issues on the Clustered Client-Server Computing Environment Yu-Hung Hsiao and Han-Jyun Su Department of Electronic Engineering National United University
[email protected],
[email protected]
Abstract. In this paper, the performance of four computation models applied on a clustered computing environment is studied. A 3-tiered1 client-server architecture model is used as the baseline architecture for the study. An experimental cluster, using the off-the-shelf hardware and software components, was built and used to conduct the performance evaluations. The queries used in the study can be extended to numerous real-life applications. Hence the contribution of this study is mainly empirical, especially for those applications that have the similar settings. The alternative Multiple Application Servers, Multiple Database Servers (MAMDA) computation model which implements the application servers and database servers on the same PCs provides the best performance speedup, keeping the efficiency greater than or equal to 0.9. Keywords: cluster computing, client-server architectures, computation models, database query, performance evaluation.
1 Introduction With the advances of the technology, the costs of data processing and communication continue to drop. It is very common nowadays to build cluster systems using off-theshelf hardware and software components, for the purpose of high performance, high availability, and high scalability [1],[2]. Although countless cluster systems have been built, achieving high performance with cost-effective tasks allocations is always a challenge. In particular, how to distribute the tasks with the available computing resources to achieve the best performance is the topic addressed here. A 3-tiered client-server architecture shown in Figure 1 is used as the baseline architecture for the study. Based on this baseline model, four computation models with one alternative model are derived and are analyzed for the performance study. The time needed to complete the processing job is counted, and the relative speedup and efficiency are evaluated, too. The remaining sections of this paper are organized as follows. Section 2 provides background information on cluster computing, especially on parallel processing clusters and client-server architectures. The computation models for the cluster systems utilizing the 3-tiered client-server architecture model are introduced. Section 3 1
The three tiers are (from the highest to the lowest level): the client, the application servers, and the database servers.
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 79–89, 2009. © Springer-Verlag Berlin Heidelberg 2009
80
Y.-H. Hsiao and H.-J. Su
describes the environment used in this study, especially the cluster system built particularly for the performance evaluation conducted here, and the allocation strategies of the processes. The data patterns, the data queries, as well as the performance metrics considered are also described. Section 4 gives the empirical results and provides discussions. In Section 5, concluding remarks are drawn.
2 Backgrounds A cluster system is usually built with several off-the-shelf computers connected through a high-speed communication network. According to the definition of a cluster system [3], a cluster system is used as a single unified computing resource from the users' point of view. Usually cluster systems are developed for the purposes of improving performance, availability, or load-balancing. In this study, achieving cost-effective high performance is the primary goal considered. 2.1 Parallel Processing Cluster Systems Traditionally, parallel processing are mostly conducted through ad-hoc computer systems equipped with multiple processors operate concurrently. This type of systems is usually referred to as multiprocessing systems or tightly-coupled parallel processing systems. In this case, processors are connected by a high speed bus or switching network, and communications among processes are achieved through shared memory [4]. The cluster systems provide alternatives to achieve high performance with a much lower cost. As the performance of personal computers and local area networking continues growing, and the cost of these two major components continues dropping, it is attractive to connect the low-cost, high performance personal computers through a high-speed network. As building the cluster systems becomes feasible, the challenge remains in the computation model, i.e., how to allocate computations derived from the applications so that the best performance can be achieved with the available computing resources. A parallel processing cluster system usually is constructed using off-the-shelf personal computers or workstations, with corresponding storage systems, and highbandwidth networks. Such a parallel-processing cluster system can provide the potential of computation capability that is compatible with the traditional multiprocessing systems. Just like the traditional multiprocessing systems, an application needs to be divided into independent subtasks, so that parallel processing can be applied. These independent subtasks need to be distributed to the computing nodes within the cluster system. The Beowulf class of clusters is an example of the common cluster systems designed to support this objective [5]. 2.2 The Client-Server Architecture For the purpose of discussions, a client-server architecture model, shown in Figure 1, is used. On the highest level, the client interacts with the applications outside of the cluster, passes the query requests to the servers reside in the cluster, collects the responses, and provides the results back to the customers outside of the cluster.
An Empirical Study on the Performance Issues
81
Fig. 1. The Client-Server Architecture Model
There are two kinds of servers involved in this model, e.g., the application servers and the database servers. As shown in Figure 1, the number of application servers and the number of database servers do not have to match. The application servers are dedicated to the application and distribute the corresponding tasks to the database servers; while the database servers are mainly working on database management and providing storage for data. Different servers may be located on different computing platforms, or on the same platform. When more than one server is located on the same computing platform, multitasking or multi-processes mechanisms can be applied. In terms of parallel processing, multitasking or multi-processes does not really provide the performance benefit. In fact, performance will be degraded because of the overhead caused by context switching, etc. On the cluster architecture model described above, an application may choose to use n application servers and m database servers. Based on the number of servers used, four computation models can be derived: 1. 2. 3. 4.
SASD: Single Application server, Single Database server SAMD: Single Application server, Multiple Database servers MASD: Multiple Application servers, Single Database server MAMD: Multiple Application servers, Multiple Database servers
Theoretically, each of the above four models can be implemented on the experimental cluster system built in the lab. The cluster system used for the study, as well as the way to distribute the tasks on the servers will be described in details in the next section. Since SASD is trivial, only the SAMD, MASD, and MAMD models are studied. Moreover, an MAMD-Alternative (MAMDA) model will be introduced and included in the experiments.
3 Environment Description In this section, the cluster system built for the study will be presented. The computation models applied on the cluster system will be discussed. Data entry and data query
82
Y.-H. Hsiao and H.-J. Su
used in the evaluations will be introduced. Moreover, performance metrics used will be described, too. 3.1 System Description To build a cluster, several personal computers (PCs) with add-on cards and the networking equipments will be needed. In particular, the cluster system used in this study contains up to 34 PCs, with all the PCs having the same hardware specification (Intel P-III 800MHz). Moreover, up to 3 Fast Ethernet hubs are used to connect the PCs so that a local area network (LAN) is constructed. Similarly, the hubs have the same specification (D-Link DFE-916DX). Besides the hardware equipment, the software components used include the operating system, the database server, and the compiler (to compile the applications.) In particular, the Fedora Core 5, a Linux distribution, is used as the operating system. The database server, MySQL 5.0.18, is used to store the data and promote the speed of data query process. MySQL is an open source SQL database management system published by MySQL AB. The application on the servers is written in C language, using the GNU Compiler Collection (GCC 4.1.0) and the associated libraries. Moreover, the MySQL C API is used to code the application. 3.2 Data Entry and Data Query The structure of the data entry is described as follows. Each data entry contains an identification number, which ranges from 1 to 10,000,000. Therefore we have ten million data entries to be processed. There are six number fields associated with each data entry, denoted as n1 through n6, which are random numbers that range from 1 to 49. Moreover, ni ≠ nj, when i ≠ j, for 1 ≤ i, j ≤ 6. To simplify the process, the six random numbers are sorted prior to the process, such that ni < nj, where i < j. Thus, a total number of ten million data entries will be stored in a table. A data query will cause a search on the table. The purpose of the query is to see whether there is a match (or matches) in the table. A match means that the data entry has the exact same six numbers as the data entered. Note that in reality, this searching process can be found in many real-life applications, such as the lottery game, web searching, etc. It should be noted that a high potential of parallelism exists in this searching process. Conceptually, the table can be divided and the searching can be done independently. It is this “independence” characteristic that provides the potential of parallel processing. Since there is no dependency among the searching processes, the order of the search does not affect the results; hence all the independent searches can be done in parallel. Ideally, if there are 10 million servers available, the search can be done in one step. To store and manage the data queried, we create a database in the MySQL database server. The database server's storage engine used is the default MyISAM, which is based on the Indexed Sequential Access Method (ISAM) code. Originally, one table with 10 million entries of data was created in the database. To support the parallel query processing, the original table is split into 2 (each contains 5 million entries), 4 (each contains 2.5 million entries), 8 (each contains 1.25 million entries), 10, 16, 20, 25, and 32 sub-tables with equal sizes.
An Empirical Study on the Performance Issues
83
3.3 Executing the Pattern Matching Process The actual pattern matching process can be done either on the database servers or on the application servers. According to where the actual matching process is performed, two computational modes can be defined: the Done-by-MySQL (DBM) mode and the Done-by-Application (DBA) mode. In the DBM mode, an SQL clause, in particular, the “SELECT id FROM table_name WHERE matching_criterion,” is sent to database servers. The database servers perform the matching process and provide the queried result. In this case, since the majority of the work is done by the database servers, the times spent on the database servers are measured and the most cost-effective number of database servers can be estimated. Since the data are stored in database server(s), we must first fetch the data from the database server(s) in the DBA mode. To fetch data, a query string, in particular, “SELECT * FROM table_name,” is sent to the database servers. The application server fetches the data entry and performs the matching process to obtain the identification number of entry that matches the criterion. 3.4 Computation Models The implementation details for all the computation models will be described in this section. Figure 2 depicts the setup for the SAMD model. The application client (APC) sends a request message to the single application server (APS) using TCP sockets. The request message includes the six numbers requested for matching. After sending out the request message, the APC waits for the reply message from the application server. When the application server receives the request message, it will create n child processes, 1 ≤ n ≤ 32, to query the n database servers (DBSs). The n child processes will query the n database servers in parallel, where every child process searches the sub-table of (10,000,000/ n) data entries on different database server. When all child processes have completed their tasks, the application server sends the result back to the APC. The result contains the identification numbers of the matched entries. The application server and the child processes forked are executed on one single PC, while the database servers are executed on other PCs, one database server per PC.
Fig. 2. SAMD Implementation Model
84
Y.-H. Hsiao and H.-J. Su
Fig. 3. MASD Implementation Model
Fig. 4. MAMD Implementation Model
In the MASD model shown in Figure 3, the APC sends n request messages to n APSs. When the APS receives the request message sent from the APC, it forks a child process to query a sub-table of (10,000,000/n) data entries stored in the single DBS, and waits for the completion of the child process. In this model, the DBS is implemented using only one PC, while the APSs are implemented on multiple PCs. Similar to the MASD model, the APC in the MAMD model shown in Figure 4 sends n request messages to n APSs and waits for the reply from the n APSs. Moreover, one APS is paired with a DBS implemented on a different PC of the same hardware specification. According to the number of PCs available, 16 APSs and 16 DBSs are implemented for the MAMD model. However, the large amount of data transferring between the database server(s) and the application server(s) in the DBA computational mode will be a main performance bottleneck. To resolve this problem, an alternative model, referred to as the MAMD Alternative (MAMDA) model, is proposed and illustrated in Figure 5. Unlike the other three models mentioned above, the MAMDA model implements a pair of the APS and DBS on the same PC, and the DBS can only be queried by the APS located on the same PC.
An Empirical Study on the Performance Issues
85
Fig. 5. MAMDA Implementation Model
3.5 The Performance Metrics In this study, the time used to complete the query is measured and defined as the completion time. In addition to the completion time, speedup and efficiency are derived. We denote Tn as the completion time for all n child processes created to process the query. For example, considering the SAMD model, T1 is the completion time that one child process is forked by the single application server, and only one database server is used. T1 is the completion time that n child processes are forked by the single application server, and n database servers are queried in parallel, where every child process searches (10,000,000/ n) data entries on different database server. After defining the completion time, the speedup of the SAMD model where p child processes are created can then be defined as Sp = T1 / Tp While speedup is a useful performance metric for assessing parallel processing, efficiency is another measure for assessing the cost-effectiveness of computations. To estimate efficiency of a cluster system, the number of PCs used in implementing the application servers and database servers is considered. Hence, the efficiency of the SAMD model with p child processes is defined as Ep = Sp / (number of PCs used in implementing the application servers and database servers) = Sp / (1 + p). In the MASD model, Tn is the completion time that n application servers take to process the job, with each application server creates one child process. The speedup and efficiency of the MASD model with p child processes are defined as Sp = T1 / Tp and Ep = Sp / (p + 1), respectively. In the equation of calculating efficiency, p is the number of application servers used and 1 is the number of database server used. In the MAMD model, Tn is the completion time that n application servers and n database servers are used in the query process, where n child processes are forked by n application servers. The equation of speedup of the MAMD model with p child processes is the same as those defined for the SAMD and MASD models. But the efficiency of the MAMD model is calculated by the equation Ep = Sp / (2 * p), due to that the MAMD model with p child processes uses p PCs to implement p APSs and p PCs to implement p DBSs at the same time.
86
Y.-H. Hsiao and H.-J. Su
Similarly, in the MAMDA (MAMD-Alternative) model, Tn is the completion time that n application servers and n database servers are used in the query process, where n child processes are forked by n application servers. However, in the MAMDA model, the application servers and database servers are implemented on same PCs by pair, where a PC runs an application server and a database server at the same time. So, the efficiency of the MAMDA model with p child processes is calculated by the equation Ep = Sp / p.
4 Results and Discussions The performance results of the above described experiments, e.g., four computation models with the two computational modes, are presented here. The speedup, the efficiency, and the effects of database servers and the network are discussed. 4.1 Speedup and Efficiency Figures 6 and 7 show the results of the speedups for the DBM and DBA modes over the four computation models, respectively. Moreover, the ideal cases of speedup are displayed for the purpose of referencing. Figures 8 and 9 show the efficiencies for the DBM and DBA modes over the four computation models, respectively. From Figures 6 and 8, it is concluded that the number of database servers should not exceed 25 for the SAMD model with the DBM mode. This is from the observation that the speedups provided by 25 and 32 database servers are almost the same. The peak efficiency is obtained when the number of child processes forked is equal to 8. Taking the speedup and efficiency into account simultaneously, the number of database servers ranged from 8 to 16 is the optimum range for the SAMD model with the DBM mode. For the MAMD model with the DBM mode, although it can provide speedup compatible with the MAMDA model, the MAMD model consumes twice the number of PCs as that used by the MAMDA model. This worsens the efficiency of the MAMD model, and implies that the MAMD model is not the best choice for building a clustered client-server system.
Fig. 6. Speedup for the DBM mode over the four computation models
An Empirical Study on the Performance Issues
87
Fig. 7. Speedup for the DBA mode over the four computation models
Fig. 8. Efficiency for the DBM mode over the four computation models
From Figures 7 and 9, we see that there is no outstanding speedup obtained by the SAMD, MASD, and MAMD models with the DBA mode. For the SAMD and MAMD models, the speedup provided is less than 2, while the speedup provided by the MASD model is less than 1. The root problem of this phenomenon will be addressed in next subsection. On the other hand, the MAMDA model provides the best speedup and efficiency among the four models. For the MAMDA model, the ideal speedup is almost reached in both the DBM and DBA modes, and the efficiency obtained is greater than or equal to 0.9. In short, the MAMDA model provides the highest scalability and the best costeffectiveness. 4.2 Effects of Database Servers and Network It is concluded from Figures 6 and 7 that the DBM mode performs better than the DBA mode does. In the DBA mode, the data need to be fetched from the database
88
Y.-H. Hsiao and H.-J. Su
servers. Besides the functions used to establish a connection to MySQL and execute the SQL query, extra functions are needed to conduct the work. Specifically, the function mysql_use_result() is used to initiate a result set retrieval due to the limitation of available main memory on PCs used, and the function mysql_fetch_row() is used to obtain the data from MySQL row by row.
Fig. 9. Efficiency for the DBA mode over the four computation models
In addition to the waste of time to transfer data from DBS(s) to APS(s), much of the execution time in the DBA mode is wasted in conducting type conversion. So, the data transfer time and type conversion time are the two main problems that cause DBA mode to take longer time to complete than that with the DBM mode. In the SAMD and MAMD models, the data processed by the application servers are fetched from the database servers not located on the same computing platform. In the MAMDA model, the data processed by the application servers are fetched from the database servers located on the same PCs. Therefore, when the number of child processes is less than 2, the database server's computing capability dominates the performance. Note that the matching process and the data fetching are performed simultaneously. In the SAMD and MAMD models where data must be transferred across the networks, the communication bandwidth is the key in performance. The lesson learned from this experiment is that network bandwidth is the major performance bottleneck. To improve the system performance of the SAMD model while single application server must connect with multiple database servers, providing high bandwidth in the network infrastructure is the key, for example, the 10 Gigabit Ethernet, Myrinet, or InfiniBand architecture, etc. To relieve the bottleneck in the MAMD model, dedicated communication line between every pairs of APSs and DBSs should be added to eliminate the network traffic conflicts caused by the shared hubs.
5 Conclusions With the advances of the semiconductor and communication technologies, the costs of processing and communication drop dramatically. Cluster systems provide the
An Empirical Study on the Performance Issues
89
great potential of boosting performance in many areas, e.g., scientific, graphic, financial, banking, and web-based applications, etc. To achieve a high performance and cost-effective cluster application utilizing the power of parallel processing, adequately distributing the tasks among the available computing resources is the most critical issue. In this paper, an experimental cluster system was built using off-the-shelf hardware equipment and software components. Four computation models were tested and the corresponding performance results were reported. The SAMD, MASD, MAMD, and the alternative MAMDA models were studied. Moreover, two computational modes, which depend on where the matching processes are performed (either on the application server(s) or the database server(s)), were experimented. Ten million data entries were queried, with each entry contains an identification number and six random numbers ranged from 1 to 49. The data query type can be found in many real-life applications, such as the lottery game and web searching, where the data can be searched in parallel and independently. The performance metrics discussed include the time to completion, speedup and efficiency. It is concluded that the MAMDA model can provide the best performance and efficiency among the four models studied. This study also contributes to the building of cluster system applications, through the following guidelines: 1. From the discussion presented in Section 4.1, by considering the speedup and efficiency simultaneously, the optimum number of database servers is ranged from 8 to 16 when building the SAMD type of systems. Moreover, when there is an only one single application server used in the system, the DBM computational mode is more suitable than the DBA mode. 2. When building the MAMD type of systems, the number of application servers and database servers does not play an important role when the DBM mode is used. On the other hand, when the DBA mode is chosen, the communication links among the servers are an important factor in the design. 3. The MASD type of systems is not recommended at all, as the single database server will be the system bottleneck. 4. When building the MAMDA type of systems, due to the high speedup and efficiency, the highest number of application servers and database servers can be supported.
References 1. 2. 3. 4. 5.
Buyya, R.: High Performance Cluster Computing: System and Architectures, vol. 1. Prentice Hall PTR, NJ (1999) Buyya, R.: High Performance Cluster Computing: Programming and Applications, vol. 2. Prentice Hall PTR, NJ (1999) Kopper, K.: The Linux Enterprise Cluster. No Starch Press (2005) Tanenbaum, A.S., Steen, M.V.: Distributed Systems Principles and Paradigms. PrenticeHall, Inc., Englewood Cliffs (2002) Morrison, R.S.: Cluster Computing - Architectures, Operating Systems, Parallel Processing & Programming Languages (2003)
DR: Divided Ring Leader Election Algorithm Mehdi Vojdani and Yaser Taj Islamic Azad University of Qazvin, Qazvin, Iran {mehdi_vojdani,yaser_taj81}@yahoo.com
Abstract. Extending distributed system require new strategy for management and maintenance. For managing distributed system we need one leader like other process in system. Problem is when leader like other process crashed. For solving these problems like these researchers has proposed a number of local based strategies that is each region try to do its work by itself and the results will be gathered in a distributed manner. Leader election is the process of determining a process as the manager of some task distributed among several processes (computers). We suppose like network topologies our distributed system topologies are token and star. We proposed new schemes and discussed about some aspects of them. We proposed divided algorithm in ring topology and we try to reduce latency in the broad networks optionally. Our algorithm
reduces the latency against messages but a bit because latency is more important than number of messages. At the end we see how using of n in Divided (n). Keywords: Distributed systems, Leader Election, coordinator, bully, ring algorithm and topology.
1 Introduction In distributed computing environment like human life environment we need manager or coordinator for maintenance the network for doing some job on all process. We call this computer or process as leader. Like human societies when manager can not work or maintenance well we need to change the leader. Leader election is the process of designating a single process as the organizer of some task distributed among several computers (nodes).In distributed systems, there are many network topologies like hypercube, meshes, ring, bus…etc. These topologies may be either the hardware processors, or the software processes embedded over the other hardware topology. This study will focus on ring processes topology where one process works as a leader and the others as none but at first we discussed on bully algorithm that it work in star network topology. We will propose new election algorithm to solve leader failure automatically in spite of the presence of one link failure. The proposed algorithm will be executed without user intervention. Two old election algorithms are bully and token ring algorithm. In this algorithm coordinator process crash can be detect by other process and other process must start coordinator election by notifying other process. In algorithm notifying and leader election are same. We discussed about main leader election algorithms and some of their aspects in the related work section A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 90–99, 2009. © Springer-Verlag Berlin Heidelberg 2009
DR: Divided Ring Leader Election Algorithm
91
and then their improvements are explained. However our main centralization is on the ring algorithm. New scheme is proposed too in the sections 3 and 4. In the section 5 and comparisons are provided too. Reading this paper gives a good vision for designing a good algorithm in ring topologies.
2 Related Work 2.1 Bully Algorithm At first suppose one process like P[i] detects that the coordinator has crashed and now we require finding new coordinator for coordination operation in system. All of the processes have one process number. In bully algorithm for best choose is choosing biggest process number. P[i] after that follows this steps: 1) P[i] sends “ELECTION” message to all processes that have bigger number than P[i]. 2) Each process that is active P[j] where j>=i, will send a “OK” message to P[i]. 3) If P[i] has received even one “OK” message, it will know that it can not be the coordinator and P[j] send “ELECTION” to greater and it will repeat steps 1 to 3. 4) Finally one process that has bigger number than others and hasn’t received any “OK” message P[i] or P[j] didn’t, announce itself as new coordinator to all of the processes by “COORDINATOR” message. Suppose that we have n active processes in a distributed system and middle process with process number ⎣n / 2⎦ detects that coordinator has crashed. Assume that mn(i) is total number of messages that process p[i] sends (“ELECTION” message) and receives (“OK” message) after sending :
Fig. 1. Bully algorithm
Number of messages: mn(1) + mn(2) +…+ mn( ⎣n / 2⎦ - 1) + mn( ⎣n / 2⎦ ) + mn( ⎣n / 2⎦ + 1) + … + mn(n) = 0+0+…+0+ mn( ⎣n / 2⎦ ) + mn( ⎣n / 2⎦ + 1) + …+ mn(n) = ( ⎡n / 2⎤ + ⎡n / 2⎤ ) + (( ⎡n / 2⎤ -1) + ( ⎡n / 2⎤ -1)) +…+2 + 0
92
M. Vojdani and Y. Taj
≅ n + (n-2) + ……+ 0
=> O(n 2 )
Number of steps: 4 Latency in minimum: 3(when biggest find the crash) Latancey in maximum: n-1 Latency average: n/2 =>O(n) Improvement In the step b of this algorithm processes can send their numbers to p[i](instead of “OK” message) so in the step c, process P[i] can choose biggest number (considering received numbers) and announce it as coordinator by broadcasting the “COORDINAOR” message. So in the fist step of this algorithm p[i] will send an “ELECTION” message, then it will receive bigger numbers of active processes, then it will select biggest one and announce it as coordinator by sending a “COORDINATOR” message. Fig1 shows this work. Considering this steps and previous assumptions.
Number of messages: ⎡n / 2⎤ + ⎡n / 2⎤ +n ≅ 2n => O(n) Number of steps: 3 Latency is exactly: 3 => O(1) 2.2 Token Ring Algorithm
In token ring algorithm each process in the ring must save addresses (ring's table). In this algorithm, similar to the bully algorithm, each process has one process number. But we have one difference here. Suppose that process P[i] detects that coordinator has crashed and now it want to find new coordinator for coordination operation in the system by ring algorithm. This algorithm works as below: 1) Process P[i] sends one token with “ELECTION” title to the next process in the ring. (to P[i+1]). 2) If next process doesn’t reply, then process P will suppose that next process is down and will send “ELECTION” message to second next process in the ring (to P[i+2]). P[i] repeats this works until finds next process that is not in down status and has received the "ELECTION" message. Founded process repeats this work too, and this will go on till election message returns back to the process P[i]. each process when receives "ELECTION" message; before forwarding that, puts it's process number in that message. 3) When the "ELECTION" message returns back, then P[i] will choose the biggest process number as coordinator(between process numbers in the "election" message). then it wheels a “COORDINATOR” message in the ring to announce new coordinator. In this case, we have two round of "message passing" in the ring. First round is for "CRASH" and "ELECTION" massages and second round is for "COORDINATOR" message. Fig2 shows work of token ring algorithm. So we have 2 steps and the number of messages and average time are as below: Number of messages: 2*n =2n => O(n) Number of steps: 3 Latency: 2*n =2n => O(n)
DR: Divided Ring Leader Election Algorithm
93
Fig. 2. Ring algorithm
Improvement Note that each process adds its number to the "ELECTION" message, so when number of processes increase (specially in the end of ring), overheard increases too. For solving this problem we edit this algorithm as each process adds its number to the "ELECTION" message as "biggest" only when it's number is bigger than "biggest" number in the message. In another word we can send only biggest one instead of all of the numbers. Now assume that more than one process detect that coordinator is crashed and send token in the ring. In this case we have additional overhead and even consistency may be refused. For solving this problem we can change algorithm as; when one of this processes (that has sent an "ELECTION" message), receives message that is sent from other ones it will follow this rules:
a) If the number of this process is bigger than the number of sender process, it will kill the message. b) If the number of this process is less than sender's number, it will let this message go round. In Table1 you can see comparison between two algorithms. Table 1. A comparison between Bully and Ring algorithm Algorithm Bully
Number of Message ≅ n(n+1)/4
Number of Steps 4
O( n 2 ) Extended Bully Token Ring
2n O(n) 2n O(n)
3 3
Latency n/2 O(n) 3 O(1) 2n O(n)
3 Divided Algorithm Assume that we just can forward messages clockwise. In the divided ring algorithm similar to the ring algorithm we have a ring, but this ring is divided into m multiple
94
M. Vojdani and Y. Taj
sub rings. We can divide the ring with n process to the d sub rings (d avg ( I ' )
where b x' , y = ⎨
' ⎩0 if i x, y ≤ avg ( I ' )
.
Step 4. Extract the verification key WEG' by
(13)
238
W.-H. Lin et al.
WEG ' = B ' ⊕ K ,
(14)
⎧weg x' , y | weg 'x, y ∈ {0,1}, ⎫ ⎬. ⎩ 0 ≤ x < IW , 0 ≤ y < I H ⎭
where WEG ' = ⎨
Step 5. Divide the WEG' into G blocks. ⎧weg x' , y | weg x' , y ∈ {0,1}, 2 × W w × (t − 1) ≤ x ≤ 2 × W H × t − 1,⎫ ⎪⎪ ⎪⎪ Block ' t = ⎨ W H × (t − 1) ≤ y ≤ W H × t − 1, ⎬, ⎪ ⎪ 1 ≤ t ≤ T, 1 ≤ T ≤ G ⎩⎪ ⎭⎪
(15)
Block tp = Perm s2 ( Block t' ) −1 , 1 ≤ t ≤ T ,
(16)
where the value of T and the size of a block are the same as those defined in Eqs. (4) and (5). Perms2(.)-1 denotes the inverse function of Perms2(.) with seed s2. Step 6. Use the majority vote to decide whether WE’ is bit 1 or bit 0. WE'=MajorV( BlocktP ), 1
≦t≦T.
(17)
' , n | wem ' , n ∈ {0,1}, ⎧wem ⎫ ⎬, 0 < m < 2 × W , 0 ≤ n < W W H⎭ ⎩
here WE ' = ⎨
the MajorV function determines the maximum number of bit 0 and bit 1 of the same position of Block tP , 1 t T. For example, the number of bit 1 at position (1,1) of every block is 10, and the number of bit 0 at position (1,1) of every block is 22. After MajorV function, we1' ,1 is turned out to be bit 0.
≦≦
Step 7. Split the watermark bits and noise bits from WE' to get watermark bits. Step 8. Inverse We to form the watermark logo W' by permutation function with seed s1.
3 Experimental Results and Discussions 3.1 Experiment Results
The peak signal-to-noise ratio (PSNR) is used to evaluate the quality between an attacked image and the original image. After extracting the watermark, the normalized correlation coefficient (NC) [2] is computed. We use the Lena image (512×512 pixels, 8 bits/pixel) as the test image in our experiments. The size of the binary watermark logo is 64×64, and the value of T is 32. Fig. 1 shows the original Lena image and binary watermark. For attacking, we use the Stirmark benchmark [4] and PhotoImpact 11 software tools to simulate common image attacks.
Digital Image Watermarking for Malicious Attack
(a)
239
(b)
Fig. 1. (a) The original image of Lena of size 512 × 512. (b) The original binary watermark of size 64 × 64.
In the experiments, both geometric and nongeometric attacks are considered. Nongeometric attacks include JPEG compression, median filtering, Blurring, sharpening, and histogram equalization. The geometric attacks include rotation, scaling, Gaussian noise, print-photocopy-scan, and cropping. The experimental results show in Table 1 and the watermark logos can still be recognized clearly. In Table 2, we compare the proposed method to Chen et al.’s [1] and Lou et al.’s [2] methods to demonstrate the robustness of our method. In the experiment, the Lena image (512 × 512 pixels, 8 bits/pixel) is used. The watermarked image is attacked (by blurring, JPEG, Noise, sharpening, print-photocopy-scan, and scaling attacks) more Table 1. Normalized correlation coefficients (NC) upon geometric and nongeometric attacks
240
W.-H. Lin et al.
seriously than that in Chen et al.’s and Lou et al’s methods; although our PSNRs are lesser than theirs, the value of NC under each attack is still 1. In other attacks (rotation, cropping, and cropping + scaling), all parameters are set to the same as those in Chen et al.’s method; that is, for the rotation attack, the image is rotated at 2°, for the cropping attack, the image is cropped by ¼, and for cropping +scaling attack, the image is scaled from 512 × 512 pixels to 560 × 560 pixels, then the edge area of the test image is cut to form the 512 × 512 test image. As you can see, the values of PSNRs of our method are quite closer to those in Chen et al.’s method; the value of NC under each attack is always higher than that of Chen et al.’s and Lou et al.’s methods. Note that all parameters of latter attacks such as rotation, cropping, and cropping + scaling are not described in [2]. For cropping attack, the image was cropped by 3/4, the PSNR for the remaining image is still greater than 5; we are curious about the parameters set by Lou et al’s method. Table 2. Comparison with Lou et al.’s[2] and Chen et al.’s [1] methods
3.2
Discussions
The proposed method satisfies the properties of the watermarking including blindness, security, invisibility, robustness, unambiguity and transparency. Since the original image is lossless, multiple logos can be handled [1]. The proposed method can also be applied to the color image. The watermark bits can be embedded based on the RGB color values of the image. Furthermore, the proposed method is based on the spatial domain; it can reduce the computation time in which the image in the spatial domain transforms to the frequency domain. Hence, the proposed method can be applied to the video stream.
4 Conclusion In this paper, copyright protection based on 1/T forward error correction for digital images is proposed and the watermarked image is lossless. Each feature value is generated by its corresponding gray level of the image; subsequently the feature value is XORed with the embedding bits. In the verification process, the watermark bits can be extracted by majority voting without either the original image or the watermark logo. The experimental results show that the proposed method is robust resisting common nongeometric attacks, and is also strong enough to resist the geometric attacks, while
Digital Image Watermarking for Malicious Attack
241
the retrieval watermark logo is still clearly recognizable. The watermarking scheme based on spatial domain is faster than that based on frequency domain since the step of transferring to frequency domain is not needed. In addition to copyright protection, the proposed method can also be applied to image authentication.
References [1] Chen, T.H., Horng, G., Lee, W.B.: A publicly verifiable copyright-proving scheme resistant to malicious attacks. IEEE Trans. Industrial Electron. 52(1), 327–334 (2005) [2] Lou, D.C., Tso, H.K., Liu, J.L.: Robust copyright protection scheme for digital images using the low-band characteristic. Optical Engineering 45(10), 107002–107006 (2006) [3] Haartsen, J.: Bluetooth-The universal radio interface for ad hoc wireless connectivity. Ericsson Review, 110–117 (1998) [4] Petitcolas, F.A.P.: Weakness of existing watermark scheme (1997), http://www.petitcolas.net/fabien/watermarking/stirmark/ index.html
Hierarchical Time-Bound Key Management for Mobile Agents Yu-Fang Chung1, Tzer-Shyong Chen2, Chia-Chao Ho3, Yi-Hsuan Yeh2, and Hsiu-Chia Ko3 1 Department of Electrical Engineering, Tung Hai University Department of Information Management, Tung Hai University 3 Department of Information Management, Chaoyang University of Technology
[email protected] 2
Abstract. The core competencies that a mobile agent possesses are freeroaming between different environment, and autonomous environment detection and adaptation while executing the tasks that are assigned by the users. Because of these competencies, the concept of mobile agent is widely used in many different fields, such as Internet business, wireless communication, and information security technologies and etc. In 1983, Akl and Taylor [1] suggested the concept of superkey to resolve the key management issues faced by the mobile agent. Later in 1998, Volker and Mehrdad [2] proposed a hierarchical mobile agent model for access control. The proposed paper would be based upon the studies of superkey and a hierarchical mobile agent model with addition of elliptic curve cryptosystem (ECC). ECC enhances the mobile agent model, because of shorter key length and higher efficiency on encryption and decryption. All the related works would be presented in Section 2. After the background of our proposal is well described, we would aim to resolve the key management issue created by Volker and Mehrdad’s model. Time-bound key management is considered to be a good solution, because it can make the key management in the existing mobile agent model more convenient by distributing the keys that can only be used in a limited period of time. Keywords: Mobile Agent, Key Management, Access Control, Elliptic Curve Cryptosystem, Time-bound Key Management.
1 Introduction With the popularity of the Internet and widespread use of personal computers in our daily life, the public becomes more aware of the issues on how the data is being securely transmitted. In this paper, mobile agent, which possesses autonomous environment detection and adaptation, is applied and integrated with the hierarchical structure. With the unique characteristic of the hierarchical structure, users will have different encryption keys according to their access rights. The encryption key can ensure that the data will be securely transmitted upon requests. However, when the users under the hierarchical structure decide to log off from the system or switch A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 242–253, 2009. © Springer-Verlag Berlin Heidelberg 2009
Hierarchical Time-Bound Key Management for Mobile Agents
243
the authority level for access. The system needs to void the right of the previously assigned key so as to avoid the key being illegally used to access the data. But, this could cause the system needs to delicate a huge amount of resources for managing these encryption keys. To resolve the issue that is stated above, the paper approaches to apply time-bound key management scheme with the concept associated with mobile agent structure by making the encryption key only valid to be used in the limit period of time. In other words, the users cannot access the data, if the key is no longer valid. Because of this characteristic, the system does not require updating keys continuously. The proposed method aims to enhance the key management of mobile agent structure and make it more efficient. There are many potential risks for accessing the data; hence, the cryptography technologies are needed for protecting the data during the transmission. This paper applies the elliptic curve cryptosystem to generate the keys. The main characteristic of the ECC is that, on the same security level, the key length is shorter and it can provide quicker processing speed and the security also surpasses other public key cryptosystem such as RSA. For instance, the key size of 160 bits in ECC is as secure as the key size of 1024 bits in RSA. Because of the elliptic curve logarithm problem (ECDLP), ECC is able to generate keys with more complexity and greater protection. In addition, the related research of the mobile agent security development is also very important as a part of our proposal in order to understand how to protect the system from being attacked by some malicious and unauthorized users. When the mobile agents are executing their tasks on the network, they may communicate and exchange information with each other. The security issue could rise when there are insecure contacts between the mobile agents [3, 4]. There are four examples of the security threats which the mobile agent may face: [5]: (1) (2) (3) (4)
Unauthorized partner to access the information of the server. The server encounters attack by the other malicious agents. The agent encounters attack by the other agents. The agent encounters attack by the other malicious server.
To avoid the above four security threats, this paper applies Elliptic curve cryptography to enhance the security of the mobile agent and also keep it away from the malicious attacks. This paper can be divided into five sections. Section 1 is the introduction of the research content and structure. Section 2 introduces the concept and the advantage of the mobile agent, then the mathematical background of the elliptic curve cryptosystem and time-bound key management. At the latter part of Section 2, the key management and access control on the mobile agent suggested by Volker and Mehrdad [2] is introduced. In Section 3, the mechanism we proposed in this paper is presented. Furthermore, a security analysis on the proposed mechanism is explained in Section 4. At last, the conclusion of the researched results is given in Section 5. The paper expects bringing more positive improvements on the security mechanism and key management of the mobile agent.
244
Y.-F. Chung et al.
2 The Related Research 2.1 Mobile Agent Mobile agent is the software program that can achieve autonomous execution and operate on an asynchronous network while migrating from the local host to another remote host in a network. In brief, the mobile agent can immediately execute its task after it receives the request from the user. It will reflect the actual situation during the migration and send the result back to the user who makes the request. The migration is not only transferring the agent codes and the responded result, but the status of the program is also transferred. In addition, the mobile agent is capable of analyzing, determining, and executing by it even if the connection with the target server is not constant. What has been described above indicates that the agent program is designed to have the functions of self-management, self-control, and self-resolution, because it can control its behaviors and status and will not be interfere by other systems and users. Technologies on the field of mobile communication and wireless network leaped in the recent years. This change facilitates the mobile agent to become commonly used on programming. Today we not only use mobile agents for data inquiry at a remote environment and distributed computation, but it is also used in network management and workflow system. Advantages of mobile agent are as follows [6]: (1) Reducing network load: a normal distributed system could produce huge traffic flows on the network, because it demands to have multiparty communication protocols to complete its tasks. In contrast, the mobile agent doesn’t require having a constant connection with the target server, because it allows the user to package the commands and send it to the target server. And then, the agent will communicate and interact with the connected server and turn the result back to the user. This would decrease the network load, because this would lower the numbers of connection between the source and the target server. (2) Decreasing network delay time: Mobile agent can transfer the task to the remote server and interact directly with the server. This could replace the previous method of having the constant connection between the source and the target server. Thus, the network delay time can be minimized. (3) Packaging protocol: when using traditional distributed systems, a fixed protocol is needed for data exchange. However, due to heterogeneity of operating systems, each server must set up its own protocol. When mobile agent is migrating to a remote server, its communication protocol can be packaged to migrate and re-establish the situated protocol for a network connection. This resolves the connection issue, which could be caused by the data migration. (4) Adapting to a dynamic environment: Mobile agent is capable of moving around different network environment; therefore, it is able to detect the surrounding environment and autonomously optimize the settings according to its situated environment. (5) Performing non-simultaneous and spontaneous executions: when the cost of internet connection is high and it is not suitable to have a constant connection, mobile agent is helpful to complete the tasks and return the executed result
Hierarchical Time-Bound Key Management for Mobile Agents
245
back in a non-simultaneous manner. This can reduce the connection time and perform non-simultaneous and spontaneous executions. (6) Innate heterogeneity: hardware or software on the internet environment is heterogeneous. Mobile agent can be autonomous to integrate with the connected system without being limited by the issue of heterogeneity. (7) Stability and fault tolerance: Mobile agent can also be used to manage exceptions and this makes it to have a good stability and higher level of fault tolerance. (8) Expandability: Mobile agent structure allows to have greater expandability and flexibility between the source and the target server. 2.2 Elliptic Curve Cryptosystem Elliptic curves have been studied thoroughly in the last 150 years and a huge amount of papers have published on this subject. Elliptic curve cryptosystem (ECC) was initially proposed by Victor Miller [7] and Neal Kblitz [8] in 1985 to enhance public key cryptosystem. It is a good method for the key management of applications that have low system memory and low network bandwidth. The degree of security for ECC relies upon how difficult k is given to kP and P. This can also be defined as the elliptic curve logarithm problem. In order to ensure the difficulty of ECDLP in a certain level, it is critical to pick an appropriate base point P that should have a large order [9]. Elliptic curves over finite fields provide an exhaustible supply of finite abelian groups that are compliant to computation because of their prolific structures. Two families of elliptic curves, prime curves defined over Zp and binary curves constructed over GF(2n), are used in cryptographic applications. In the finite field Zp, an elliptic curve equation is showed as E: y2 = x3 + ax + b, where (a, b) ∈ Zp and 4a3 + 27b2 ≠ 0 (mod p), defined modulo a prime p, and p should be bigger than 3. The condition 4a3 + 27b2 mod p ≠ 0 is necessary to ensure that y2 = x3 + ax + b (mod p) has no repeated factors, which means that a finite abelian group can be defined based on the set Ep (a, b) [10]. The set of elliptic curve points forms a commutative finite group under the rules of addition operation, and it must satisfy the rules below [11, 12]: (1) Sum is O of three points on an elliptic curve lie on a straight line. (2) P+O = P, O serves as the additive identity. Thus O = O, for any point P is on the elliptic curve. (3) If there are two points P1 = (x, y) and P2 = (x, −y), P1+P2=O, where P2 is the negative point of P1. (4) Add two points P and Q, and draw a straight line between them then find the third point of intersection R. Note that P + Q + R = O so P + Q = – R = R. (5) Multiplication by an integer is defined by repeated addition, for example, 2P= P+P. For any two points P = (xp, yp) and Q = (xq, yq) over Ep(a, b), the elliptic curve addition operation, which is denoted as P + Q = R = (xr, yr), satisfies the following rules.
xr = (λ2 − x p − xq ) mod p y r = (λ ( x p − x r ) − y p ) mod p
246
Y.-F. Chung et al.
Where λ is given as shown below.
⎧⎛ y q − y p ⎞ ⎟ mod p, if P ≠ Q ⎪⎜⎜ ⎪⎝ x q − x p ⎟⎠ λ=⎨ 2 ⎪ ⎛⎜ 3x p + a ⎞⎟ mod p, if P = Q ⎪⎜ 2 y p ⎟ ⎠ ⎩⎝ As we can see there is a point multiplication on the elliptic curve, the point multiplication does not really mean we multiply one point by another to get the coordinate value. By using the equation, Q= k×P, we can obtain a point on the curve. By assuming k is a natural number and Q and P are points which are on E, Q can be defined as P+P+…+P in k times. The security of EEC in the finite field is based on double-andadd algorithm, Q= k×P. Therefore, it is difficult to compute the result of k, even though the numbers of Q and P are known. This can be understood as the puzzle created by Elliptic Curve Cryptography and is denoted as elliptic curve discrete logarithm problem (ECDLP) [13]. 2.3 Overview of Time-Bound Hierarchical Key Assignment Scheme With the purpose of solving the collusion attach that is posted by Chien’s [14] scheme, Bertion et al in 2008 [15] proposed time-bound hierarchical key assignment scheme. It can be divided into four phases: (1) Initialization phase: In this phase, all system parameters must be initialized. After the system class key Ki is generated, the vendor, which is a system administrator, would select an elliptic curve E over a finite field to solve ECDLP. And then, the vendor computes other system parameters separately. The class keys Ki=giPi for the target class is created. Next, two random integers, a and b, are chosen by the vendor to build up a harsh message authentication code (HMAC). When the relationship of Cj ≤ Ci is denoted, the point Ri,j on the elliptic curve must be published on an authentication board and other parameters remain secret. (2) Encrypting Key Generation phase: Temporal encryption class keys Ki,t would be generated in this phase. The encryption key itself is only permitted to use the system class key Ki in a limited period of time. (3) User subscription phase: The important information that is issued to the subscribers is stored in a tamper-resistant device. When receiving a subscription request, an appropriate access control policy acpi would continue its search until everything is correctly matched. Finally, the class key Ki is given to the subscriber through a secure channel. The vendor would provide a tamper-resistant device that has a securely embedded clock to the subscriber. (4) Decrypting key derivation phase: When the subscriber who is associated with class Ci would like to decrypt the protected data in class Cj, which matches with the relationship of Cj ≤ Ci, the subscriber’s tamper-resistant device would reconstruct a temporal key for access.
Hierarchical Time-Bound Key Management for Mobile Agents
247
2.4 Overview of Volker and Mehrdad’s Scheme Volker and Mehrdad proposed a security scheme [2], which is based upon a tree structure, to design a secure environment for mobile agents. The proposed scheme is shown as in Fig. 1. The mobile agent structure can be broken into two main branches: static and mutable.
Fig. 1. Framework of mobile agent based on tree structure
(1) Static branch: the static branch of the agent stores all of the permanent information that would not change during the agent’s lifetime. The information includes security policy, group classification, certificates, and access control keys. Moreover, the digital signature is required in order to prevent the information being tampered by malicious users. (2) Mutable branch: this branch sets to keep all modified information that is gathered by a mobile agent. For instance, the status or information collected by the agent could be modified by the visited hosts on the network. Fig. 2 is used to illustrate Volker and Mehrdad’s agent structure. This figure simply shows the process of how the static branch functions. On the left side of it, there are four zipped files. The agent.zip is not encrypted, but the rest of files use DK1, DK2, and DK3 correspondingly for encryption. On the right side, the nodes of S1, S2, and S3 each represent different servers under access control keys. If these servers are authorized to access the specified files, the decryption keys will be copied to the
248
Y.-F. Chung et al.
Fig. 2. An example of Volker and Mehrdad’s access control and key management
corresponding server folders. For example, S1 is granted to access all the encrypted files; thus, the keys (DK1/DK2/DK3) will be copied to the folder of S1. Based upon the figure’s decryption, S2 is only allowed to access two out of three encrypted files, which are retrieval.zip and control.zip. The folder of S2 will only have the keys of DK2 and DK3. Finally, S3 is permitted to access the first encrypted zipped file, and then it will just have k1 for accessing the designated file. Volker and Mehrdad’s scheme has the issues yet to be discussed: (1) A large amount of storage space required inside the mobile agent for storing the generated keys: Upon this scheme, a decryption key can be duplicated to different servers. As shown in Fig. 2, S1 and S2 both have DK2. Consequently, DK2 would be continuously duplicated as the number of server increases. This causes the waste of the storage space and makes the mobile agent become cumbersome. (2) Excessive computation on public key generation: Because the decryption keys are repetitively stored under the folder of static/sctx/acl/, the mobile agent user must use more resource and time to compute the public key encryption in order to ensure the security of the folder.
3 Research Method Akl and Taylor recommended an access control scheme [1], which is based upon a hierarchical structure model, in 1983. They proposed that each user would be
Hierarchical Time-Bound Key Management for Mobile Agents
249
assigned to a security group, which can be represented as C = {C1, C2, C3, …Cm}. On the basis of a hierarchical structure, this sort of access relationship between one security group and another can be denoted by Ci ≥ Cj. For instance, group of Ci is at a higher level of the hierarchy than Cj when the relationship of Ci ≥ Cj is declared. This means user of Ci has a greater authority to access the information that is only available to Cj. If the hierarchy network becomes larger, Ci would have to store a lot of decryption keys that are holded by the groups at a lower hierarchy. Fig. 3 helps to understand how leaf nodes of DKj function in a hierarchical structure. DKj is the decryption key for encrypted files; Si is the internal node and also represents as a host. And Ni means the superkey that is possessed by the host. When Si has permission to access some encrypted files, it can obtain decryption keys from their corresponding leaf nodes. In Fig. 3, the root node, S1, has the superkey of N1 that has authority of accessing all the encrypted files. In case of S3, it is only authorized to obtain the decryption keys of DK2, DK3 and DK4.
Fig. 3. Structure of decryption keys for mobile agent
Before the mobile agent is linked to the Internet to execute its assignments, user of a mobile agent must decide which host would be visit by the mobile agent and determine the kind of information can be accessed on the visited host. Next, the user will randomly select DKj to encrypt the confidential file. Afterward, he will construct an accessible network in relation to his access policy and gives a heterogeneous superkey to every internal node. This superkey is encrypted by the public key of the host. The host can use its private key to decrypt the superkey when the mobile agent visited it. After the superkey is decrypted, the confidential file can be retrieved. In order to make access control on a hierarchical structure more effectively, the concept of timebound control will be introduced. The main point is to set up a scheme that allows the user who can only exercise the decryption keys at a predetermined time lot. In the
250
Y.-F. Chung et al.
incorrect time lot, the decryption key holder will be not able to use the key to access the file. Mobile agent can construct the accessible network through the following steps. Step 1
:Determined an elliptic curve E (a, b), and it can be represented as y = x + 2
3
p
3
2
ax + b (mod p). In this case, a and b should satisfy 4a + 27b ≠ 0 (mod p) and p is a large prime number. Step 2 Chose a base point G = (x, y) on Ep (a, b). Step 3 The user of the mobile agent chooses a superkey Ni, which is unrepeatable, to the corresponded internal nodes of each host. Step 4 Set parameters Pi and Pj which represents Ni and Nj, respectively, as below.
: : :
Step 5
Pi = N iG Pj = N j G
(1) (2)
:Distributed a specific DK to each leaf node as a decryption key to encrypt j
or decrypt the confidential file.
3.1 Encryption Phase Construct a polynomial FDK j (x ) , which must include the public parameters, of each leaf node and proclaim
FDK j (x) publically.
FDK j ( x) =
∏[ x − ( N P )
j i X
] + DK j
(3)
S j ≤Si
3.2 Decryption Phase A certain host Si tries to access its authorized leaf node DKj, and because Sj ≤ Si, the mobile agent can derive the decryption DKj key by using superkey Ni and the public parameter Pj host Si, as below.
FDK j (( N i Pj ) X ) =
∏[( N P ) i
j X
− ( N j Pi ) X ] + DK j
(4)
S j ≤ Si
3.3 Time-Bound Phase (1) Set [0, Z] as the interval of the system life. (2) Set ta, tb and t, which represent the service for the user between the time of ta and tb, and t is the present time of the user. The relation can be represented as 0 ≤ ta ≤ t ≤ tb ≤ Z. (3) Choose integers p, q, HMAC randomly. HMAC is consisted of the private key fixed by the system and the one-way hash function. (4) An one-way hash function should satisfy the conditions below: I. Any length of the file message can produce a fixed length H(x). II. Give y randomly without finding the correspondent x h(x) = y, representing one-way.
:
Hierarchical Time-Bound Key Management for Mobile Agents
251
III. Give a message digest x, and make it hard to find another x’, resulting H(x)=H(x’). (5) Choose integers p and q randomly and hash function, hash function and DKj using exclusive-OR to produce the time-bound encrypt key K t , DK j .
K t , DK j = H K ( H t ( p) ⊕ H Z − t (q) ⊕ DK j )
(5)
(6) Use the formula:
Applied
H t ( p ) = H t −ta ( H ta ( p ))
(6)
H Z −t ( q) = H tb−t ( H Z −tb ( q))
(7)
H t ( p) and H Z −t (q ) into H K again to verify if the decryption key
K t , DK j is the same.
K t , DK j = H K ( H t − ta ( H ta ( p)) ⊕ H tb − t ( H Z −tb (q)) ⊕ DK j )
(8)
4 Security Analysis In this section, a security analysis is performed to examine whether the proposed scheme is secure or not for practical applications. The analysis aims is focused upon four types of attack that may impact on the system security. (1) Reverse Attack Reverse attack can be defined as follows. When the relationship of Sm ≤ Si exists between the internal nodes Sm and Si or they are at the same hierarchical level, the host Sm could try using its superkey Nm to derive Si’s superkey Ni with the intention of stealing the data only accessible by Si. On a disjoint-entity hierarchy, any two internal nodes can be seen as the independent units. For example, Sm is not authorized to access the data only available to Si. Because the function Pi=NiG with ECDLP is not easy to be solved, Sm’s reverse attack would fail. Therefore, the lower level host can never derive the superkey of the upper level one if it does not have sufficient information to answer the equation. (2) Collusion Attack Collusion attack means that the subordinate hosts work together to steal the information only accessible by the upper-level host in an accessible network. In the case of Fig. 3, the hosts S5 and S6 decides to work against S1 by using the obtained information to steal S1’s superkey. However, this kind of attack would fail, because ECDLP would make the superkey difficult to become decoded. Another type of collusion attack is to have upper-level hosts collude to steal the information from the host, which is not subordinated to them. However, the attack would not succeed, because the upper-level host information is not embedded in the structure of leaf nodes that is only accessible to lower-level host.
252
Y.-F. Chung et al.
(3) External Collective Attack The intruder attempts obtaining the superkey of the internal node to steal or modifying the protected data by hacking into the published system parameters. This is identified as external collective attack. However, it is impossible for the intruder to succeed, because ECC-based structure could prevent it from happening. (4) Equation Breaking Attack If a host attempts to steal the decryption key that is commonly owned by other servers, it can be accomplished by hacking into the published equation F. This is called equation breaking attack. For instance, the hosts Si and Sj both have access right to DKj. It is possible that the host Si could hack into the equation of FDK j ( x ) to obtain Sj’s superkey Nj.
5 Conclusion Mobile agent is to be in the ascendant in today’s advanced internet environment. Let mobile agent use network resources well, and it will be helpful to improve the organizations more efficient and reduce their costs. However, security problems and threats on mobile agent is also a challenging research subject. To take steps to minimize the security problems is a main purpose for mobile agent. Therefore, we need a complete mobile agent security system structure. In this paper, the security needs and threats for the mobile agent have been identified. Moreover, the security schemes that are used in mobile agent architecture and other related studies are applied to understand what can be done to make the key management and access control more efficient and convenient for the mobile agent. By utilizing elliptic curve cryptosystem and time-bound key management scheme, the mobile agent can become efficient by means of having keys only be used within a limited period of time, less space needed for key storage, and less computation used for key generation. Finally, the conclusion hinges on the security analysis we conducted. The result shows that the proposed scheme is feasible and accountable. Thus, it is competent on meeting the requirement for protecting the transmitted data on the mobile agent platform.
Acknowledgement This work was supported partially by National Science Council of Republic of China under Grants NSC 97-2221-E-029-015.
References 1. Akl, S.G., Taylor, P.D.: Cryptographic solution to a problem of access control in a hierarchy. ACM Transactions on Computer Systems 1(3), 239–248 (1983) 2. Volker, R., Mehrdad, J.S.: Access control and key management for mobile agents. Computer Graphics 22(4), 457–461 (1998)
Hierarchical Time-Bound Key Management for Mobile Agents
253
3. Karmouch, A.: Mobile Software Agents for Telecommunications, Guest Editorial. IEEE Communications Magazine 36(7), 24–25 (1998) 4. Lin, I.C., Ou, H.H., Hwang, M.S.: Efficient access control and key management schemes for mobile agents. Computer Standards & Interfaces 26(5), 423–433 (2004) 5. Hohl, F.: A model of attacks malicious hosts against mobile agents. In: Proceedings of the 4th Workshop on Mobile Object Systems: Secure Internet Mobile Computations, Brussels, Belgium, pp. 105–120 (1998) 6. Lange, D.B., Oshima, M.: Programming and Deploying Java Mobile Agents with Aglets. Addison-Wesley Press, Massachusetts (1998) 7. Miller, V.S.: Use of Elliptic Curves in Cryptography. In: Williams, H.C. (ed.) CRYPTO 1985. LNCS, vol. 218, pp. 417–426. Springer, Heidelberg (1986) 8. Koblitz, N.: Elliptic Curve Cryptosystems. Mathematics of Computation 48(177), 203–209 (1987) 9. Aydin, M.A., Aydin, G.Z.: A Survey of Elliptic Curve Cryptography 6(2), 211–221 (2006) 10. Huang, K.H., Chung, Y.F., Liu, C.H., Lai, F., Chen, T.S.: Efficient migration for mobile computing in distributed networks,Computer Standards & Interfaces (2007) (in press) 11. Shieh, C.W.: An Efficient Design Of Elliptic Curve Cryptography Processor, Master’s Thesis, Tatung University, Taipei (2006) 12. Wu, S.T.: Authentication and Group Secure Communications Using Elliptic Curve Cryptography, Doctoral Dissertation, National Taiwan University of Science and Technology, Taipei (2005) 13. Guan, D.J., Jen, L.h.: Study and Implementation of Elliptic Curve Cryptosystem, Master’s Thesis, National Sun Yat-sen University of Technology, Kaohsiung (2005) 14. Chien, H.Y.: Efficient Time-Bound Hierarchical Key Assignment Scheme. IEEE Trans. Knowledge and Data Eng. 16(10), 1301–1304 (2004) 15. Bertino, E., Shang, N., Wagstaff, S.S.: An Efficient Time-Bound Hierarchical Key Management Scheme for Secure Broadcasting. IEEE Trans. Actions on Dependable and Secure Computing 5(2), 65–70 (2008)
Key Tree and Chinese Remainder Theorem Based Group Key Distribution Scheme Jie Zhou and Yong-hao Ou School of Computer Science & Engineering, South China University of Technology, Guangzhou Higher Education Mega Centre, Panyu District, Guangzhou, 510006, P.R. China
Abstract. A group key distribution scheme based on static key tree structure and the Chinese Remainder Theorem (KTCRT-GKD) is proposed. It deal with the scenario of a pre-defined static prospective user set U containing all potential customs of multicast services and concentrate on the stateless receiver case. Given a privileged group member set G ⊆ U consisting of authorized users in a multicast session, a set of subtrees of the user tree whose leaves just host all the privileged group members is called group member subtrees. We design an algorithm to compute the root IDs of group member subtrees. The key server uses the root keys of the group member subtrees and the Chinese Remainder Theorem to distribute a group key. It can reduce the key server’s computation complexity for each group key distribution. Especially, an interesting feature is that, when the size of group members exceeds a certain number, the computing time of the key server will decrease with the increase of the size of the group members. Keywords: Group Key Distribution Scheme, Key tree, Group member subtree, root ID algorithm, Chinese Remainder Theorem.
1 Introduction Multicast communication which can reduces sender-processing overhead and network bandwidth usage is becoming the basis for a growing number of group-oriented applications, such as video conferencing, interactive group games, video on demand, TV over Internet, e-learning, software updates, database replication and broadcasting stock quotes[1,2]. Ensuring the confidentiality of multicast contents is an important problem for many group-oriented applications. The privacy of a multicast communication session is usually ensured using cryptographic mechanism. All the authorized group members in a multicast group share a common key, called group key, to encrypt and decrypt messages which communicate among group members. Group membership might be dynamic in many applications, i.e., some new members are authorized to join a new multicast session while some old members should be excluded. The group key has to be updated and redistributed securely to all authorized members whenever there is a change in the membership in order to ensure both forward and backward secrecy. Forward secrecy means that an excluded member cannot obtain information about future group communication and backward secrecy means that a joining member A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 254–265, 2009. © Springer-Verlag Berlin Heidelberg 2009
Key Tree and Chinese Remainder Theorem Based Group Key Distribution Scheme
255
cannot obtain information about past group communication. An efficient and scalable way for distributing a group key to the eligible members is crucial to multicast communication confidentiality[1,2,3,4,5]. For many group-oriented applications system, such as video conferencing system, e-learning system, database replication system or video on demand system, one can pre-defined a static prospective user set U containing all potential customs of multicast services. The group member set in a multicast session is a subset of privileged users of U . Throughout we differentiate group members from users: the user granted access to a multicast session become a group member. In this paper we focus on group key management and distribution methods. The infrastructure of our model involves a key server and a pre-defined static prospective user set U = {U1 ,U 2 ," ,U n } , where n = d h , and d and h are nonnegative integers. The key server assigns each user a user ID from the set {1, 2," , n} . For user U i , the subscript indicates its user ID. We concentrate on the stateless receiver case, where the users in U are given a distinct key set which does not change through the lifetime of the system. We propose a group key distribution scheme based on the static key tree structure and the Chinese Remainder Theorem (KTCRT-GKD). The result of the comparison analysis shows that our scheme can reduce the key server’s computation complexity for each group key distribution. Especially, an interesting feature of our scheme is that, when the size of group members exceeds a certain number, the computing time of the key server and communication overhead will decrease with the increase of the size of group members. The rest of this paper is organized as follows. Section 2 provides a brief review of related work. Section 3 defines the concept of user tree, group number subtree and group member subset, and describes the root ID algorithm. Section 4 describes our group key distribution scheme using key tree and Chinese remainder theorem. Security and performance analysis are given in Section 5. Section 6 summarizes our conclusions.
2 Related Work The group key distribution problem has been studied extensively in the larger context of key management for secure group communications, and a variety of group key management protocols have been proposed[1,2]. Among them are centralized group key management protocols based on certain hierarchical structure. The characteristic of these kinds of schemes is that a key server undertakes all the key management tasks. Namely, it is responsible for generating, distributing and updating the group key [6,7,9,10]. The most common approach for centralized group key management is Logical Key Hierarchy (LKH) (or Key Graph) which was independently discovered by Wong et al.[6] and Wallner et al.[7] and has been an inspiration for many subsequent works[1, 2, 11, 12, 13] . The general LKH scheme is a tree-based group key management algorithm. The key server maintains a tree of keys, which is called LKH tree. The key held by the root of the LKH tree is the group key. While the other nodes of the LKH tree hold key
256
J. Zhou and Y.H. Ou
encryption keys (KEKs). The leaves of the tree correspond to group members and each leaf holds a KEK associated with that one member. Each member receives from the key server and maintains a copy of the KEKs and the group key corresponding to each node in the path from its leaf to the root. When a member joins the group, the key server needs to change every key corresponding to each node in the path from the new member’s leaf to the root, and when a member leaves the group, the key server changes the keys that the leaving member knows. A member which have left rejoin the group must be given new KEKs different from the formers. The cost of updating the keys is proportional to the height of the node in the key tree to be added or deleted. Therefore, to reduce the group key management cost it is need to reduce the average height of a node to be added or deleted, which means a group key management algorithm based on LKH scheme should address the issue of key tree balancing. Several papers have dealt with LKH tree-balancing techniques [4,8]. For a group of n members, balanced key tree based schemes have a communication complexity of O(logn), and storage complexity of O(n) for the key server and O(logn) for each group member. The overhead of balancing the key tree whenever there is a change in the membership also can not be ignored. In [14], the authors introduce two centralized group key management protocols based on the Chinese Remainder Theorem(Chinese Remaindering Group Key (CRGK) and Fast Chinese Remaindering Group Key (FCRGK)). By shifting more computing load onto the key server, they optimize the number of broadcast message for distributing the group key, user-side key computation and number of key storages. The protocols require the key server to compute the solution of the Chinese Remainder Theorem and broadcast one message for distributing the group key and each group member to compute only one modulo arithmetic and one XOR operation for each key update and store only two keys all the time. With the advantage on key updating broadcasting message number, user key computation, user key storage, the protocols require more computation power from the key server. In 1988, Lu, et al.[15, 16] proposed a group key distribution system based on the Diffie and Hellman’s public key distribution system and the Lagrange interpolating polynomial. Each time when there is a change in the membership, a Lagrange interpolating polynomial of degree n (the number of group members) has to be constructed by a sponsor of the multicast communication using the group key chosen by the sponsor randomly and the public keys of group members. Every group member must evaluate the Lagrange interpolating polynomial using its private key to obtain the new group key. The disadvantage of it is the computation complexity of sponsor and group members for distributing group keys. Broadcast encryption which was first considered in [17] and, subsequently, formally defined and studied in [18] is the cryptographic problem of enabling a center to distribute keys and broadcast a message in a secure way over an insecure channel to an arbitrary subset of privileged users in a pre-defined prospective user set. It can be actually viewed as revocation schemes[19,20] and one of the most challenging settings for broadcast encryption schemes is that of stateless receivers, where each user is given a fixed set of keys which cannot be updated through the lifetime of the system. One of the major problems in broadcast encryption is key distribution[21]. The group key distribution schemes concerning broadcast encryption assume a static user set U and focus on efficient methods of enabling an authorized subgroup of U to compute a
Key Tree and Chinese Remainder Theorem Based Group Key Distribution Scheme
257
shared key. Various broadcast encryption key distribution schemes have been designed[19-22]. The computational and communication overhead introduced by these schemes are proportional to the number of privileged users. Obviously, when the number of entitled users is large, these methods yield large computation and communication overhead.
3 Group Member Subtree 3.1 User Tree
We first introduce some concepts. A complete d-ary tree is a rooted tree in which all leaves have same depth and all internal nodes have d children. The total number of nodes of a complete d-ary tree is 1 + d + " + d h = ( d h + 1 − 1) /( d − 1) and the number of leaves is d h , where d and h are nonnegative integers and h is the height of the tree. In the case of h=0, a complete d-ary tree becomes a trivial tree consisting of a single node. Given a complete d-ary tree T, the subtree T ′ generated by a node v of T and all its descendants (if exist) is said to be a complete d-ary subtree rooted at v. Clearly T ′ is also a complete d-ary tree. Let T be a complete d-ary tree with n leaves, where n = d h . To uniquely identify each key associated with a node, the key server assigns a node ID to each node. The assignment of the node ID is based on top-down and left-right order with increment of one. The root has the lowest node ID, which is 0, and the ith leaf from the left has node ID d + " + d h − 1 + i , i = 1, 2 , " , n . The key server associates each user of a prospective user set U = {U 1 , U 2 , " , U n } with a leaf of T. In this paper, we require that user U i with user ID i is hosted by the leaf d + " + d h − 1 + i , i = 1 , 2 , " , n . We call such a tree T a user tree. Figure 1 shows an example of a user tree with n = 8 leaves and d=2, l=3.
Fig. 1. A user tree
3.2 Group Member Subtree and Group Member Subset
Consider a complete d-ary tree T, let P = n h n h −1 " n1 n 0 is a path of T from a leaf nh to the root n0 , where ni ( i = 0,1, " , h ) is node ID and n0
= 0 . Removing the
258
J. Zhou and Y.H. Ou
root 0 and all its incident edges from T , we are left with d complete d-ary subtrees, and the root of one of them, say T1 , is n1 . Farther, if n1 isn’t a leaf of T , then removing the node n1 and all its incident edges from T1 yields new d complete d-ary subtrees of T . Continue this process until all the nodes of P are removed, the remaining connected components are all complete d-ary subtrees of T . Applying the above process to multiple paths, we have the following property: Property. Let T be a complete d-ary tree. Remove the nodes on paths from some leaves to the root and all the incident edges from T, the remaining connected components consist of a set of complete d-ary subtrees of T. Let G = {U i1 , U i2 ," , U im } be a group member set consisting of authorized (e.g., paid)
users of U in a multicast session. The users of {U 1 , U 2 , " , U n } − {U i1 , U i2 , " , U im } are regarded as revoked. The above property implies that, by removing all the nodes on the paths from the leaves hosting the revoked users to the root from the user tree T , the remaining connected components are complete d-ary subtrees of T whose leaves just host all the group members of G . In other words, given a group member set G = {U i1 , U i2 ," , U im } , there exists a minimum node set N of the user tree T such that any leaf hosting a group member of G is a leaf of a complete d-ary subtree rooted at one node of N and each user hosted by a leaf of one of this kinds of subtrees is a member of G . We call each such complete d-ary subtree a group member subtree. The set of group members hosted by all the leaves of a group member subtree is called a group member subset. For example, in Figure 1, the set of group members is {U 1 , U 2 , U 3 , U 4 , U 5 , U 8 } and the group member subtrees are those consist of all the shadow nodes. There are three group member subtrees and the root set is N = {1,1 1,1 4} . The group member subtree rooted at node 1 corresponding the group member subset {U 1 , U 2 , U 3 , U 4 } . 3.3 Root ID Algorithm
In the subsection we present an algorithm for finding the root IDs of group member subtrees of a given group member set in the user tree T. The algorithm is called root ID algorithm. Given a group member set G = {U i1 , U i2 , " , U im } ⊂ U , the key server computes the leaf IDs hosting the group members by their IDs. Then he can use the root ID algorithm to compute all the root IDs of group member subtrees. In the Algorithm, the node IDs examined by the algorithm are stored in a single-linked list Node. The nodes of Node are initialized with the leaf IDs hosting the group members by increasing order. The root IDs of group member subtrees are stored in a single-linked list Forest.
Key Tree and Chinese Remainder Theorem Based Group Key Distribution Scheme
259
root ID algorithm // the user tree T is represented as The Parent Pointer Implementation and each node of T contains the node ID and a reference pointing to its parent node. Forest: single-linked list, the data field of each node stores the root ID of a group member subtree. The list is initialized to be empty; Node: single-linked list, the data field of each node stores the node ID of user tree T. The list is initialized with the leaf IDs hosting the group members by increasing order; d: the number of children of inner node in the user tree; While ( the number of nodes of Node > = d ) do Begin find the parent node IDs of nodes of T corresponding to the first d nodes from the head of Node; if (the parent node IDs are the same, say I ) then Begin add a node onto the end of Node and set the data field to be I; delete the first d nodes of Node and release the space; End Else Begin add a new node onto the end of Forest and set the data field to be the value of the first node data field of Node; delete the first node of Node, and release the space; End End add as many nodes onto the end of Forest as the left nodes of Node and set the data fields to be the value of the left node data field of Node; delete all the nodes of Node and release the space; The data of each node of Forest is a root ID of a group member subtree. If the nodes of T corresponding to a nodes of Forest is a leaf, then the group member hosted by the leaf constitute a group member subset alone; If the nodes of T corresponding to a nodes of Forest is a non-leaf node of T, then the group members hosted by the leaves of subtree rooted at the node constitute a group member subset. The algorithm examines all the leaves hosted the group members, therefore the items of Forest contain all the root IDs of group member subtrees of G .
4 Group Key Distribution Scheme Using Key Tree and Chinese Remainder Theorem In this section we introduce a group key distribution scheme based on key tree and Chinese remainder theorem (KTCRT-GKD).
260
J. Zhou and Y.H. Ou
4.1 Key Tree
In the setup phase, the key server construct the user tree T with n = d l leaves, choose an integer ki for each node i of user tree T as the private key of that node ( 0 ≤ i < ( d l +1 − 1) /( d − 1) ). The private key ID is the same as its associated node ID. In the scheme, we require that all the private keys of nodes of user tree T are pairwise relatively prime positive integers. For the purpose, like in [14], the key server pick these private keys from a pool of pairwise relatively prime positive integers and the size of the private keys should be much larger than the size of group keys need to generate. The user tree T in which each node associated with a private key is called a key tree. The private keys associated with the nodes on the path from leaf d + " + d l −1 + j hosting user U j to the root is called private key set of U j . The key server send every private key and its ID of the private key set of U j to U j ( 1 ≤ j ≤ n ) using some secured channel, for instance using public key system or smart card. In the key tree T, the private key k i associated with node i is known by the users
hosted by leaves of the subtree rooted at node i . The private key associated with leaf node d + " + d l −1 + j is known only by the user U j , we call it the private key of U j . For example, in Figure 2, the private key set of U 1 is { k 0 , k 1 , k 3 , k 7 } . The private key k1 associated with node 1is known by the users {U 1 , U 2 , U 3 , U 4 } hosted by leaves of subtree rooted at node 1. The private key of U 1 is k7 .
Fig. 2. A key tree with each node associates a private key
4.2 Group Key Distribution
In a multicast communication session, let the group member set is the user set G = {U i1 , U i2 ," , U im } . In the beginning of multicast communication session, the key server computes the leaf IDs hosting the group members: the leaf ID hosting the group member U i j is d + d 2 + " + d l − 1 + i j , j = 1, 2 , " , m . The key server runs the root ID algorithm to compute the root IDs of all group member subtrees of group member set G .
Key Tree and Chinese Remainder Theorem Based Group Key Distribution Scheme
261
If the single-linked list Forest contained just one item after running the root ID algorithm, then there has only one group member subtree corresponding to the group member set G , which means all the group members consist of one group member subset. In the case, the private key, say ks ( s ∈ {1, 2," , n} ), of the root of the group member subtree is shared by key server and all the group members. Therefore the private key ks can be used as the group key. The key server broadcast the private key ID, s , to all users in plaintext. When a group member receives the key ID, he determine the group key in his private key set. The users which are not the group member can not find the group key. If the single-linked list Forest contained l ( l ≥ 2 ) items after running the root ID algorithm, then there have l group member subtrees. Suppose the data of the l ( l ≥ 2 ) items are j1 , j2 ," , jl , then all the group members form l group member subsets and
k j , k j ,", k j are the private keys of roots of group member subtrees. 1
2
l
The key server picks a group key k randomly different from all the node private keys of the user tree, compute u js which is the value of the corresponding bits of
k ⊕ k js for 1 ≤ s ≤ l [14], and then build the following congruence system.
x ≡ u j (mod k j ) 1
1
x ≡ u j (mod k j ) 2
2
"""" x ≡ u j (mod k j ) l
l
The above congruence system meets the requirement of a Chinese Remainder Theol
rem congruence system. Therefore it has a unique solution modulo M = ∏ k js . To s =1
compute the unique solution X the key server can do l
X = (∑ u j M j M 'j ) mod M s =1
s
s
s
where M js = M / k js , M ′js is the multiplicative inverse of M js mod k js , i.e. M js M ′js ≡ 1mod k js , s = 1, 2," , l . After the X value is computed the key server broadcast j1 , j2 ," , jl and X value to all users in plaintext. After receiving the broadcast message containing j1 , j2 ," , jl and X , each user checks his private key set to find if he has a private key which ID is one of j1 , j2 ," , jl . If a user have such a private key, then the user is a group member, otherwise he is an avoided user of the multicast session. Like in [14], any of the group member in {U i1 ,U i2 ,",U im } can compute the group key k by simply do 1 modulo and 1 XOR operations (k is equal to the corresponding bits of ( X mod k js ) ⊕ k js , s = 1, 2," , l ). After these simple computations the group member now share the same
262
J. Zhou and Y.H. Ou
group key k and any outside user can not compute the shared group key k without any of the secret information k j1 , k j2 ," , k jl .
5 Security Analysis and Performance Evaluation 5.1 Security Analysis
The security of our KTCRT-GKD scheme is based on the assumption that the key server will keep all the private keys secret and each user will keep its private key set secret. The assumptions ensure that a user in (or outside) the system must not be able to guess any private keys not permitted directly from the key IDs. We prove that our scheme can preserve the forward secrecy and the backward secrecy. For this purpose, we assume that the current group member set is G and the group key is k . Whenever there is a change in the membership due to join of some authorized users or/and exclude of some old members, the new group member set is G ′ and the new group key is k ′ . The key server uses the leaves holding the group members of G ( G ′ )to compute the root IDs of group member subtrees by the root ID algorithm for distributing the group key k ( k ′ ). By the algorithm, the leaves holding the members of G − G ′ (the excluded members) must not belong to any group member subtrees of G ′ , which means that each member of G − G ′ do not know the private keys of the roots of group member subtrees of G ′ . Hence any group members of G − G ′ can not compute the group key k ′ . Similarly, the leaves holding the members of G ′ − G (the joining members) must not belong to any group member subtrees of G , which means that each member of G ′ − G do not know the private keys of the roots of group member subtrees of G . Hence any group members of G ′ − G can not compute the group key k . For the security of group key management scheme based on the Chinese Remainder Theorem, one can refer to the references [14], we omit the details here. 5.2 Performance Analysis
Like in [14], our KTCRT-GKD scheme shifts more computing load onto the key server, optimize the number of broadcast messages and user-side key computation. Furthermore, we also focus on reducing the key server’s computation complexity with a slight increase on the storage overhead at the side of the key server (need to storage 2n − 1 keys) and the users (need to storage h = log nd keys). In KTCRT-GKD scheme, each time when a key sever distribute a group key, he first computes the root IDs of group member subtrees of the group member set using the root ID algorithm. Figure 3 shows the computation time of the root ID algorithm with different kinds of user trees and different group member size. It is shows that, the computation time of the algorithm can be neglected in the group key distribution procedure. Thus, the computation time of the key server for distributing a group key mainly consists of the constructions of the congruence system solution of the Chinese Remainder Theorem.
Key Tree and Chinese Remainder Theorem Based Group Key Distribution Scheme
d=2,h=14,n=16384
263
d=4,h=7,n=16384
d=5,h=6,n=15625
6 ) s4 m ( e2 m i t 0 2000 4000 6000 8000 10000 12000 14000 16000 number of group members
Fig. 3. The computation time of root ID algorithm
Figure 4 depicts the computation time of the CRGK Protocol[14] and our KTCRTGKD scheme. In the test, all the keys are 64-bit integers. In the CRGK Protocol the key server uses all the group member’s private keys to compute the unique congruence system solution X of the Chinese Remainder Theorem for distributing a group key, while, in our KTCRT-GKD scheme, the key server uses the root keys of the group member subtrees to compute X . Therefore, compared with the CRGK Protocol, our KTCRT-GKD scheme can reduce the key server’s computation complexity for distribution a group key. CRGK
KTCRT-GKD(d=2,h=14)
KTCRT-GKD(d=4,h=7)
KTCRT-GKD(d=5,h=6)
80
time (s)
60 40 20 0 2000
4000
6000
8000
10000
12000
14000
16000
num ber of group m em bers
Fig. 4. Computing time of the key server
By Figure 4, when the size of group members exceeds a certain number, with the increase of the size of group members, there will be more group member come into the same group member subgroup and the number of group member subtree will decrease. Therefore, the computing time of the key server and the message length broadcasted will decrease with the increase of the size of group members.
6 Conclusion For many group-oriented applications system, one can pre-defined a static prospective user set containing all potential customs of multicast services. The group member set
264
J. Zhou and Y.H. Ou
in a multicast session is a subset of privileged users of the user set. In this paper, We deal with the scenario of a pre-defined static prospective user set containing all potential customs of multicast services and concentrate on the stateless receiver case, where the users are given a distinct key set which may not change through the system lifetime. We propose a group key distribution schemes based on static key tree structure and the Chinese Remainder Theorem. Compared with the previous related scheme ours can optimize the number of multicast messages and reduce the key server’s computation complexity for distribution group key. Especially, an interesting feature of our scheme is that, when the size of group members exceeds a certain number, the computing time of the key server and communication overhead will decrease with the increase of the size of group members. The property indicates that our schemes suit the cases where the group members are dense in the user set.
References 1. Challal, Y., Seba, H.: Group Key Management Protocols: A Novel Taxonomy. International Journal of Information Technology 2(1), 105–118 (2005) 2. Rafaeli, S., Hutchison, D.: A survey of key management for secure group communication. ACM Computing Surveys 35(3), 309–329 (2003) 3. Juang, W.S., Wu, J.C.: An Efficient and Flexible Decentralized Multicast Key Distribution Scheme. International Journal of Computer Science and Network Security 6(8B), 141–150 (2006) 4. Ng, W.H.D., Howarth, M., Sun, Z., Cruickshank, H.: Dynamic Balanced Key Tree Management for Secure Multicast Communications. IEEE Transactions on Computers 56(5), 590–605 (2007) 5. Xu, L., Huang, C.: Computation Efficient Multicast Key Distribution. IEEE Transactions on Parallel and Distributed Systems 19(5), 577–587 (2008) 6. Wong, C.K., Gouda, M., Lam, S.S.: Secure Group Communications Using Key Graphs. IEEE/ACM Transactions on Networking 8(1), 16–30 (2000) 7. Wallner, D., Harder, E., Agee, R.: Key Management for Multicast: Issues and Architecture, RFC 2672, http://www.faqs.org/rfcs/rfc2627.html 8. Kwak, D.W., Lee, S.J., Kim, J.W., Jung, E.J.: An Efficient LKH Tree Balancing Algorithm for Group Key Management. IEEE Communications Letters 10(3), 222–224 (2006) 9. Harney, H., Muckenhirn, C.: Group key management protocol (GKMP) specification, RFC 2093 (1997), http://www.faqs.org/rfcs/rfc2627.html 10. Harney, H., Muckenhirn, C.: Group key management protocol (GKMP) architecture. RFC 2094 (1997), http://www.faqs.org/rfcs/rfc2627.html 11. Sherman, A.T., McGrew, D.A.: Key Establishment in Large Dynamic Groups Using OneWay Function Trees. IEEE Trans. On Software Engineering 29(5), 444–458 (2003) 12. Canetti, R., Garay, J., Itkis, G., Micciancio, D., Naor, M., Pinkas, B.: Multicast Security:A Taxonomy and Some Efficient Constructions. In: Proceedings of the IEEE INFOCOM, New York, vol. 2, pp. 708–716 (1999) 13. Perrig, A., Song, D., Tygar, J.D.: A new protocol for efficient large-group key distribution. In: Proceedings of the IEEE Symposium on Security and Privacy, Oakland, Calif. IEEE Computer Society Press, Los Alamitos (2001) 14. Zheng, X.L., Huang, C.T., Matthews, M.: Chinese Remainder Theorem Based Group Key Management, ACMSE 2007, Winston-Salem, North Carolina, USA, pp. 266–271 (2007)
Key Tree and Chinese Remainder Theorem Based Group Key Distribution Scheme
265
15. Lu, E.H., Hwang, W.Y., Harn, L., Lee, J.Y.: A Conference Key Distribution System Based On The Lagrange Interpolating Polynomial. In: Proceedings IEEE INFOCOM 1988, 7th Annual Joint Conference of IEEE Computer and Communication Society, pp. 1092–1094 (1988) 16. Chang, C.C., Lin, C.H., Chen, C.Y.: A Conference Key Distribution Scheme Using Interpolating Polynomials. In: 2007 International Conference on Multimedia and Ubiquitous Engineering, pp. 963–967 (2007) 17. Berkovits, S.: How to broadcast a secret. In: Davies, D.W. (ed.) EUROCRYPT 1991. LNCS, vol. 547, pp. 535–541. Springer, Heidelberg (1991) 18. Fiat, A., Naor, M.: Broadcast encryption. In: Stinson, D.R. (ed.) CRYPTO 1993. LNCS, vol. 773, pp. 480–491. Springer, Heidelberg (1994) 19. Naor, D., Naor, M., Lotspiech, J.: Revocation and tracing schemes for stateless receivers. In: Kilian, J. (ed.) CRYPTO 2001. LNCS, vol. 2139, pp. 41–62. Springer, Heidelberg (2001) 20. Lotspiech, J., Nusser, S., Pestoni, F.: Broadcast Encryption’s Bright Future. IEEE Computer 35(8), 57–63 (2002) 21. Huang, S.C.H., Du, D.Z.: New constructions on broadcast encryption key pre-distribution schemes. In: Huang, S.C.H., Du New, D.Z. (eds.) Proceedings IEEE INFOCOM 2005, 24th Annual Joint Conference of the IEEE Computer and Communications Societies, vol. 1, pp. 515–523 (2005) 22. Du, X., Wang, Y., Ge, J., Wang, Y.: An ID-based broadcast encryption for key distribution. IEEE Transactions on Broadcasting 51(2), 264–266 (2005)
Effective DDoS Attacks Detection Using Generalized Entropy Metric Ke Li1, Wanlei Zhou1, Shui Yu1, and Bo Dai2 1
School of Engineering and Information Technology Deakin University {ktql,wanlei,syu}@deakin.edu.au 2 School of Computer Science and Engineering University of Electronic Science and Technology of China
[email protected]
Abstract. In information theory, entropies make up of the basis for distance and divergence measures among various probability densities. In this paper we propose a novel metric to detect DDoS attacks in networks by using the function of order α of the generalized (Rényi) entropy to distinguish DDoS attacks traffic from legitimate network traffic effectively. Our proposed approach can not only detect DDoS attacks early (it can detect attacks one hop earlier than using the Shannon metric while order α=2, and two hops earlier to detect attacks while order α=10.) but also reduce both the false positive rate and the false negative rate clearly compared with the traditional Shannon entropy metric approach. Keywords: DDoS, generalized entropy, attacks detection.
1 Introduction Distributed denial-of-service attack (DDoS attack) is a serious threat to the security of cyberspace. It typically exhausts bandwidth, router processing capacity, or network stack resources, breaking network connectivity to the victims and making a computer resource unavailable to its intended users. One common method of the attack involves saturating the target (victim) machine with external communications requests, such that it cannot respond to legitimate traffic, or responds so slowly as to be rendered effectively unavailable. DDoS attack is a distributed, cooperative and large-scale attack; it holds more attacking resources and more destroying powers and it is very hard to be detected and defended. Anomaly-based detection is one of the major techniques used in DDoS attack detection. It uses a pre-defined specific threshold such as abnormal deviation of some A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 266–280, 2009. © Springer-Verlag Berlin Heidelberg 2009
Effective DDoS Attacks Detection Using Generalized Entropy Metric
267
statistical characteristics from normal network flows to identify the abnormal traffic among all normal traffics, so the utilization and choice of statistical methods and tools is vital important [2]. It is generally accepted that the fractional Gaussian noise function can be used to simulate the real network traffic in aggregation very well and the Poisson distribution function can be used to simulate the DDoS attack traffic in aggregation approximately [3][6][9][10][13]. In information theory, entropy is a measure of the uncertainty associated with a random variable. Shannon entropy has been regarded as an effective method for detecting abnormal traffic based on IP address-distribution statistics or packet sizedistribution statistics [4][5][7][8]. Detection of low rate DDoS attacks is one of the most important criteria for building an early anomaly detection system. However, most current detection methods only perform well in detecting high rate DDoS attacks. In this paper we propose a novel anomaly detection method by using the Rényi entropy [1] which not only detects high rate attacks, but also detects low rate attacks which do not result in the obvious changes in network traffic volume. We show that the use of our Rényi entropy approach outperforms clearly the traditional Shannon entropy method in DDoS attacks detection. The rest of this paper is organized as follows. In section 2 we analyze the normal and attack flows, respectively, and study the characteristics of the Shannon entropy. Section 3 describes the system design and analyses and the characteristics of the Rényi entropy, section 4 shows our experimental results, and finally, we conclude this paper in section 5.
2 Network Traffic Modeling We assume that legitimate network traffic is composed by many source traffics in the aggregate, and every source traffic rate is independent and with the same distribution, then the network traffic in the aggregate will satisfy the Gaussian noise distribution. At the moment, if the time scale is longer than the time of IP packet return need, the network traffic can be described by fractional Gaussian noise model properly. Fractional Gaussian noise is a stochastic process that is the formal derivative of a fractional Brownian motion. Fractional Brownian motions are a family of Gaussian processes that are indexed by the Hurst parameter, H, in the interval (0, 1). These processes have a property of self similarity of the probability laws under a scale change in time. The fractional Gaussian noise function for legitimate traffic is shown below:
1 x(t ) = ʼ(H '+0.5)
t
ì
H 'ì0.5
t ì˫
˰ (˫ )d˫
268
K. Li et al.
In a DDoS attack, the attack is coordinated across many zombies by a single attacker (master). We assume each zombie sends attack packets at a constant or linear rate, after these attack traffics aggregated, the general attack traffic distribution will obey Poisson distribution approximately. The Poisson distribution function for DDoS attack traffic is shown below: k ìˣ Pk = ˣ e k!
Where λ is a positive real number, equal to the expected number of occurrences that occur during the given interval, and k is a non-negative integer, k=0, 1, 2, … In information theory, the information entropy is a measure of the uncertainty associated with a random variable, it forms the basis for distance and divergence measures between probability densities. The more random of the information variable, the bigger the entropy is, in contrast, the more certainty of the information variable, the smaller the entropy is [12]. Definition of information entropy is as follows: n
H ( x) = ì pi log 2 pi i =1
Where Pi are the probabilities of {x1, x2 … xn}, 1
n
pi 0, pi =1. i =1
Therefore, it is not difficult to obtain the information entropy of Poisson distribution as follows:
k
H poisson = ˣ[1 ì log 2 ˣ ] + e ì ˣ ˣ k =0
log 2 k! k!
3 Analysis of the Rényi Entropy Metric In information theory, the Rényi information entropy as a generalization of Shannon entropy is one of a family of functions for quantifying the diversity, uncertainty or randomness of a system. It is a very important metric in statistics as indices of diversity. The Rényi information entropy of order
α is defined as follows:
n H ˙ ( x) = 1 log 2 ( pi˙ ) 1ì˙ i =1
Effective DDoS Attacks Detection Using Generalized Entropy Metric
Where c are the probabilities of {x1, x2 … xn}, pi
269
≥ 0,
n
pi =1, ˙ 0, ˙ 1. i =1 When
α
=0 or the probabilities of {x1, x2 … xn} are all the same, we have the
maximum information entropy as follows:
H 0 ( x) = log2 n Which indicates decentralization. When
the
α → 1, H α ( x )
probability
density
of
information
is
maximum
converges to Shannon entropy as follows: n
H1 ( x) = ì pi log 2 pi i=1
When
α → ∞,
we can obtain the minimum information entropy
H∞ (x). When
H∞ (x) =0, which indicates that the probability density of information is at the maximum concentration.
H (x) = ìlog 2 pi
max
Where pi
max
In the case
is the largest probability among
α
>0, we have
pi .
, therefore, the Rényi information ˙ H ˙ ( x ) 0
entropy is a non-increasing function of α . Namely: H ˙( x ) H˙ ( x )for 1
2
α 1< α 2.
Karol discussed the relations between Shannon entropy and Rényi entropies of integer order α [15]. The value of Rényi entropy depends on the parameter α. In particular, the more important performance for Rényi entropy (α >1) is that it can increase the deviation between the different probability distributions than using Shannon entropy [11][14]. To observe and analyze the formulas of Shannon and Rényi information entropy, we know that the high probability event can contribute more to the final entropy in Rényi information entropy than in Shannon entropy while α >1, and the low probability event can contribute more to the final entropy in Rényi information
270
K. Li et al.
entropy than in Shannon entropy while α 1. In contrast, the Rényi information entropy value is higher than the Shannon
entropy value and the low probability event can influence more to the final entropy in Rényi information entropy than in Shannon entropy while 0 ≤ α 1,
k=1, 2
H ˙ (PR 2bk ( FGN ) ) - H ˙ (PR 2ak ( Poisson ) ) H ˙ (PR1bk ( FGN ) ) - H ˙ (PR1ak ( Poisson ) ) , ˙ >1, k=1, 2
Effective DDoS Attacks Detection Using Generalized Entropy Metric
277
Therefore, we can further prove and obtain the following inequalities:
H 1 (PR0 ( FGN ) ) - H1 (PR0( Poisson ) ) H ˙ (PR0 ( FGN ) ) - H ˙ (PR0 ( Poisson ) ) , ˙ >1, k=1, 2
(
H 1 PR1bk ( FGN )
)
(
)
(
)
- H ˙ PR1ak ( Poisson ) , ˙ >1,
(
)
(
)
- H ˙ PR 2ak ( Poisson ) , ˙ >1,
- H 1 PR1ak ( Poisson ) H ˙ PR1bk ( FGN )
(
)
(
)
k=1, 2
(
H 1 PR 2bk ( FGN )
)
- H 1 PR 2ak ( Poisson ) H ˙ PR 2bk ( FGN )
k=1, 2 ……
Based on above analysis and proof, we can figure out the variation of spacing with hop count of routing between legitimate flow and attack flow by using Shannon and Rényi entropy metrics respectively. In theory, the closer to the victim the larger of spacing, no matter using Shannon or Rényi approach. However, the increase of spacing is faster using Rényi approach than using Shannon metric. We test the proposed approach using Lincoln Laboratory Scenario (DD0S) 2.0.2 data set in the different
Variation of Spacing with Hop Count of Routing Using Different Metrics
situations, and the results are shown in Figure 6. 9
8
7 Shannon Entropy of Legitimate Flow Shannon Entropy of DDoS A ttack Flow Reny i Entropy of Legitimate Flow, order=2 Reny i Entropy of DDoS A ttack Flow, order=2 Reny i Entropy of Legitimate Flow, order= 10 Reny i Entropy of DDoS A ttack Flow, order=10
6
5
4
3
2
0
1
2
3 Hop Count of Routing
4
5
6
Fig. 6. Variation of spacing with hop count of routing between legitimate flow and attack flow using Shannon and Rényi entropy metrics while order α =2 and 10
278
K. Li et al.
The above experimental results verified our analysis in section 2, that our proposed approach can detect attacks early than the Shannon metric. In this demonstration scenario, our approach can detect attacks one hop earlier than using the Shannon metric while order α =2, and two hops earlier to detect attacks while order α =10.
Our proposed approach can not only detect attacks early but also can reduce both false positive rate and false negative rate clearly than Shannon metric. Table 2 shows the reduced false positive rate and false negative rate by using the Rényi entropy metric in different value of order α in comparison to the Shannon entropy metric.
Table 2. Reduced false positive rate and false negative rate when using the Rényi entropy metric compared to using the Shannon entropy metric
Metric Entropy
Rényi
Reduced False
Reduced False
Positive Rate
Negative Rate
(%)
(%)
˙=2
142.80
142.80
˙=3
213.26
213.26
˙=4
242.19
242.19
˙=5
254.60
254.60
˙=10
262.28
262.28
5 Conclusions In this paper, we propose a new approach of using the generalized (Rényi) entropy to detect DDoS attacks, and the simulation results show that this approach works well and outperforms the traditional Shannon entropy in detecting anomaly traffic; in particular this approach can improve the system’s detection sensitivity by adjusting the value of order α of the Rényi entropy effectively. It can not only detect DDoS attacks early
α =2 in while order α =10.)
(there is one hop earlier than using the Shannon metric while order DDoS attacks detection, and two hops earlier to detect attacks
but also reduce both the false positive rate and the false negative rate clearly compared with the traditional Shannon entropy approach (it can reduce 142.80% of
Effective DDoS Attacks Detection Using Generalized Entropy Metric
279
the false positive rate and false negative rate while the Rényi order α =2 than using the traditional Shannon metric, and even can reduce 262.28% while order
α =10).
References [1] Rényi, A.: On Measures of Entropy and Information. In: Proc. Fourth Berkeley Sym., Math. Stat. and Probability, vol. 1, pp. 547–561. University of California Press, Berkeley (1961) [2] Carl, G., Kesidis, G., Brooks, R.R., Rai, S.: Denial-of-Service Attack-Detection Techniques. IEEE Internet Computing 10(1), 82–89 (2006) [3] Du, P., Abe, S.: IP Packet Size Entropy-Based Scheme for Detection of DoS/DDoS Attacks. IEICE Transactions on Information and Systems E91-D(5), 1274–1281 (2008) [4] Gu, Y., McCallum, A., Towsley, D.: Detecting anomalies in network traffic using maximum entropy estimation. In: Proc. ACM/SIGCOMM Internet Measurement Conference – IMC 2005 (October 2005) [5] Sekar, R., Gupta, A., Frullo, J., Shanbhag, T., Zhou, S., Tiwari, A., Yang, H.: Specification based anomaly detection: A new approach for detecting network intrusions. In: Proc. ACM CCS (2002) [6] Ledesma, S., Liu, D.: Synthesis of Fractional Gaussian Noise Using Linear Approximation for Generating Self-Similar Network Traffic. Computer Communication Review 30 (2000) [7] Patcha, A., Park, J.-M.: An overview of anomaly detection techniques: Existing solutions and latest technological trends. Computer Networks 51 (2007) [8] Willinger, W.: Traffic modeling for high-speed networks: Theory versus practice. In: Stochastic Networks. Springer, Heidelberg (1995) [9] Perrin, E., Harba, R., Berzin-Joseph, C., Iribarren, I., Bonami, A.: nth-order fractional Brownian motion and fractional Gaussian noises. IEEE Trans. Signal Processing 45, 1049–1059 (2001) [10] Perrin, E., Harba, R., Jennane, R., Iribarren, I.: Fast and Exact Synthesis for 1-D Fractional Brownian Motion and Fractional Gaussian Noises. IEEE Signal Processing Letters 9 (November 2002) [11] Kumar, K., Joshi, R.C., Singh, K.: A Distributed Approach using Entropy to Detect DDoS Attacks in ISP Domain. Signal Processing, Communications and Networking (2007) [12] Shannon, C.E.: A mathematical theory of communication. Bell System Technical J. 27, 379–423, 623–656, (1948) [13] Bao, Y., Krim, H.: Renyi entropy based divergence measures for ICA. In: 2003 IEEE Workshop on Statistical Signal Processing, 28 September - 1 October 2003, pp. 565–568 (2003)
280
K. Li et al.
[14] Baraniuk, R.G., Flandrin, P., Janssen, A.J.E.M., Michel, O.J.J.: Measuring timefrequency information content using the Renyi entropies. IEEE Transactions on Information Theory 47(4), 1391–1409 (2001) [15] Karol, Z.: Rényi Extrapolation of Shannon Entropy. Open Sys. & Information Dyn. 10, 297–310 (2003) [16] http://www.ll.mit.edu/mission/communications/ist/corpora/ ideval/data/2000/LLS_DDOS_2.0.2.html
A Fast and Flexible Sorting Algorithm with CUDA Shifu Chen1, Jing Qin2, Yongming Xie2, Junping Zhao3, and Pheng-Ann Heng1,2 1 Shenzhen Institute of Advanced Integration Technology, Chinese Academy of Sciences/The Chinese University of Hong Kong
[email protected] 2 Department of Computer Science and Engineering, The Chinese University of Hong Kong {jqin,ymxie,pheng}@cse.cuhk.edu.hk 3 Institue of Medical Informatics, Chinese PLA General Hospital & Postgraduate Medical School
[email protected]
Abstract. In this paper, we propose a fast and flexible sorting algorithm with CUDA. The proposed algorithm is much more practical than the previous GPU-based sorting algorithms, as it is able to handle the sorting of elements represented by integers, floats and structures. Meanwhile, our algorithm is optimized for the modern GPU architecture to obtain high performance. We use different strategies for sorting disorderly list and nearly-sorted list to make it adaptive. Extensive experiments demon- strate our algorithm has higher performance than previous GPU-based sorting algorithms and can support real-time applications. Keywords: Parallel sorting algorithm, CUDA, GPU-based sorting algorithm.
1
Introduction
Fast and robust sorting algorithms are essential to many applications where ordered lists are needed. With the progress of general-purpose computing on GPUs (GPGPU), a lot of efforts have been dedicated to developing high-performance GPU-based sorting algorithms, especially after programmable vertex and fragment shaders were added to the graphics pipeline of modern GPUs. The early GPUbased sorting algorithms directly employed graphics application programming interfaces (APIs). For examples, Purcell [1] reported an implementation of bitonic merge sort on GPUs. Kipfer [2][3] presented an improved bitonic sort with the name of odd-even merge sort. Greβ [4] introduced the GPUABiSort, a sorting algorithm based on the adaptive bitonic sorting technique proposed by Bilardi [5]. Govindaraju [6] implemented a library named GPUSort with the capability of sorting floating point in both 16 and 32-bit precision. Although encouraging A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 281–290, 2009. © Springer-Verlag Berlin Heidelberg 2009
282
S. Chen et al.
performance improvements are reported in these algorithms, one of the main disadvantages of them is they cannot efficiently handle the sorting of elements in structure, since the APIs cannot give developers access to the native instruction set and memory of the parallel computational elements in GPUs, therefore the computing capacity of GPU cannot be fully exploited. CUDA is a parallel computing architecture developed by NVIDIA. Comparing with traditional GPGPU techniques, CUDA has several advantages, such as scattered reads, shared memory, faster downloads and readbacks to or from the GPU, and fully support for integer and bitwise operations. These features make CUDA an efficient parallel computing architecture, which can easily drain the computing capacity of modern GPUs. A full introduction of programming with CUDA can be found in [7]. Recently, some CUDA-based sorting algorithms have been proposed. For instances, Erik Sintorn [8] introduced a CUDA-based hybrid algorithm which combines the bucket sorting and merge sorting, but can only sort floats as it uses a float4 for internal merge sorting to achieve high performance (sorting integers would be possible if replace float4 with int4). Daniel Cederman [9] proposed the implementation of Quicksort in CUDA, but the performance of this algorithm is sensitive to the distribution of the input list. University of California and NVIDIA collaboratively developed a fast CUDA-based sorting algorithm named Global Radix Sort [10]. However, as it uses the bit information of the storage unit, the complexity of this algorithm is in scale with the number of bits, and explodes while being employed to sort floats or structures. Although these CUDA-based algorithms show high performance in some cases, the lack of ability of sorting floats or structures limits their application to many practical problems. In this paper, we propose a novel fast and flexible sorting algorithm with CUDA, which not only has high performance, but is able to handle the sorting of elements represented by various data types. In addition, flexible strategies are provided for sorting disorderly list and nearly-sorted list, respectively. Extensive experiments demonstrated that our algorithm has higher performance than previous GPU-based sorting algorithms, such as GPU Quicksort, Hybrid sort and Global Radix Sort, and showed its capability of supporting real-time applications.
2 Algorithm Overview The main idea of this algorithm is: we first split the input list to buckets, and then sort each bucket concurrently in one stream multi-processers. The buckets sequence need to meet two criteria: 1) Each element in the bucket i should be smaller than the elements in bucket i + 1, assuming that we’re going to obtain an incremental sequence(we always assume this in this paper). 2) Each bucket has no more elements than a fixed size M , otherwise it will be split to sub-buckets. M is determined by the graphics hardware, indicating the maximum threads that can be contained in a thread block. Typically it is 512 for the NVIDIA cards.
A Fast and Flexible Sorting Algorithm with CUDA
283
Fig. 1. The pipeline of our CUDA-base sorting algorithm. The input list is firstly split into slices, and these slices are then merged to buckets. Finally, an internal bitonic sort is performed for each bucket.
2.1 Main Steps The four main steps of this algorithm are briefly introduced as follows: Slice division. Firstly we split the input list into small slices, each slice is expected to have less elements than M , and each element in the slice i should be smaller than the elements in slice i + 1. This part will be discussed in detail in section 3.3. Slice merge. Secondly the slices will be merged into buckets. This operation should make each bucket have as close as possible to, but no more than M elements, except that the first slice has already make the bucket exceeded. This part will be discussed in section 3.4. Internal bitonic sort. Thirdly the buckets will be sorted individually in a parallel manner. In order to obtain the best performance, the data of these buckets will be loaded into the shared memory, and wrote back to the global memory after the sorting is completed. The whole sorting process of one bucket is entirely executed on single stream multi-processers. Since the shared memory supplies horizontal accesses, this process is very fast. This part will be discussed in section 4. Recursion. Finally, if there exists some buckets contain more elements than M, so that it’s not fully sorted, the bucket will be considered as a new input list and return to the entrance of the sorting pipeline. This part is implemented as a recursion. According to our experiments, the recursion procedure is actually rarely called. Mostly we get none or just one bucket exceeded, while sorting uniformly or Gaussian distributed list with 10M elements. So it won’t raise a performance problem.
284
S. Chen et al.
3 Bucket Division The bucket division contains three steps: slice division and slice merge. Slice division has three sub-steps: 1, find the maximum and minimum element of the input list; 2, calculate a step width for the slices; 3, calculate the slice index of each element and assign each element to corresponding slice. 3.1 Find the Maximum and Minimum Firstly, a reduction method introduced by Mark Harris [11] is used to find the maximum and minimum elements of the input list. 3.2 Calculation of Step Width and Slice Count Once we get the maxValue and minValue, we can calculate the step width of slices using a parameter E, which represents the expected slice size. The step width can be calculated as Ep. 1: stepWidth = (maxV alue − minV alue) ∗ E/n
(1)
where n is the size of the input list. Then, use step width of slice list, we could calculate the slice count directly. 3.3 Assign Elements to Slices In this step, we use four arrays: 1, sliceSizes, storing the size of each slice; 2, sliceOfElements, storing the slice index of each element; 3, offsetInSlice, storing the offset of each element in its corresponding slice; 4, sliceOffsets, storing the global offset for each slice. The process of assigning elements to slices is to fill sliceOfElements with the correct slice index for each element, to calculate the size of each slice, and to find the offset of each element in the slice. For old graphics hardware, it’s not easy to make this process efficient, as it’s hard to obtain data consistent. Fortunately, for the modern GPUs, the synchronization mechanisms such as atomic functions are available. By employing these atomic functions, threads actually run serially when they attempt to increase the size of slice i. Although this would decrease the parallelism and bring out some unfavorable factors to the performance, it is still critical for some applications. With these atomic functionalities, we describe the process of assigning elements to slices as following pseudo code shows: Algorithm 1: Slice Division foreach element i in parallel sliceIndex=(int)(elementValue[i] - minValue)/stepWidth; offset=atomicInc(sliceSizes[sliceIndex]); sliceOfElements[i]=sliceIndex; offsetInSlice[i]=offset; end
A Fast and Flexible Sorting Algorithm with CUDA
285
The function atomicInc() increases the value of given memory unit by 1 atomically, and returns the old value of this unit. The old values can be taken as the offset of this element directly, as it is initially 0, increases as sliceSize increases, and is never the same for different elements in a same slice. After the slice list being completely built, an algorithm called SCAN [13] is used to calculate the prefix sum in parallel. Mark Harris also introduced the CUDA implementation of SCAN at [17]. The array sliceSizes is used to build the array sliceOffsets while employing SCAN. After this procedure is done, each element of sliceOffsets will have the global offset for corresponding slice. 3.4 Merge Slices to Generate Bucket In this step, we use two arrays, which are bucketSizes and bucketOffsets. The bucketSizes stores the size of each bucket, and the bucketOffsets stores the offset of each bucket. Following pseudo codes give a description of this process: Algorithm 2: Slice Merge FOR i=0 to sliceCount-1 if bucketSize[bucketCount] + sliceSize[i] > M and bucketSize[bucketCount]!=0 generateNewBucket(); end if addSliceToBucket(bucketCount,i); end The function addSliceToBucket() handles the process of adding a slice to a bucket, where the bucketSize would be updated. After we complete the slice division and slice merge, we can build a new list. The following pseudo codes give a description: Algorithm 3: move elements to new list foreach element i in parallel sliceIndex=(int)(elementValue[i] - minValue)/stepWidth; sliceOffset=sliceOffsets[sliceIndex]; globalOffset=sliceOffset + elementOffsetInSlice[i]; newList[globalOffset] = oldList[i]; end
4
Bitonic Sort in GPU
Since the expected size E of each slice is much smaller than M (in our implementation, M is 512 by default, and E is 80), the vast majority of the buckets should have elements less than but close to M . The buckets which have elements more than M will be on the way to a recursion. The internal bitonic sort includes three steps.
286
S. Chen et al.
Data copying and padding. Firstly, we copy the elements from global memory to shared memory to reduce the global memory accesses. Then we pad the bucket to make it have M elements if it is not full. This makes the coming up operations much more efficient, as M is always a power of 2 . There are more than one methods to pad elements into those non-full buck- ets, but the most simple and safe way is to use the biggest number, which is considered as infinite in computer. Internal bitonic sort. After data copying and padding, we’ve got M elements stored in shared memory. We then use an internal bitonic sort introduced by W. Christopher [12]. Bitonic sort is one of the fastest sorting networks. The parallel bitonic sorting works effectively only when the length is a power of 2, that’s why we do the padding. A detailed introduction of parallel bitonic sorting could be found in [15]. Write back the result. This step is pretty simple, we just have to make sure that the padding will be removed.
5 Bottleneck and Optimizations Memory access is usually considered to be the biggest bottleneck for sorting algorithms, especially for the GPU-based ones. For our algorithm, the memory access bottleneck could probably be found at two sections: one is the slice division described at Algorithm 1, the other is the new list generation which is described at Algorithm 3. When the input list is nearly sorted (either ascending or descending), it comes the worst situation. Since the atomic functions are actually run serially at hardware level, if the input list is nearly sorted, the nearby elements may be assigned to the same slice, so assigning an element to a slice could be very time consuming as there might be a long queue waiting to access the same memory unit. We use a simple method to check the input list is nearly sorted or not to avoid this worst situation. This will be discussed at 5.1. Moving elements to new places is not efficient, because there exists discontinuous reads and writes, both result in a non-coalesced memory access. We utilize the texture mechanism to alleviate this problem. This will be discussed at 5.2. 5.1 Flexible Strategies for Flat or Nearly Sorted List A list is flat while its maxValue is equal to its minValue. We could know it is a flat list or not by comparing the maxValue and minValue, if yes, the program could exit right away. For nearly sorted list, we have to solve at least two problems . One is how we know the input list is nearly sorted or not, the other is how to handle it if we already know that. We define: n
disorderDegree =
∑| a − a k =1
i
i −1
|
maxValue − minValue
(2)
A Fast and Flexible Sorting Algorithm with CUDA
287
The disorderDegree is on behalf of the degree of disorder of the input list, and ai is the value of element i. A threshold C is then used to determine the input list is nearly sorted or disorderly. If disorderDegree < C , then the input list is considered to be nearly sorted, otherwise disorderly. In our experiments, C = 10 works well for sorting elements from 1M to 24M. The parallel reduction algorithm [11] is also used here to calculate the disor- derDegree effectively. It only takes less than 2% of the total time. And the user can simply skip this step if they already know the input list is nearly sorted or not. While doing the slice division, we use different strategies to calculate the index of elements for nearly ordered lists and disordered lists, respectively. For disorderly lists, we use: elementI ndex = blockDim ∗ blockI d + threadI d
(3)
While threadId is the thread index, elementIndex indicates the element that current thread will handle, the blockDim is the size of the blocks, and blockId is the index of the active block. In this case, the threads in the same block will read consecutive elements so that the memory access is coalesced and efficient. And for nearly sorted lists, we use: elementI ndex = blockC ount ∗ threadI d + blockI d (4) Although this involves discontinuous memory access and causes a noncoalesced problem, the time drops significantly. In our experiments, for sorting 24M nearly-sorted floats on a Geforce 280 GTX card, it takes nearly 1050ms while using the first strategy, but only takes 420 ms while using the other. 5.2 Utilize the Texture Mechanism As mentioned at section 3.4 and 3.5, they are two arrays, which are bucketSizes, sliceOffsets. These arrays don’t need to be modified after built, and accesses on them could be very heavy. These two characteristics meet the features of texture mechanism well. Since the textures memory space is cached, this step will be accelerated a lot if the texture fetches hit the cache frequently.
6 Performance Evaluation We conduct a series of experiments to evaluate the timing performance of our algorithm. The experiments are performed on two graphics cards, one is a GeForce 9600GT card and the other is a GeForce 280 GTX card, while the CPU employed in these experiments is a Quad Q6600 at 4x2.4 GHz. Results are shown in Fig.2 to Fig. 4. Firstly, we compare our algorithm with GPU-Quicksort,and GPU RadixSort, as they are also implemented with CUDA. Note that both the current implementation of GPU-Quicksort and GPU RadixSort can only sort elements of integers, while our algorithm is not limited to sorting integers. Experimental results show that our algrithm achieves better performance than both the GPUQuicksort and the GPU RadixSort. Fig. 2 shows the comparison of our algorithm with GPU-Quicksort and GPU RadixSort. The results include time cost of data transfer between host and graphics device. Since the The GPU-RadixSort can
288
S. Chen et al.
only support sorting less than 16M elements, time use of its sorting 20M and 24M elements are not presented. Secondly, we make comparison of our algorithm and and STL quicksort. The results show our algorithm achieves 10 times to 20 times acceleration over STL quicksort (released version and highly optimized). Results are shown in Fig. 3.
(a)
(b)
(c)
(d)
Fig. 2. The timing performance of GPU-RadixSort, GPU-Quicksort and our algorithm while sorting 4M to 24M integral elements. (a) Sorting uniformly distributed, disorderly list. (b) Sorting uniformly distributed, disorderly list. (c) Sorting Gaussian distributed, disorderly list. (d) Sorting Gaussian distributed, nearly-sorted list.
(a)
(b)
Fig. 3. The time use of STL Quicksort and our algorithm, while sorting 4M to 24M elements. The list is uniformly distributed and disorderly. (a) Sorting list in float. (b) Sorting list in float4.
A Fast and Flexible Sorting Algorithm with CUDA
289
At last, Fig. 4 shows the time consumption of each part of ou algorithm, while sorting nearly-sorted or disorderly lists. Finally Fig. 5 shows an application of our algorithm for real-time bleeding simulation.
(a)
(b)
Fig. 4. The time consumption of each part of our algorithm. We could find out the the bottlenecks while sorting nearly-sorted or disorderly ones. (a) Sorting nearly-sorted list in float. (b) Sorting disorderly list in float.
Fig. 5. In a SPH-based real-time blood simulation project, our sorting algorithm was used for neighbor particle searching
7
Conclusion
We’ve proposed a fast and flexible GPU-based sorting algorithm. It can handle the sorting of elements in integers, floats, or structures. It’s a combination of bucket sort and internal bitonic sort. The experiments demonstrated our algorithm achieves a 10x to 20x acceleration over STL quicksort. Our algorithm also has higher performance than the GPU Quicksort and GPU RadixSort. Acknowledgments. The work described in this paper was supported by the National Natural Science Foundation of China (Grant No. 60873067).
References 1. Purcell, T.J., Donner, C., Cammarano, M., Jensen, H.W., Hanrahan, P.: Photon Mapping on Programmable Graphics Hardware. In: Proceedings of the ACM Siggraph Eurographics Symposium on Graphics Hardware (2003) 2. Kapasi, U.J., Dally, W.J., Rixner, S., Mattson, P.R., Owens, J.D., Khailany, B.: Efficient Conditional Operations for Data-parallel Architectures. In: Proceedings of the 33rd annual ACM/IEEE International Symposium on Microarchitecture, pp. 159–170 (2000)
290
S. Chen et al.
3. Kipfer, P., Segal, M., Westermann, R.: UberFlow: A GPU-based Particle Engine. In: Proceedings of the ACM Siggraph/Eurographics Conference on Graphics Hardware, pp. 115– 122 (2004) 4. Greβ, A., Zachmann, G.: GPU-ABiSort: Optimal Parallel Sorting on Stream Architectures. In: Proceedings of the 20th IEEE International Parallel and Distributed Processing Symposium (2006) 5. Bilardi, G., Nicolau, A.: Adaptive Bitonic Sorting. An Optimal Parallel Algorithm for Shared Memory Machines. SIAM Journal on Computing 18(2), 216–228 (1989) 6. Govindaraju, N.K., Raghuvanshi, N., Manocha, D.: Fast and Approximate Stream Mining of Quantiles and Frequencies Using Graphics Processors. In: Proceedings of the 2005 ACM SIGMOD International Conference on Management of Data, pp. 611–622 (2005) 7. NVIDIA Corporation. NVIDIA CUDA Programming Guide (2008) 8. Sintorn, E., Assarsson, U.: Fast Parallel GPU-Sorting Using a Hybrid Algorithm. In: Workshop on General Purpose Processing on Graphics Processing Units (2007) 9. Cederman, D., Tsigas, P.: A Practical Quicksort Algorithm for Graphics Processors. Technical Report 2008-01, Computer Science and Engineering Chalmers University of Technology (2008) 10. Harris, M., Satish, N.: Designing Efficient Sorting Algorithms for Manycore GPUs. NVIDIA Technical Report (2008) 11. Harris, M.: Optimizing Parallel Reduction in CUDA. NVIDIA Developer Technology (2008) 12. Blelloch, E., Greg Plaxton, C., Leiserson, C.E., Smith, S.J., Maggs, B.M., Zagha, M.: An Experimental Analysis of Parallel Sorting Algorithms (1998) 13. Harris, M., Sengupta, S., Owens, J.D.: Parallel Prefix Sum (Scan) with CUDA. In: Nguyen, H. (ed.) GPU Gems 3, Addison-Wesley, Reading (2007) 14. Bilardi, G., Nicolau, A.: Adaptive bitonic sorting: an optimal parallel algorithm for sharedmemory machines. SIAM J. Comput. 18(2), 216–228 (1989) 15. Kider, J.T.: GPU as a Parallel Machine: Sorting on the GPU, Lecture of University of Pennsylvania (2005) 16. Knuth, D.: Section 5.2.4: Sorting by merging. In: The Art of Computer Programming, Sorting and Searching, vol. 3, pp. 158–168 (1998) ISBN 0-201-89685-0 17. Harris, M.: Parallel Prefix Sum(Scan) with CUDA (2008)
A Parallel Simulated Annealing Approach for Floorplanning in VLSI Jyh-Perng Fang1 , Yang-Lang Chang1 , Chih-Chia Chen1 , Wen-Yew Liang2 , Tung-Ju Hsieh2 , Muhammad T. Satria2 , and Chin-Chuan Han3 1
2
Dept. of Elec. Eng., National Taipei Univ. of Tech.
[email protected] Dept. of Comp. Sci. and Info. Eng., National Taipei Univ. of Tech. 3 Dept. of Comp. Sci. and Info. Eng., National United Univ.
Abstract. One of the critical issues in floorplanning is to minimize area and/or wire length of a given design with millions of transistors while considering other factors which may influence the success of design flow or even manufacturing. To deal with the floorplan design with enormous amount of interconnections and design blocks, we adopt a parallel computing environment to increase the throughput of solution space searching. Also, we include the fractional factorial analysis to further reduce the time needed to search the acceptable solution. The experimental results indicate that our approach can obtain better space utility rate and it takes less time than the traditional method and parallel method do. Keywords: Floorplanning, FFA, Parallel Computing, Simulated Annealing, OpenMP.
1
Introduction
As modern VLSI technology advances, more transistors are put in a chip and more wires are needed to connect transistors, the design time for each design phase in a physical design flow is thus drastically lengthened. Consequently, for physical design, more and more researches focused at shortening the design time caused by circuit complexity as well as geometry complexity. Among these consecutive design phases in the design flow of physical design, floorplanning generally demands more attention. The reason is that, as an earlier design phase in the design flow, floorplanning dominates the following design phase. A good floorplan not only simplifies global routing but also decreases the possibility of a defective design for subsequent design phases. In addition, a design failed in routing or subsequent design phase should be returned to the preceding stage for re-design, which means a longer design time and a higher design cost are incurred. In the past years, many problems in the floorplan design are solved using a Marcov-chain-based approach, such as simulated annealing or genetic algorithm, which has been empirically proven to be a useful method for finding A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 291–302, 2009. c Springer-Verlag Berlin Heidelberg 2009
292
J.-P. Fang et al.
an acceptable solution for NP-hard problems. However, with the fast growing of design complexity, adopting the traditional Marcov-chain-based approaches frequently leads two types of results: very time-consuming computation or unsatisfied solution. In this study, we similarly use simulated annealing algorithm to solve floorplanning problem. However, to ameliorate the problems caused by geometry complexity, the simulated annealing algorithm is performed in parallel. Furthermore, the fractional factorial analysis is included to further reduce the time needed to search the acceptable solution. The parallel computing in our approach is implemented using OpenMP library and is focused on the scheduling and computation of cost function because the time used by simulated annealing heavily depends on these two parts. The experimental results show that the operation time is significantly reduced and the space is utilized more efficiently. This paper is organized as follows. The traditional floorplanning techniques are evaluated and discussed in section 2. The proposed approach is given in section 3. Experimental results are provided in section 4. Conclusions are presented in section 5.
2
Overview of the Published Researches
This section gives an overview of published researches on floorplanning and simulated annealing. Especially, a parallel mechanism for simulated annealing is discussed in section 2.3. 2.1
Floorplanning
The VLSI physical design is a complex process which includes distinct design phases such as partitioning, flooplanning, placement, global routing, detail routing, and verification. To ensure the produced chip satisfying all aspects of constraints, such as timing, power, area, an iterative design flow is necessary. For a large design, a pre-simulation stage including modeling, simulation, and analysis is further adopted to shrink design iteration, as shown in Fig. 1. After a design is partitioned into sub-designs, floorplanning stage is responsible for generating an optimized floorplan, thereafter placement and routing stages follow. Traditional studies on floorplanning concentrated on geometry representations and geometry operations [1],[2],[3],[4] such that the floorplan is generated fast and the final floorplan has the most compact area as well as the shortest total-wire-length. However, a VLSI design typically does not go through the work flow in a fairly sequential manner. Rather, it operates in an iterative manner because in any subsequent physical design phase such a design can be failed by violating area constraint, power constraint [5], timing constraint, or other constraints [6], [7]. To shrink design iteration, it is a good practice to perform power, congestion, and other estimations at floorplanning phase. As a result, the computation time
A Parallel Simulated Annealing Approach for Floorplanning in VLSI
293
Fig. 1. Typical work flows of physical design
of floorplan design is significantly raised and this situation is further aggravated when there are a huge numbers of components and connections [8],[9],[10]. To solve this problem, Ho et al. [11] proposed a fractional-factor-based method to decrease computation time for redundant floorplans, Tang et al. [12] presented a parallel genetic algorithm (GA) for floorplan area optimization. Among the parallel algorithms for floorplanning, quite a part of studies focused on parallel simulated annealing [13], [14]. 2.2
Simulated Annealing
Simulated Annealing has been widely known to be an effective approach to seek an acceptable solution for problems of electronics design automation (EDA) [11],[12] or other fields [15], [16], [17]. To apply simulated annealing to solve floorplanning problems, four ingredients as follows should be concerned. 1. Solution space: The computation time for seeking a better solution usually depends on the size of solution space. Fractional factorial analysis (FFA) introduced in section 3 is an effective method for scaling down the solution space. 2. Neighborhood structure: Also known as “perturbation”, a perturbation is used to move from current solution to its neighbor solution.
294
J.-P. Fang et al.
3. Cost function: Typical cost function for a floorplan includes area and total wire length, sometimes further includes other constraints such as timing, noise, and power. 4. Annealing structure: This ingredient relates to the initial temperature, the freezing point, the speed of temperature decreases, and count of iterations in each temperature. Algorithm 1 shows the pseudo code of a generic simulated annealing algorithm. The loop from line 3 to line 9 constructs an annealing structure, wherein line 9 is a temperature decreasing operation. Algorithm 1: Pseudo code of a generic simulated annealing algorithm. Generic_SA(P, r, T, Tf) /* P = Iterations at each temperature r = Temperature decreasing rate T = Initial temperature Tf = Freezing point (Output) F = A final floorplan */ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.
Begin Get an initial solution S while T > Tf do while(not_Equilibrium( )) do randomly pick a neighbor S’ of S deltaC := cost(S’) - cost(S) if ( deltaC Tf do 4. #pragma omp parallel 5. while (not_Equilibrium( )) do 6. randomly pick a neighbor S’ of S 7. deltaC := cost(S’) - cost(S) 8. if ( deltaC result) result ← number; else if (number < result) result ← number; end
/* max */ /* min */
Fig. 2. Bitonic sorting algorithm on n-cube
For example, the bitonic sequence mentioned above s = (2, 3, 8, 13, 15, 14, 7, 0) will be divided to two bitonic sequences s1 = (2, 3, 7, 0) and s2 = (15, 14, 8, 13). Note that both the s1 and s2 are bitonic sequences. Thus, given a bitonic sequence, we can use bitonic splits recursively to obtain short bitonic sequences until we obtain sequences of size one, at which point the input bitonic sequence is sorted. This procedure of sorting a bitonic sequence using bitonic splits is called bitonic merge (BM). Given a set of elements, we must transform them into a bitonic sequence. This can be done recursively doubling the size of bitonic sequence. The bitonic sorting network for sorting N numbers consists of logN bitonic sorting stages, where the ith stages is composed of N/2i alternating increasing and decreasing bitonic merges of size 2i . Figure 1 shows the block structure of a bitonic sorting network of size N = 16. ⊕BM[k] and BM[k] denote increasing and decreasing bitonic merging networks of size k, respectively. The last merging network (⊕BM[16]) sorts the input.
An Efficient Parallel Sorting Algorithm on Metacube Multiprocessors BM[2] 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
03 08 02 13 15 07 00 14 06 09 01 11 10 04 05 12
BM[4] 03 08 13 02 07 15 14 00 06 09 11 01 04 10 12 05
i=0
BM[8] 02 03 08 13 15 14 07 00 01 06 09 11 12 10 05 04
i=1
375
BM[16] 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
00 02 03 07 08 13 14 15 12 11 10 09 06 05 04 01 i=2
i=3
Fig. 3. Bitonic sorting on a 4-cube
Figure 2 gives a bitonic sorting algorithm on an n-cube. The algorithm executes on every node in the n-cube in parallel. There are four parameters in the algorithm: my id is the binary node address; my number is the number residing in the node; n is dimension of the hypercube; and result is the sorted number. The sorted numbers are in the same order as the node addresses. The outer for loop generates bitonic sequences in the dimension order of i = 0 to n − 1. Each iteration of the loop doubles the size of bitonic sequences. The bitonic merge is done by the inner for loop, which takes the order of j = i to 0. In the current step j, nodes u and u(j) exchange their numbers each other through the link of the dimension j and compare the two numbers, where the addresses of nodes u and u(j) differs only in the dimension j. After the comparison, node u keeps the number as result based on the following rule: If the value of jth bit of the address differs from the value of i + 1st bit of the address, the node keeps the maximum of the two numbers; minimum otherwise. A bitonic sorting example on a 4-cube is shown in Figure 3 where the sorted result is the same value as my id. The computational complexity for sorting N = 2n numbers in an n-cube is O(n × (n + 1)/2) = O(n2 ). Similarly, the communications take O(n2 ) steps.
3 Metacube and Its New Presentation Metacube (MC for short) is a versatile family of interconnection networks. It includes hypercube as a special case. In this section, we first introduce the original presentation of the MC architecture. Then, we give a new presentation of the MC that makes the efficient parallel sorting on MC possible. The address format of an MC is shown in Figure 4. There are two parameters in an MC network, k and m. The value c of the most significant k bits defines the class ID of a node. The rest of the address consists of 2k fields ei , for 0 ≤ i ≤ 2k − 1, and each field has m bits. Therefore, an MC(k, m) uses 2k m + k bits to identify a node and the total number of nodes is 2n where n = 2k m + k.
376
Y. Li, S. Peng, and W. Chu 2k m + k bits c
e2k −1
e2k −2
k bits
m bits
m bits
class
...
e1
e0
m bits
m bits
2k m bits Fig. 4. Address format of metacube
Referring to Figure 4, the nodes in an MC(k, m) are connected with the following method. There are k + m links per node. For any two nodes whose addresses differ only in a bit position in the class ID, there is a link connecting these two nodes. This is, the k-bit class ID defines a high-level k-cube. The links in the k-cube is called cross-edge. Among the 2k fields ei , for 0 ≤ i ≤ 2k − 1, only the field ec forms a low-level m-cube with m links, where c is the class ID of the node. The links in an m-cube is called cube-edges. For example, the three neighbors within the low-level m-cube of the node with address (01, 111, 101, 110, 000) in an MC(2, 3) have addresses (01, 111, 101, 111, 000), (01, 111, 101, 100, 000), and (01, 111, 101, 010, 000). The underlined bits are those that differ from the corresponding bits in the address of the referenced node. The two neighbors in the high-level k-cube are (00, 111, 101, 110, 000) and (11, 111, 101, 110, 000). An MC(2, 1) is shown in Figure 5 in which we drew only the cross-edges of nodes (xx, 0, 0, 0, 0) in addition to the cube-edges. The value of k affects strongly the growth rate of the size of the network. An MC(1, m) containing 22m+1 nodes is called a dual-cube. Similarly, an MC(2, m), an MC(3, m), and an MC(4, m) containing 24m+2 nodes, 28m+3 nodes, and 216m+4 nodes, are called quad-cube, oct-cube, and hex-cube, respectively. Since an MC(3, 3) contains 227 nodes, the oct-cube is sufficient to construct practically supercomputers of very large size. The hex-cube is of theoretical interest only. Note that an MC(0, m) is a hypercube. An MC(k, m) has much less links than the corresponding n-cube for n = 2k m + k, and hence, the point-to-point communication in metacubes is little bit complex than that in hypercubes. In a metacube, communication between two nodes that are not in a same m-cube must go through the k-cube so that the different address bits of the two nodes in all the fields ei , for 0 ≤ i ≤ 2k − 1, can be routed. The following example shows the routing path between nodes s = 01, 111, 101, 110, 000 and t = 10, 110, 001, 100, 100: 01, 111, 101, 110, 000 − 01, 111, 101, 100, 000 − 00, 111, 101, 100, 000 − 00, 111, 101, 100, 100 − 10, 111, 101, 100, 100 − 10, 111, 001, 100, 100 − 11, 111, 001, 100, 100 − 11, 110, 001, 100, 100 − 10, 110, 001, 100, 100 This address presentation is cluster-based. It is efficient for the collective communications. In order to perform the bitonic sorting in metacube networks efficiently, we use a new presentation, called class-based, as shown as in Figure 6. The value c of the least significant k bits (bits k − 1, . . . , 1, 0) defines the class ID of a node. These k bits form a k-cube, which is the same as the high-level k-cube in the original address definition. Next to the class ID, there m fields fi , for 1 ≤ i ≤ m. Each field has 2k bits. Among these 2k bits in field fi , for 1 ≤ i ≤ m, there is only one bit position j = 2k (i − 1) + c + k at which a link connects node u to another node
An Efficient Parallel Sorting Algorithm on Metacube Multiprocessors 5
4
3
2
377
0
1
Node address: c c=0
c=1
00 0000
00 0001
00 0100
00 0101
01 0000
01 0010
01 0100
01 0110
00 0010
00 0011
00 0110
00 0111
01 0001
01 0011
01 0101
01 0111
00 1000
00 1001
00 1100
00 1101
01 1000
01 1010
01 1100
01 1110
00 1010
00 1011
00 1110
00 1111
01 1001
01 1011
01 1101
01 1111
10 0000
10 0100
10 0010
10 0110
11 0000
11 1000
11 0010
11 1010
10 0001
10 0101
10 0011
10 0111
11 0001
11 1001
11 0011
11 1011
10 1000
10 1100
10 1010
10 1110
11 0100
11 1100
11 0110
11 1110
10 1001
10 1101
10 1011
10 1111
11 0101
11 1101
11 0111
11 1111
c=2
c=3
Fig. 5. The Metacube MC(2,1) 2k m + k bits 2k (m−1)+k ... fm 2k bits
k
0
f1
c
2k bits
k bits class
2k m bits Fig. 6. The new presentation of metacube
u(j) whose address differs from u at the bit position j. We call this link bridge. The m bridges (each field contributes one bridge) form an m-cube which is equivalent to the low-level m-cube in the original address definition. Figure 7 shows an MC(k, m) structure with k = 2 and m = 1 using the new address presentation. A node address has 2k m + k = 22 × 1 + 2 = 6 bits shown in two rows: The 4-bit value in upper row is f1 and the 2-bit value in lower row is the class ID c. Each node has k + m, or 3, links: Two links are used to form a k-cube and one link (bridge) connects two nodes whose addresses differ in c+kth bit position. For example, nodes 0000, 11 and 1000, 11 of class 3 are connected with a bridge because these two nodes’ addresses differ in 3 + 2, or 5th (left-most) bit position.
378
Y. Li, S. Peng, and W. Chu 5
4
3
2
1
0
Node address: c
f1 0000 00
0000 01
0001 00
0001 01
0100 00
0100 01
0101 00
0101 01
0000 10
0000 11
0001 10
0001 11
0100 10
0100 11
0101 10
0101 11
0010 00
0010 01
0011 00
0011 01
0110 00
0110 01
0111 00
0111 01
0010 10
0010 11
0011 10
0011 11
0110 10
0110 11
0111 10
0111 11
1000 00
1000 01
1001 00
1001 01
1100 00
1100 01
1101 00
1101 01
1000 10
1000 11
1001 10
1001 11
1100 10
1100 11
1101 10
1101 11
1010 00
1010 01
1011 00
1011 01
1110 00
1110 01
1111 00
1111 01
1010 10
1010 11
1011 10
1011 11
1110 10
1110 11
1111 10
1111 11
Fig. 7. The MC(2,1) with new presentation
Next, we explain the reasons of why we use this new presentation for the design of efficient algorithms such as sorting algorithm on metacube. Using the new presentation, if we map a k-cube to a single super-node then an MC(k, m) will be mapped onto a 2k m-cube; a bridge that connects nodes in distinct super-nodes in MC(k, m) becomes a hypercube edge. Mapping each 2-cube in Figure 7 into a single super-node, we get a 4-cube. Therefore, communications among k-cubes in MC(k, m) can be treated exactly as that in hypercube. For communications inside a k-cube, we can use collective communication procedures such as broadcast, gather, scatter etc., to collect or distribute data from a specific node to all other nodes in the k-cube. For sorting on a metacube, we use the new address presentation of the metacubes and bitonic sorting algorithm. The communications between the node pairs in the bitonic sorting on a metacube can be done with gather and scatter operations through bridges efficiently which we describe in the next section.
4 Sorting on Metacube In this section, we present a new sorting algorithm on metacube based on the parallel bitonic sorting. Given an MC(k, m), we assume that each node in MC(k, m) holds a single element (number). The sorting algorithm compares and exchanges elements so that, at the end, all the elements are in the ascending order arranged by their addresses.
An Efficient Parallel Sorting Algorithm on Metacube Multiprocessors Dimensions: Node address:
5
3
4
2
0
1 c
f1 0000 00
0000 01
0001 00
0001 01
0000 00
0000 01
0010 00
0010 01
0000 10
0000 11
0001 10
0001 11
0000 10
0000 11
0010 10
0010 11
(a) Dimension 2 (c = 0)
(b) Dimension 3 (c = 1)
0000 00
0000 01
0100 00
0100 01
0000 00
0000 01
1000 00
1000 01
0000 10
0000 11
0100 10
0100 11
0000 10
0000 11
1000 10
1000 11
(c) Dimension 4 (c = 2)
379
(d) Dimension 5 (c = 3)
Fig. 8. Bridges in dimensions 2, 3, 4, and 5
The parallel sorting on metacubes is based on the bitonic sorting on hypercubes. The basic operation is compare-and-exchange: Nodes u and u(j) whose addresses differ in jth bit position for 0 ≤ j ≤ 2k m + k − 1 send their elements to each other. Nodes u and u(j) retain the smaller number and bigger number, respectively, if u < u(j) . However, there may be no direct links in some dimensions between nodes u and u(j) in a metacube. As we described in the previous section, the node address has 2k m + k bits (dimensions) and there are only k + m links per node in an MC(k, m). For a dimension j, if 0 ≤ j ≤ k − 1, there is a link between nodes u and u(j) , otherwise, there is a link (bridge) only in the dimension j that satisfies (j − k) MOD 2k = c where c is the class ID of nodes u and u(j) . Figure 8 shows the four bridges of the 2-cube in which the field f1 of the node addresses is 0000 in an MC(2, 1). In the case of Figure 8(b), the two node in every pair (0, 8), (1, 9), (2, a), and (3, b) communicate simultaneously. Nodes 1 and 9 can send their elements to each other directly because there is a link (bridge) between the two nodes. The other three pairs cannot do it directly due to the lack of the direct links: They must go through the bridge that links nodes 1 and 9. Because nodes 0, 1, 2, and 3 are in the same 2-cube, we can gather elements of the four nodes to node 1, send the gathered elements to node 9 via the bridge, and then scatter the received elements to nodes 8, 9, a, and b. We can do the similar operations in the opposite direction. Generally, in the gather operation, a single node collects a unique message from each node (also called concatenation). In the scatter operation, a single node sends a unique message to every other node (also called a one-to-all personalized communication). The scatter operation is exactly the inverse of the gather operation. Figure 9 shows the communication steps for the gather and scatter operations on the two 2-cubes of Figure 8(b).
380
Y. Li, S. Peng, and W. Chu
{0}
{1}
{8}
{9}
{0}
{1, 0}
{8}
{9, 8}
{1, 0, 3, 2}
{9, 8, b, a}
{2}
{3}
{a}
{b}
{2}
{3, 2}
{a}
{b, a}
{3, 2}
{b, a}
(a) Data distribution {9, 8, b, a}
(d) Exchange
(b) Gathering via dim. 0
{1, 0, 3, 2}
(c) Gathering via dim. 1
{9, 8}
{1, 0}
{8}
{9}
{0}
{1}
{b, a}
{3, 2}
{a}
{b}
{2}
{3}
(e) Scattering via dim. 1
(f) Scattering via dim. 0
Fig. 9. Gather and scatter in dimension 3
In Figure 9(a), node i for i = 0, 1, 2, 3, 8, 9, a, b, contains its element {i}. In Figure 9(b), the arrowed lines denote the communication direction along with the dimension 0, that is, four nodes 0, 2, 8, and a send their elements to nodes 1, 3, 9, and b, respectively. Nodes 1, 3, 9, and b concatenate the received elements with their own elements. In Figure 9(c), the communications take place in dimension 1. Note that only two nodes 3 and b send their own elements gathered in the first step, and nodes 1 and 9 concatenate the received elements with their own elements. At this step, nodes 1 and 9 have gathered the entire elements within their 2-cube, respectively. Then, nodes 1 and 9 send the gathered elements to each other through the bridge as shown as in Figure 9(d). Figures 9(e) and 9(f) show the steps of the scatter operation which is the reverse of the gather operation. As the final result, every node contains the element of its partner in addition to its original element. There are 2k + 1 communication steps in total: Each of the gather and scatter operations takes k steps and the exchange through the bridge requires one step. We formally give the gather and scatter algorithm in Figure 10. In an MC(k, m), node u = my id sends the element number in to node u(j) and receives the element number out from node u(j) where the addresses of nodes u and u(j) differ in the j bit position and 0 ≤ j ≤ 2k m + k − 1. The exchange of the elements is done with the gather and scatter operations through the bridge. In Figure 10, my class = my id AND (2k − 1) is the class ID of node u; bridge class = (j − k) MOD 2k is the class ID of two nodes which are connected with the bridge; and class diff = my class XOR bridge class is the dimension difference between the classes of my class and bridge class that is used to control the sending and receiving operations. The algorithm is composed of three parts: 1) gathering elements to a node of bridge class; 2) exchanging elements through the bridge; and 3) scattering elements to nodes in k-cube. The gather operation collects elements from all the nodes in the k-cube to a node of bridge class. This is done by a for loop with i = 0, 1, . . . , k− 1. Because the communication patterns of the nodes in the k-cube are not same, we must control the sending and receiving operations of the nodes based on class diff, i and mask. The mask makes the number of the nodes that participate sending and receiving
An Efficient Parallel Sorting Algorithm on Metacube Multiprocessors Gather scatter (number in, my id, k, j, number out) begin my class ← my id AND 2k − 1; bridge class ← (j − k) MOD 2k ; class diff ← my class XOR bridge class; /* 1. Gathering elements to a node of bridge class */ R ← {number in}; mask ← 0; for i ← 0 to k − 1 do /* Select nodes whose lower i bits are 0 */ if (class diff AND mask = 0) if (class diff AND 2i = 0) msg destination ← my id XOR 2i ; send R to msg destination; else msg source ← my id XOR 2i ; receive S from msg source; R ← R ∪ S; mask ← mask XOR 2i ; /* 2. Exchanging elements through the bridge */ if (class diff = 0) partner ← my id XOR 2j ; send R to partner; receive S from partner; /* 3. Scattering elements to nodes in k-cube */ mask ← 2k − 1; for i ← k − 1 downto 0 do mask ← mask XOR 2i ; if (class diff AND mask = 0) if (class diff AND 2i = 0) msg destination ← my id XOR 2i ; send second half of S to msg destination; S ← first half of S; else msg source ← my id XOR 2i ; receive S from msg source; number out ← S; end
381
/* Set bit i of mask to 1 */ /* my class = bridge class */
/* Set bit i of mask to 0 */
Fig. 10. Gather and scatter on MC(k,m)
operation to be half for the next loop iteration. R is the collected element set to which the received element S is concatenated. After finishing the gather operation, R contains all the elements of the nodes in the k-cube and is sent to another node through the bridge. The scatter operation distributes each element of the received element set S to all the nodes in the k-cube. It is the reverse of the gather operation. As the output of the algorithm, each node u gets an element number out of the node u(j) . The sorting algorithm on metacubes is given in Figure 11. When the dimension is less than k, we perform send and receive directly between the two nodes of a node pair; otherwise, we perform Gather scatter operations to exchange the elements.
382
Y. Li, S. Peng, and W. Chu
Bitonic sort metacube (my id, my number, k, m, result) begin n ← 2k m + k; result ← my number; for i ← 0 to n − 1 do for j ← i downto 0 do if (j < k) partner ← my id XOR 2j ; send result to partner; receive number from partner; else Gather scatter (result, my id, k, j, number); if (my id AND 2i+1 = my id AND 2j ) if (number > result) result ← number; else if (number < result) result ← number; end
/* direct communication in k-cube */
/* gather and scatter via k-cube */ /* max */
/* min */
Fig. 11. Bitonic sorting algorithm on MC(k, m)
Theorem 1. In the bidirectional channel and 1-port communication model, bitonic k sorting in an MC(k, m) with N = 22 m+k nodes can be done in (2k m + k)2 computation steps and (2k m(2k + 1) + k)2 communication steps, respectively. Proof: We first show that the correctness of the algorithm Bitonic sort metacube. We define a 2k -to-1 mapping from the set of vertices of MC(k, m) onto the set of vertices of 2k m-cube as follows: f : bn−1 . . . b1 b0 → bn−1 . . . bk , where n = 2k m + k. From the new presentation of metacube, the bridges of MC(k, m) are mapped onto the edges of 2k m-cube. That is, MC(k, m) is mapped onto a 2k m-cube. After mapping, the operations in step 1 and step 3 in algorithm Gather scatter become local memory accesses. It is easy to see that the algorithm Bitonic sort metacube emulates the algorithm Bitonic sort hypercube in the mapped 2k m-cube with each node holding 2k numbers. Therefore, from the algorithm Gather scatter which gathers 2k elements in a k-cube and scatters them to another k-cube via a bridge (an edge in the mapped 2k m-cube), we conclude that the algorithm emulates the algorithm Bitonic sort hypercube correctly. Next, we assume that the edges in MC(k, m) are bidirectional and each node in MC(k, m) can receive a message, concatenate it with local data and send the concatenated message to its neighbor in one time unit. In the proposed algorithm, at each iteration, all pairs of nodes in MC(k, m), (u, u(j) ) for a specific dimension j, should perform the compare-and-exchange operation. This is done by performing Gather scatter for every pair of k-cubes that requires a total of 2k + 1 communication steps for a single compare-and-exchange operation. Therefore, the communication time Tcomm (n) and computation time Tcomp of the proposed algorithm are (2k m(2k + 1) + k)2 and (2k m + k)2 , respectively. ♦
An Efficient Parallel Sorting Algorithm on Metacube Multiprocessors
383
5 Concluding Remarks In this paper, we showed an efficient sorting algorithm on MC(k, m) that uses a new presentation of the metacube. Based on the new presentation, the hypercube algorithms can be emulated effectively. The overhead for the emulation is mainly due to communicate between the two matched k-cubes through a bridge. Since k is small (k ≤ 3 for any possible practical parallel computers), the overhead for the communication is relatively small. The future work includes the following: (1) Generalize the proposed algorithm for sorting input sequences of any size on metacube and perform simulations and empirical analysis for the proposed algorithm. (2) Investigate and develop more application algorithms on metacube based on the new presentation.
References 1. Batcher, K.E.: Sorting networks and their applications. In: Proceedings of AFIPS Spring Joint Computer Conference, April 1968, pp. 307–314 (1968) 2. Chen, S.-Y., Kao, S.-S.: The edge-pancyclicity of dual-cube extensive networks. In: Proceedings of the 2nd WSEAS International Conference on Computer Engineering and Applications, Acapulco, Mexico, January 2008, pp. 233–236 (2008) 3. Hayes, J.P., Mudge, T.N.: Hypercube supercomputers. Proc. IEEE 17(12), 1829–1841 (1989) 4. Jiang, Z., Wu, J.: Fault-tolerant routing in dual-cube networks. In: Proc. of the 7th Joint Conference on Information Sciences, September, pp. 389–392 5. Kumar, V., Grama, A., Gupta, A., Karypis, G.: Introduction to parallel computing: design and analysis of algorithms. Benjamin/Cummings Press (1994) 6. Laia, C.-J., Tsai, C.-H.: On embedding cycles into faulty dual-cubes. Information Processing Letters 109(2), 147–150 (2008) 7. Leighton, F.T.: Introduction to Parallel Algorithms and Architectures: Arrays, Trees and Hypercubes. Morgan Kaufmann Pub., San Francisco (1992) 8. Li, Y., Peng, S., Chu, W.: Efficient communication in metacube: A new interconnection network. In: Proceedings of the International Symposium on Parallel Architectures, Algorithms and Networks (I-SPAN 2002), Manila, Philippines, May 2002, pp. 165–170 (2002) 9. Li, Y., Peng, S., Chu, W.: Metacube – a new interconnection network for large scale parallel systems. Australian Computer Science Communications 24, 29–36 (2002) 10. Parhami, B.: Introduction to parallel processing, algorithm and architecture. Plenum Press (1999) 11. Venkata Rao, M., Chalamaiah, N.: Routing and broadcasting algorithms for a metacube interconnection topology for large scale parallel systems. In: Proceedings of Asia Pacific Confeence on Parallel and Distributed Computing Technologies, December 2004, pp. 1037–1049 (2004) 12. SGI. Origin2000 Rackmount Owner’s Guide, 007-3456-003 (1997), http://techpubs.sgi.com/ 13. Tucker, L.W., Robertson, G.G.: Architecture and applications of the connection machine. IEEE Computer 21, 26–38 (1988) 14. Wu, C., Wu, J.: On self-similarity and hamiltonicity of dual-cubes. In: Proc. of Workshop on Massively Parallel Processing (in conjunction with IPDPS) (April 2003)
An On-Line Parallel Algorithm for Node Ranking of Trees Chia-Wei Lee1 , Justie Su-Tzu Juan2, , and Tai-Lung Wu2 1
2
Department of Computer Science and Information Engineering, National Cheng Kung University, No. 1, University Road, Tainan 701, Taiwan Department of Computer Science and Information Engineering, National Chi Nan University, No. 1, University Road, Puli, Nantou 545, Taiwan
[email protected]
Abstract. A node ranking of a graph G = (V, E) is a proper node coloring C : V → N such that any path in G with end nodes x, y fulfilling C(x) = C(y) contains an internal node z with C(z) > C(x). In the on-line version of the node ranking problem, the nodes v1 , v2 , ..., vn are coming one by one in an arbitrary order; and only the edges of the induced subgraph G[{v1 , v2 , ..., vi }] are known when the color for the node vi be chosen. And the assigned color can not be changed later. In this paper, we present a parallel algorithm to find an on-line node ranking for general tree. Our parallel algorithm needs O(n log 2 n) time with using O(n3 / log2 n) processors on CREW PRAM model. Keywords: Node ranking, on-line, algorithm, tree, parallel algorithm, PRAM.
1
Introduction
Given a graph G with n nodes, a node ranking problem is to assign an integer number, called rank (or color ), to each node such that any path between two nodes of the same rank passes through at least one node with greater rank. The optimal node ranking problem is the problem of minimizing the number of distinct ranks. The investigation of node ranking problem, also called ordered coloring problem [16], is important in many filed, such as computing Cholesky factorizations of matrices in parallel [4,11,22], scheduling problem of assembly steps in manufacturing systems [11,12,27], and finding the minimum-height elimination tree of a graph [7,27], and other applications in the field of VLSI-layout [19,26]. In this paper, we will consider the on-line version of node ranking problem. In such a version, nodes of a graph G are coming in an arbitrary order. The nodes of the graph G are colored one by one in such a way that only a local information
Corresponding author.
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 384–395, 2009. c Springer-Verlag Berlin Heidelberg 2009
An On-Line Parallel Algorithm for Node Ranking of Trees
4
2
2 1
1 1
2
3
1
(a)
1 3
v3
v2
v1
v6 v4 v5
385
4 1
v7 v8
1 5 1
(b)
Fig. 1. (a) A node ranking of a tree; (b) an on-line version example of a tree
that concerning edges between already present nodes is known when a rank of a node is chosen. The assigned rank can not be changed later. Figure 1 illustrates the examples of node ranking of a tree with off-line and on-line version. In Figure 1(b), the sequence, v1 , v2 , . . . , v8 , is the input sequence of the nodes of tree. Now, we define the node ranking problem theoretically. Let G = (V, E) be a simple graph with node set V and edge set E. A node k-ranking (node ranking) of G is a proper node coloring C : V → {1, 2, . . . , k} such that every path in G with end nodes x and y of the same color C(x) = C(y) contains a node z with greater color C(z) > C(x). The node ranking number χr (G) is the smallest integer k for which there exists a node k-ranking of G. A node k-ranking C of G is called optimal if max{C(x)|x ∈ V (G)} = χr (G). For a positive integer c, an c-node-ranking of a graph G is a labeling of the nodes of G with positive integer such that, for any label λ, deletion of all nodes with label great than λ leaves components, each having at most c nodes with with label λ. Clearly, an ordinary node ranking is a 1-node-ranking. The c-node-ranking problem is to find a c-node-ranking of a given graph using the minimum number of ranks. The minimum number of ranks needed for a c-node-ranking of G is called the c-node-ranking number. The graph G is called on-line node k-rankable if there is an algorithm that generates a node k-ranking of G for every possible input sequence of the nodes of G. That means the nodes v1 , v2 , ..., vn are coming one by one in an arbitrary order; and only the edges of the induced subgraph G[{v1 , v2 , ..., vi }] are known when the color of vi has to be chosen. The on-line node ranking number χ∗r (G) is the smallest positive integer k such that G is on-line node k-rankable. An on-line algorithm that generates a node ranking for graph G is called an on-line node ranking algorithm for G, and an on-line node ranking algorithm is called optimal if the resulting node ranking is optimal. In the recent year, there are some results about node ranking number with offline version. Iyer et al. [10] have presented an algorithm to find an optimal node
386
C.-W. Lee, J.S.-T. Juan, and T.-L. Wu
ranking of a tree with time complexity is O(n log n). After that, Sch¨ affer [23] improved their work and obtained a linear-time algorithm for finding an optimal node ranking of a tree. And Katchalski et al. [16] proved that χr (T ) ≤ 1 + log2 |V (T )| for all tree T and also proved some theorems on planar graphs in 1995. Deogun et al. [6] solved the node ranking problem on interval graphs in O(n3 ) time, on permutation graphs in O(n6 ) time, on circular-arc graphs in O(n3 ) time, and on d-trapezoid graphs in O(n3 χr (G)3d−3 ), where n is the number of nodes of the input graph and χr (G) is the node ranking number of G. Yu [30] gave an algorithm with O(n) time to solve on cographs in 1994. In 1996, Wang and Yu [28] also solved this problem on interval graphs in O(αn3 ) where α is the clique number of interval graph. In [17], Kloks et al. proved that to find the node ranking number on asteroidal triple-free graphs is NP-complete. Abbas and Stewart [1] solved this problem on biconvex graphs in O(n4 (n + m)). And Hsieh [9] solved it on starlike graphs in O(n + m). For c-node-ranking problem, Zhou et al. [31] have obtained a linear-time algorithm to solve the c-noderanking problem for trees. Kashem et al. [15] have presented a polynomial-time algorithm for the c-node-ranking of partial k-tree. And Hashem et al. [8] have presented a linear-time algorithm for solving the c-node-ranking problem on a starlike graph. For parallel algorithm with off-line version, Liang et al. [20] gave parallel algorithms to find the node ranking number for trees in O(log n) time on CREW PRAM model, and in O(log2 n) time on EREW PRAM model. Yu [30] solved the node ranking parallel problem on cographs in O(n log n) time. After that, Liu and Yu [21] improved the work of Yu [30] and obtained an O(log n) time parallel algorithm on cographs. Recently, Kashem et al. [14] have presented an optimal parallel algorithm to solve the c-node-ranking problem on trees for any positive integer c in time O(log2 n) using linear operations on the EREW PRAM model. In the on-line version of node ranking problem, Bruoth and Horˇ na´k [5] found the bound of χ∗r (G) for G is path or cycle in 1999. Furthermore, in 2000, Schiermeyer et al. [24] showed the conditions of a graph G which has on-line node ranking number 3, denoted by ∗3 . Theorem 1. [5] If we apply greedy algorithm to find an on-line node ranking, then 1. For any n ∈ [1, ∞], log2 n + 1 ≤ χ∗r (Pn ) ≤ 2log2 n + 1. 2. For any n ∈ [3, ∞], log2 (n − 1) + 1 ≤ χ∗r (Cn ) ≤ 2log2 n + 1. Lemma 1. [10] Let Tn be a tree with n nodes. Then χr (Tn ) ≤ log3/2 n. There are so few results about the on-line node ranking problem had been done, and on-line version is more practical than off-line version. Therefore, we shall discuss it in some important network structures. Since trees are the most fundamental class of network topologies, we focus on on-line ranking of trees. In this paper, we present an on-line node ranking algorithm for trees in parallel. Our
An On-Line Parallel Algorithm for Node Ranking of Trees
387
parallel algorithm needs O(n log2 n) time which is better than the sequence algorithm which was presented in [18] (the sequence algorithm needs O(n3 ) time). The organization of this paper is shown as following: First of all, we the sequence algorithm for on-line node ranking of general trees in Section 2. Secondly, we present the parallel on-line node ranking algorithm for general trees in Section 3. Finally, we summarize the results and give some future work in Section 4.
2
Sequential Algorithms
In this section, we show the on-line node ranking algorithm for general trees with sequential method which was presented in [18]. The time complexity of the sequence algorithm is O(n3 ). The sequence algorithm used the idea of greedy algorithm. As each node was added, the algorithm have to choose a suitable color for ranking this new node. The algorithm uses an table (array) for each node to help us to record which color can not be chosen to rank next new neighbor of this node. After selected a color to rank the new node, this color may not be a suitable color for other new nodes any more. So, the algorithm modified each table for any old node after ranking a new node. The sequence algorithm used DFS (Depth-First-Search) technique for trees to modify each table. The sequence algorithm is shown as follows. In the sequence algorithm, an array color array[vi][j] is used to record any next new neighbor of vi can be colored with color j or not, 1 for yes, 0 for not. When each new node was added, Procedure Rank will choose a best suitable color for the new in-coming node and it will call the other two procedures. The Procedure Color Array is used to create a new color array for the new node. The Procedure Modify Color Array is used to modify the color array of the old nodes to keep the correctness of color array.
Algorithm ST(T, n) Input: An integer n = the number of nodes of tree T . Output: Assignment c of the colors to the nodes. 1: for k ← 1 to n do 2: Read the new node vk and the neighbors of vk T [{v1 , v2 , · · · , vk−1 }], say u1 , u2 , · · · , um 3: for i ← 1 to n do 4: color array[vk ][i] ← 1 5: Rank(vk ) Fig. 2. Algorithm ST
in T ∗
=
388
C.-W. Lee, J.S.-T. Juan, and T.-L. Wu
Procedure Rank(vk ) 1: if m = 0 then 2: c(vk ) ← 1 3: color array[vk ][1] ← 0 4: else 5: for j ← 1 to n do 6: combine[j] = 1≤i≤m color array[ui ][j] 7: 8: 9: 10: 11: 12:
find the smallest color in which combine[color] = m, and for each i > color, combine[i] ≥ m − 1 c(vk ) ← color Color Array(vk , color) for i ← color to n do if color array[vk ][i] = 0 then Modify Color Array(vk , i) Fig. 3. Procedure Rank(vk )
Procedure Color Array(vk , color) 1: for i ← 1 to color − 1 do 2: color array[vk ][i] ← 1 3: color array[vk ][color] ← 0 4: for i ← color + 1 to n do 5: if combine[vk ] = m then 6: color array[vk ][i] ← 1 7: else 8: color array[vk ][i] ← 0 Fig. 4. Procedure Color Array(vk , color)
Procedure Modify Color Array(v, i) 1: for any node u adjacent to v do 2: if c(u) ≤ i then 3: color array[u][i] ← 0 4: Modify Color Array(u, i) Fig. 5. Procedure Modify Color Array(v, i)
3
Parallel Algorithm
The parallel algorithm is presented based on the sequence algorithm. In the parallel algorithm, we consider it is running in CREW PRAM model. We use some well known parallel techniques and its applications in our parallel algorithm,
An On-Line Parallel Algorithm for Node Ranking of Trees
389
these techniques is useful for reducing the time complexity. We also use five new arrays in the algorithm: mark[i], modif y[vk ][i], ancestor[vi ][vj ], n ancestor[vi ], and AN C[vi ][j]. The array mark[i] is used to help us when we want to choose a suitable rank to color a new node. The array modify[vk ][i] is used to record color array[vk ][i] is need to be renew or not when a new node be colored, 1 for yes, 0 for not. The array ancestor[vi ][vj ] is recorded whether node vj is an ancestor of node vi or not, 1 for yes, 0 for not. The array n ancestor[vi ] is used for record the number of ancestors of node vi . And the array ANC[vi ][j] saved the sum of modify[vm ][j] for all ancestor vm of vi in color j. In our parallel algorithm, we used two parallel techniques: Prefix Computation and Interval Broadcasting. The Prefix Computation is useful for counting the times of used for each color, and the Interval Broadcasting is useful for confirming which colors can not be used again. Except these two parallel techniques, we also used Euler Tour technique and its application in Procedure Ancestor. The Procedure Ancestor is useful for finding ancestors for each node in tree. It is help us to modify color array. After running this procedure when given a tree T ∗ rooted at vk , we have a k × k matrix which records whether vi is an ancestor of vj . We use ancestor[vi ][vj ] to represent whether vi is an ancestor of vj , 1 for yes, 0 for not. Given the preorder of the tree and the descendants of node vj , the question whether vi is an ancestor of vj can be answered in constant time using one processor. Since we use the results of Euler tour to perform the preorder of the tree T ∗ , the parents of every node, and the descendants of every node in O(log n), O(1) and O(1) with using O(n) processors, respectively. And to find the Euler tour can be done in O(1) with using O(n) processors. Hence, the Procedure Ancestor can be done in O(log n) with using O(n/ log n) processors. All of these parallel techniques can be found in [2] or [13].
Algorithm PT(T, n) Input: An integer n = the number of nodes of tree T . Output: Assignment c of the colors to the nodes. 1: for k ← 1 to n do 2: Read the new node vk and the neighbors of vk in T [{v1 , v2 , · · · , vk−1 }] = T ∗ , say u1 , u2 , · · · , um 3: for i ← 1 to n do 4: color array[vk ][i] ← 1 5: Rank(vk ) Fig. 6. Algorithm PT: Parallel Algorithm for On-Line Ranking of Tree
Now, we analyze Algorithm PT. In Procedure Modify Color Array, processors may read from the same memory location for modify[vm ][j] at the same time and exclusive write in line 12. And it is easy to see that the other steps of Algorithm PT are exclusive read and exclusive write. Thus, our parallel algorithm is running in CREW PRAM model.
390
C.-W. Lee, J.S.-T. Juan, and T.-L. Wu
Procedure Rank(vk ) 1: if m = 0 then 2: c(vk ) ← 1 3: color array[vk ][i] ← 0 4: else 5: for j ← 1 to n pardo 6: Apply Prefix Computation 1≤i≤m color array[ui ][j] 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28:
to
compute
combine[j]
=
for j ← 1 to n pardo Choose a suitable color if combine[j] < m − 1 then mark[j] ← 0 else mark[j] ← −1 Apply Interval Broadcasting on mark array with leader set S, where S = {i |mark[j]=0,1 ≤ i ≤ r} for j ← 1 to n pardo if combine[j] < m − 1 then mark[j] ← 0 if combine[j] ← m and mark[j] ← −1 then mark[j] ← 1 Apply Prefix Computation on mark array for j ← 1 to n pardo if mark[j] ← 0 then mark[j] ← 1 else mark[j] ← 0 Apply Prefix Computation on mark array color ← mark[n] + 1 Find the suitable color c(vk ) ← color Color Array(vk , color) Modify Color Array(vk , color) Fig. 7. Procedure Rank(vk )
In [2] or [13], we know the time complexity of Prefix Computation and Interval Broadcasting both are O(log k) with using O(k/ log k) processors, where k is the size of input array. Then, the time complexity of Algorithm PT is evaluated as following. To combine the m color array which the m nodes adjacent to vk is O(log m) using O(nm/ log m) processors. To find the smallest color from color array of vk and give a color for vk can be done in O(log n) using O(n) processors. The Procedure Color Array can be performed in O(1) time using O(n) processors. And we need O(log k) time to find ancestors for each node using O(k 2 / log k) processors in Procedure Ancestor. Note that line 12 in Procedure Modify Color Array will take O(log k×log n) time and using O(k×(n/ log n)×(k/ log k)) processors. Thus, to performed the Procedure Modify Color Array need O(log k × log n) time
An On-Line Parallel Algorithm for Node Ranking of Trees
391
Procedure Color Array(vk , color) 1: for i ← 1 to n pardo 2: if i < color then 3: color array[vk ][i] ← 1 4: if i ← color then 5: color array[vk ][i] ← 0 6: if i > color then 7: if the combine[i] ← m then 8: color array[vk ][i] ← 1 9: else 10: color array[vk ][i] ← 0 Fig. 8. Procedure Color Array(vk , color)
Procedure Modify Color Array(v, color) 1: for i ← color to n pardo 2: if color array[vk ][i] gets0 then 3: modify[vk ][i] ← 0 4: for j ← 1 to k − 1 pardo 5: if c(vj ) < i then 6: modify[vj ][i] ← modify[vk ][i] 7: else 8: modify[vj ][i] ← 0 ∗ 9: Ancestor(T , vk ) Find the ancestors for all nodes in which T ∗ 10: for i ← 1 to k pardo 11: Apply Prefix Computation to get n ancestor[vi ]← 1≤m≤k ancestor[vk ][vi ] 12: for i ← 1 to k pardo 13: for p ← 0 to log n − 1 pardo 14: for j ← p × (n/ log n) to (p + 1) × (n/ log n) pardo 15: Apply Prefix Computation to get 1≤m≤k modify[vm ][j], where ancestor[vm ][vi ] ← 1 16: if ANC[vi ][j] = n ancestor[vi ] then 17: modify[vi ][j] ← 0 18: if modify[vi ][j] ← 1 then 19: color array[vi ][j] ← 0
ANC[vi ][j]
←
Fig. 9. Procedure Modify Color Array(v, color)
using O((k 2 n)/(log k log n)) processors. The time complexity of Algorithm PT is simply the sum of the Procedures Color Array and Modify Color Array over all n nodes in the tree. Thus, the time complexity of the Algorithm PT is Σ1≤m≤k (O(log m) + O(log n) + O(1) + O(log k log n)) = O(n log2 n).
392
C.-W. Lee, J.S.-T. Juan, and T.-L. Wu
And the number of processors that we need is max1≤k≤n max{O(nm/ log m), O(n), O(n), O(k 2 / log k), O(k 2 n/ log k log n)} = O(n3 / log2 n). Then, this parallel algorithm can be performed in O(n log2 n) time using n3 / log2 n processors. Thus, the cost of this parallel algorithm is O(n log2 n) × O(n3 / log2 n) = O(n4 ). Lemma 2. Lines 8–20 of Procedure Rank in Algorithm PT are equivalent to line 7 of Procedure Rank in Algorithm ST. Proof. Line 7 of Procedure Rank in Algorithm ST is to find the smallest color in which combine[color] = m, and for each i > color, combine[i] ≥ m − 1. In Procedure Rank of Algorithm PT, line 8–20 is used for avoid to choose a color k suck that combine[k] < m− 1. Line 11 which apply Interval Broadcasting will let the array mark array to be mark[1] = mark[2] = · · · = mark[a] = 0, and mark[a + 1] = mark[a + 2] + · · · + mark[n] = −1 for some 1 ≤ a ≤ n. That means, for all k ≥ a, combine[k] ≥ m − 1. Lines 13–14 is used to ensured the algorithm must choose the color with combine[color] = m. Then, we apply Prefix Computation in line 15, and we can know if mark[j] = 0, then color j can not be used certainly. In line 16–18, we exchange 1 and 0 in the values of mark array for succeeding computation. It will help us to compute how many colors can not be used. In line 19, we apply Prefix Computation again. After this step, we can obtain how many colors can not be used for rank vk . Finally, in line 20, we choose the smallest colorable color to rank vk . Hence, we obtain that the lines 8–20 of Procedure Rank in Algorithm PT are equivalent to line 7 of Procedure Rank in Algorithm ST. Lemma 3. The Procedure Modify Color Array of Algorithm PT is equivalent to the Procedure Modify Color Array of Algorithm ST. Proof. The Procedure Modify Color Array of Algorithm ST is used to modify color array of the old nodes to keep the correctness. We used DFS (Depth-First-Search) technique in this procedure. When we begin to modify color array for old nodes, if we find a node vi with C(vi ) > C(vk ), then we will not continue to modify color arrays of the children of vi any more. That is, if a node vj has an ancestor with greater color, then color array of node vj need not to modify. In Procedure Modify Color Array of Algorithm PT, lines 1–5 is used to initial the modify array. In line 6, we use Euler Tour technique and its applications to find which nodes are the ancestors for all the nodes in the tree. After this step, we have a k × k matrix ancestor[vi ][vj ], which is recorded whether vi is an ancestor of vj . Then in lines 7–8, we apply Prefix Computation to compute how many ancestors are there for all nodes in tree T ∗ rooted by vk . In line 12, for any 1 ≤ j ≤ n, we apply Prefix Computation to combine modify[vm ][j] for any ancestor vm of vi . And we record this results in ANC[vi ][j]. Line 13 is used to check each node has any ancestor with greater color than j
An On-Line Parallel Algorithm for Node Ranking of Trees
393
or not. If there exist one ancestor of vi with greater color than j, then we set its modify array to be 0. Thus, if there are no ancestor of node vi with greater color than vi , then the number of the ancestor vm of vi with modify[vm ][j] = 1, let this number to be ANC[vi ][j], is equal to the number of the ancestors of vi . So if ANC[vi ][j] is less than the number of the ancestors of vi , then we need not to modify the color array[vi][j]. Finally, for any old node vi of T ∗ which can not have any new neighbor with color j due to the adding of vk , the value of modify[vi ][j] will be 1. Hence, in line 14, we set color array[vi][j] = 0 for this kind node vi and color j. Then, we have already modified the color array of the old nodes to keep the correctness of color array. Theorem 2. Algorithm PT is equivalent to Algorithm ST. Proof. By Lemma 2, we know lines 8–20 will find the suitable color for new node vk , which is equivalent to line 7 of Procedure Rank in Algorithm ST. By Lemma 3, we have the Procedures Modify Color Array in Algorithm ST and Algorithm PT are equivalent. Besides, the other steps of these two algorithms are clearly to see that they are equivalent. Then, we obtain that the Algorithm PT is equivalent to Algorithm ST. By Theorem 2, we know Algorithm ST and Algorithm PT are equivalent. That means each step in Algorithm ST can be performed in Algorithm PT by one or more steps. Hence, the following Corollary is obtained. Corollary 1. The output function C of Algorithm PT is an on-line node ranking of the input tree T .
4
Conclusion and Future Work
The node ranking problem is important in many filed, and the on-line version is more conformed to the real life than off-line version. Trees are the most fundamental class of network topologies. This motivate us focus on finding an on-line node ranking for general tree. In this paper, We have presented a parallel algorithm to find an on-line node ranking for trees. The parallel algorithm needs O(n log2 n) time and O(n3 / log2 n) processors on CREW PRAM model for trees. In our parallel algorithm for trees, lines 10–14 in Procedure Modify Color Array was a bottleneck. Since the cost of sequential algorithm presented in [18] is O(n3 ), but the cost of the parallel algorithm is O(n4 ). We believe that the time complexity or the number of processors can be reduced. Today, there are many algorithms on several special graph classes in off-line version, but few parallel algorithms in off-line version. For the on-line version, there are few on-line algorithms. Then, we will continue our study to present off-line parallel algorithm, and on-line node ranking algorithms for special graph classes, such as cographs, interval graphs, etc., in both sequential and parallel algorithms. And we will discuss the bounds of the values χ∗r (T ) as another future work.
394
C.-W. Lee, J.S.-T. Juan, and T.-L. Wu
References 1. Abbas, N., Stewart, L.K.: Biconvex Graphs: Ordering and Algorithms. Discrete Applied Mathematics 103, 1–19 (2000) 2. Akl, S.G.: Parallel Computation: Models and Methods. Prentice Hall, NJ (1997) 3. Balakrishnan, R., Ranganathan, K.: A Textbook of Graph Theory. Springer, Heidelberg (1999) 4. Bodlaender, H.L., Gilbert, J.R., Hafsteninsson, H., Kloks, T.: Approximating Treewidth, Pathwidth and Minimum Elimination Tree Height. In: Schmidt, G., Berghammer, R. (eds.) WG 1991. LNCS, vol. 570, pp. 1–12. Springer, Heidelberg (1992) 5. Bruoth, E., Horˇ na ´k, M.: On-Line Ranking Number for Cycles and Paths. Discussiones Mathematicae, Graph Theory 19, 175–197 (1999) 6. Deogun, J.S., Kloks, T., Kratsch, D., M¨ uller, H.: On Vertex Ranking for Permutation and Other Graph. In: Enjalbert, P., Mayr, E.W., Wagner, K.W. (eds.) STACS 1994. LNCS, vol. 775, pp. 747–758. Springer, Heidelberg (1994) 7. Duff, I.S., Reid, J.K.: The Multifrontal Solution of Indefinite Sparse Symmetric Linear Equations. ACM Transactions on Mathematical Software 9, 302–325 (1983) 8. Hashem, T., Paul, U.K., Kashem, M.A.: An Algorithm for c-Vertex-Ranking of Starlike Graphs. In: Proceeding of 4th International Conference on Electrical and Computer Engineering ICECE 2006, Dhaka, Bangladesh, pp. 316–319 (2006) 9. Hsieh, S.Y.: On Vertex Ranking of a Starlike Graph. Information Processing Letters 82, 31–135 (2002) 10. Iyer, A.V., Ratliff, H.D., Vijayan, G.: Optimal Node Ranking of Trees. Information Processing Letters 28, 225–229 (1988) 11. Iyer, A.V., Ratliff, H.D., Vijayan, G.: Parallel Assembly of Modular Products-an Analysis. Technical Report, pp. 88–86, Georgia Institute of Technology, Atlanta, GA (1988) 12. Iyer, A.V., Ratliff, H.D., Vijayan, G.: On Edge Ranking Problems of Trees and Graphs. Discrete Applied Mathematics 30, 43–52 (1991) 13. J´ aJ´ a, J.: An Introduction to Parallel Algorithms. Addison-Wesley, Reading (1992) 14. Kashem, M.A., Rahman, M.Z.: An optimal parallel algorithm for c-vertex-ranking of trees. Information Processing Letters 92(4), 179–184 (2004) 15. Kashem, M.A., Zhou, X., Nishizeki, T.: Algorithms for generalized vertex-rankings of partial k-trees. Theoretical Computer Science 240(2), 407–427 (2000) 16. Katchalski, M., McCuaig, W., Seager, S.: Ordered Colorings. Discrete Mathematics 142, 141–154 (1995) 17. Kloks, T., M¨ uller, H., Wong, C.K.: Vertex Ranking of Asteroidal Triple-Free Graphs. In: Nagamochi, H., Suri, S., Igarashi, Y., Miyano, S., Asano, T. (eds.) ISAAC 1996. LNCS, vol. 1178, pp. 174–182. Springer, Heidelberg (1996) 18. Lee, C.W., Juan, J.S.T.: On-Line Ranking Algorithm for Trees. In: Proceeding of the 2005 International Conference on Foundations of Computer Science, Monte Carlo Resort, Las Vegas, Nevada, USA, June 27-30, pp. 46–51 (2005) 19. Leiserson, C.E.: Area Efficient Graph Layouts for VLSI. In: Proceeding of the 21st Annual IEEE Symposium on Foundations of Computer Science, pp. 270–281 (1980) 20. Liang, Y., Dhall, S.K., Lakshmivarahan, S.: Parallel Algorithm for Ranking of Trees. In: Proceedings of the Second IEEE Symposium on Parallel and Distributed Processing, pp. 26–31 (1990) 21. Liu, C.M., Yu, M.S.: An Optimal Parallel Algorithm for Node Ranking of Cographs. Discrete Applied Mathematics 87, 187–201 (1998)
An On-Line Parallel Algorithm for Node Ranking of Trees
395
22. Liu, J.W.H.: The Role of Elimination Trees in Sparse Factorization. SIAM Journal of Matrix Analysis and Applications 11, 134–172 (1990) 23. Sch¨ affer, A.A.: Optimal Node Ranking of Trees in Linear Time. Information Processing Letters 33, 91–96 (1989) 24. Schiermeyer, I., Tuza, Zs., Voigt, M.: On-Line Rankings of Graphs. Discrete Mathematics 212, 141–147 (2000) 25. Semaniˇsin, G., Sot´ ak, R.: On-Line Ranking Number of Certain Classes of Graphs. In: Proceedings of the 4th Cracow Conference on Graph Theory (2002) 26. Sen, A., Deng, H., Guha, S.: On a Graph Partition Problem with Application to VLSI Layout. Information Processing Letters 43, 87–94 (1992) 27. Torre, P., Greenlaw, R., Sch¨ affer, A.A.: Optimal Edge Ranking of Trees in Polynomial Time. In: Proceedings of the 4th Annual ACM-SIAM Symposium on Discrete Algorithms Austin, Texas, pp. 138–144 (1993) 28. Wang, C.W., Yu, M.S.: An Algorithm for the Optimal Ranking Problem on Interval Graphs. In: Proceedings Joint Conference of International Computer Symposium, International Conference on Algorithms, pp. 51–58 (1996) 29. West, D.B.: Introduction to Graph Theory, 2nd edn. Prentice-Hall, Englewood Cliffs (2001) 30. Yu, M.S.: Optimal Node Ranking of Cographs. In: Proceedings of International Computer Symposium, Taiwan, pp. 1–6 (1994) 31. Zhou, X., Nagai, N., Nishizeki, T.: Generalized vertex-rankings of trees. Information Processing Letters 56(6), 321–328 (1995)
An Overview of Prophet Zheng Chen, Yin-Liang Zhao, Xiao-Yu Pan, Zhao-Yu Dong, Bing Gao, and Zhi-Wen Zhong Department of Computer Science and Technology, Xi’an Jiaotong University, Xi’an 710049, China
Abstract. Speculative Multithreading (SpMT) has been proposed as a perspective method to exploit Chip Multiprocessors (CMP) hardware potential. This paper researches speculative thread-level parallelism(TLP) for general-purpose programs. The Prophet system consists of a SpMT compiler framework and a simulator prototype based on the SpMT execution model. In the Prophet system, procedures are represented as weighted control flow graph (WCFG), the thread generator uses structural analysis and heuristic algorithm to partition the WCFG into sub-graphs which represent the candidate threads. Inter-thread data dependences are predicted by pre-computation slice (p-slice) to reduce RAW violation. Since the partition is speculative, thread state control mechanism and multi-versioning cache system are designed to buffer the speculative data, and a snooping bus based cache coherence protocol is used to detect data dependence violation. Simulation-based evaluation shows that the Prophet system could achieve significant speedup for general-purpose programs.1 Keywords: Speculative multithreading; Thread level parallelism; Thread partitioning; Pre-computation slice; Speculative Multithreading Architecture.
1 Introduction Speculative Multithreading (SpMT) proposed an effective mechanism to exploit TLP from general-purpose programs. In SpMT, the program is divided into multi-threads which can be executed in the presence of ambiguous data and control dependences. The SpMT system needs to detect state of the threads and adopts recover mechanism when speculation fails to assure the execution correctness. Since the SpMT compiler doesn't guarantee the independency of data and control, it can parallelize programs which are difficult to parallelize by conventional approaches. This paper presents the Prophet system with a SpMT compiler framework and a simulator based on SpMT execution model which exploits parallelism not only from loops but also from regions outside loops as well. In Prophet Compiler, the structural analysis based thread-partition algorithm considers the granularity of thread, interthread data and control dependences comprehensively to decide a good partition. Also the pre-computation slice (p-slice) is constructed to predict the key dependent values 1
Supported by National High Technology Research and Development Program of China under Contract No.2008AA01Z136.
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 396–407, 2009. © Springer-Verlag Berlin Heidelberg 2009
An Overview of Prophet
397
of speculative thread to solve inter-thread data dependences. We have also designed the thread-state control logic and multi-version cache in SpMT execution model. The cache system is designed to buffer speculative data, and a snooping bus based cache coherence protocol is used for data dependence violation detection. The simulation based evaluation of Olden benchmarks is given. Experimental results show that Prophet can effectively exploit thread-level parallelism from general-purpose programs. The remainder of the thesis is organized as follows. Section 2 introduces the related works. Section 3 describes the framework of Prophet System. In Section 4, the general Prophet compiler framework and the detailed implementation as well as the thread-partition algorithm is given. The execution model and underlying architectural support of Prophet are introduced in Section 5 and the evaluation results are given in Section 6. Finally, Section 7 concludes the paper.
2 Related Works SpMT has received significant research attention in recent years. The representative projects include Multiscalar[1] of Wisconsin university, Hydra CMP[2] of Stanford and SPSM[3] proposed by IBM. One of most famous achievements related to SpMT is SMA[4], proposed by National University of Defense Technology, which combines simultaneous multi-thread (SMT) with SpMT and exploits the TLP of general programs through the instruction-windows produced when threads are speculatively executed. Besides the academic institutions, the industry fields are also researching how to enhance the speed of single thread executed in multi-core. For example, the project called Mitosis[5] is started in 2005 by Intel, whose primary mission is combining hardware with compiler to accomplish speculative multithreading. The major contribution of this thesis is to develop and evaluate a compiler and hardware cooperation based approach to support SpMT. Prophet primarily focuses on general-purpose programs, which are more difficult to parallelize.
3 The Framework of Prophet Figure 1 gives the general framework of Prophet System. SUIF[6] frontend is used to transfer sequential C programs into Low-SUIF-IR. Some optimizations are used to get the LOW SUIF-IR as the input of MACHSUIF back-end[7]. A profiler is implemented to produce profile information from SUIF-IR as forms of annotations. The profile information are fed back to source MIPS assemble code to guide the thread partition. Thread generator is designed as the core compiling pass of Prophet. It constructs a weighted control flow graph from annotated MIPS assemble code, executes the heuristic thread partition algorithm based on analysis of control flow and data flow, inserts thread control instructions, constructs p- slice and finally outputs the MIPS assemble code with thread control instructions. The GNU MIPS assembler and linker are extended to support SpMT. Also a SpMT simulator is designed for simulation based evaluation of the performance of Prophet.
398
Z. Chen et al.
Fig. 1. Framework of Prophet
4 Prophet Compiler Frameworks In the Prophet system, the compiler framework plays an important role, with thread partition as the most important task in compiling programs for multithreaded architectures. This section presents an overview of the general compiler framework of Prophet, with an emphasis on the thread partition algorithm and p-slice construction. The core objective of Prophet compiler is to better transfer sequential procedures to speculative multi-threads according to SpMT execution model (presented in Section 5.1) to obtain thread-level parallelism, and to improve the degree of parallelism by efficient thread partition algorithm and p-slice construction. The thread partition algorithm is aggressive and there can be ambiguous control and data dependences between threads, with the correctness maintained by recovery mechanism at run-time. 4.1 Formal Definition of Thread Model The term thread in the context of SpMT is not the operating system level thread. In the static perspective, it is a program segment defined by the thread control instructions. While in the dynamic point of view it corresponds to an uninterrupted sequence of execution instructions. Following gives the formal definition of procedures and threads. Definition 1. Weighted control flow graph (WCFG) G is a directed digraph, where N and E denotes nodes set and edges set of the procedure respectively. Ins(ni) denotes the dynamic instructions number of node ni. Freq denotes the weight of edge ei provided by profiler, it indicates the execution times of ei, or the iteration times of loop region if the edge is backward. Since the program is represented as WCFG, the thread partition process will be transferred to division of WCFG, where the thread is defined as a connected sub-graph of G. With adding of thread control instructions and p-slices into thread, definition of thread and control flow graph is slightly different. The following is a formal description of thread. Definition 2. Thread T is a directed digraph, where N and E are the same as G, but N0 , S, C, P denote entry node set of thread, spawn points set, CQIP set and p-slices set respectively. Suppose G is a weighted control flow graph, threads set M represents the parallel threads partitioned by SpMT
An Overview of Prophet
399
compiler, then for any thread T, if T ∈ M , then T(N T ) ⊆ G(N) , and T(E T ) ⊆ G(E) . 4.2 Thread Partitioning Algorithm
The main task of Prophet compiler is to identify potential parallelism according to information obtained by static analysis and dynamical collection. For a given sequential program, the compiler needs to point out a series of threads spawn point (SP) and control quasi-independent point (CQIP) as the beginning and end of the speculative thread. During this process, the control dependence, data dependence and thread granularity have to be taken into account to decide a good partition. The candidate thread which have similar granularity, the smallest control and data dependence, and well load balance will give full performance. A number of heuristic rules are used to reduce the complexity of compiler analysis: 1. SP of candidate thread can be anywhere, but CQIP of non-loop region must be located at entry of basic block, and CQIP of loop region must be located before control instruction of last basic block. 2. Both SP and CQIP of candidate thread must be located in the same procedure, or in the same loop region. 3. The length between SP and CQIP of candidate thread must be higher than LOWER_LIMIT to overcome the initialization overhead when creating a thread, and smaller than UPPER_LIMIT to maintain load balance. 4. The data dependence count (number of data dependence arcs) along the likely path between two threads must be smaller than DEP_THRESHOLD to restrict the inter-thread data dependence. The Prophet compiler framework implements a structural based thread partition algorithm according to some heuristic rules to meet the spawn strategies of the SpMT execution model: Any point can be spawn point; Out-of-order spawning[12]; Both control speculative and control non-speculative based partition. Algorithm 1 uses the WCFG with profile information to construct the preorder traversal. Top-down structural analysis used on the profiled WCFG works as follow:
①
②
program structureal_analysis () var P• procedure; begin build_pre_order_traversal(P); changed = true; while(changed){ for(int i = 0; i < num_nodes( ); i++){ found = find_loop_region(node[i]); if(found){ partition_loop(loop L); collapse_loop_region_and_rebuild_cfg(); changed = true; } } }
③
400
Z. Chen et al.
procedure_size := cycles of dynamic instructions contained in procedure P; if(procedure_size < PROCEDURE_SIZE) inline_procedure(procedure P); return; start_block := the entry of procedure P; end_block := the exit of procedure P; curr_thread := create_new_thread(start_block,0,0); curr_thread:=partition_thread(start_block, end_block, curr_thread) ; end.
Function structural_analysis traverses the CFG P and partitions the procedure into multiple speculative threads. First, identify the loop regions and non-loop regions in find_loop_region. Partitioning of the loop regions is done by partition_loop. Then the loop regions are induced into one cfg node and another cfg named CFG P’ is rebuilt, partitioning is then done by traversing the CFG P’ from the root the same as the nonloop regions. The compiler looks ahead up to the CQIP of current basic block and partitions the CFG between current basic block and its CQIP into threads by calling partition_thread, which is also the algorithm for non-loop region partitioning. The non-loop region partition is done by partition_thread. It partitions the program segment between start block and its post-dominator block(current block’s controlindependent point) into multiple threads by calling itself recursively. A data dependence model based on data dependence count between two threads is used to find the optimal dependence to keep the data dependence in a proper threshold. The granularity of thread is defined as the dynamic instructions of the thread. Lower limit and upper limit are maintained to balance threads granularity. Only the candidate thread whose granularity is within the limits and whose dependency with the successor thread less than DEP_THRESHOLD can be partitioned into a new thread. If the candidate thread is too large, then the region between start_block and its control-independent block is further examined for potential partitioning. On the other hand, if the thread size is too small even when including the blocks along the likely path, then no new thread is created, the candidate thread is simply added to current thread and partitioning goes on. In loop regions partitioning, the thread size is guaranteed by restricting the number of dynamic instructions in loop region larger than LOOP_SIZE_THRESHOLD. The partitioning is similar as the algorithm of non-loop regions partitioning except that when the granularity of candidate thread is too small, the loop region is unrolled and once more partitioned as non-loop region. 4.3 P-Slice Construction
Prophet reduces inter-thread dependences through p-slice[13][14][15] inserted at the beginning of each speculative thread. P-slice is used to calculate the live-ins (the data consumed by current thread but produced by its predecessors) of the new speculative thread quickly but they do not need to guarantee correctness, since the underlying architecture can detect and recover from mis-speculations.
An Overview of Prophet
401
The construction of the p-slice for a given speculative thread works as follows: Identify Live-ins Identifying the live-ins of a speculative thread requires a top-down traversal of its control-flow graph starting at the CQIP to identify register and memory values read before written by the speculative thread. Each path is explored up to a certain length. The length represents the time that previous threads take to compute and commit these values. This is because once the previous thread commits, the speculative thread no longer needs rely on predicted values, but can read committed values directly. Generating P-slices The p-slice for a speculative thread is built by traversing the control-flow graph backwards from the CQIP until the SP. Initially the instructions included in the p-slice are those that directly produce the thread live-ins. Then ancestors of these instructions are inserted, taking into account both data and control dependences. When generating p-slices, the information obtained by profiler is used to optimize the p-slice by pruning the live-ins that produced by unlikely path to minimize the unnecessary memory and register data dependence.
5 Prophet Architectural Support This section describes the SpMT execution model and the underlying Prophet Architecture support, which provides a mechanism to maintain program order and maintains the program correctness. It defines the semantic of thread spawn, squash and restart operations so that threads can be transferred to the right state. 5.1 Execution Model
The execution model of Prophet is targeted by Prophet Compiler and implemented by the underlying Prophet Architecture support. Prophet uses speculative list to infer program order. If thread X precedes thread Y in speculative list, this indicates that thread X has preceded thread Y in the original sequential execution. Threads commit data in the order defined by speculative list. When a thread is guaranteed not to violate any data dependences with its logically-earlier threads, it can commit all its speculative modifications to the memory. When speculation failed, all the logicallylater threads currently running are all squashed and the failed thread itself is restarted. Figure 2 depicts all the possible states in a thread life cycle. In Prophet, every thread maintains a version to distinct the data generated before and after each spawn point in order to make sure that speculative modifications in the parent thread take no effect to its sub thread’s pre-computation. While spawning a sub thread, the parent thread will pass its thread version to its sub thread and then increase its own thread version by 1. For a thread in pre-computation state, only the data generated before its spawn point are visible when it executes p-slice. But when the thread transferred to speculative execution (sp-execution) state, all the data generated by its parents are all visible to it.
402
Z. Chen et al.
Fig. 2. Thread State Transition Diagram
5.2 Underlying Architecture Support
Prophet architecture support is loosely derived from Hydra[2]. Figure 3 shows the anatomy of the Prophet Architecture support. Besides components used in conventional CMP architecture, L1 memory data and register cache, register bus, thread state controller and version control logic are also added to enable speculation. Prophet buffers the speculation results, performs memory communication and disambiguation TU0 Register Files
ALU
Register Files
Superscalar Core
ALU CU Superscalar Core
Register Cache
Register Cache TLS state controller
TU 2
TU1 CU
TLS state controller L1 Cache
L1 Cache
Register Bus On-Chip Bus Control Bus Cache Bus
Thread controller
System Bus L2 Cache Ins. & Data Memory Interface DRAM Main Memory
DMA
I/O Bus Interface I/O Device
Fig. 3. Prophet Architecture Support
TU 3
An Overview of Prophet
403
through L1 memory data cache. A single snoopy bus protocol is used to maintain L1 cache coherence. Prophet employs a unidirectional ring to transfer register values between CPUs, it is also utilized for transferring starting address and thread version of spawned thread. Thread state controller controls thread to transfer to the right state when some actions occur. Version control logic provides a mechanism to guarantee the thread access the right data at runtime. 5.2.1 Speculative Result Buffering Prophet uses a cache similar to Multi-Version Cache[11] to buffer speculation result and resolve data dependence violation. Since p-slice is created for each thread to reduce data dependence violation, Prophet must track data with multi-version not only among different threads but also within each individual thread. Prophet performs memory read and write operations in L1 cache according to speculative coherence scheme. For speculation to succeed, any cache line with the newest version is committed to the memory when the thread transfers to stable execution state.
⑴ Memory Data L1 Cache Line Fig. 4. Memory Data L1Cache Line
Figure 4 depicts all the fields in a cache line and whose semantics are as follows: Ver: Store the version of the cache line. V: Indicate whether this cache line is valid or not. M: Indicate whether this cache line is speculatively modified or not. RL: Indicate whether the data value is remote read from its predecessor or not. O: Indicate whether the data value is old or not. Address Tag: The address of data value. Data Value: Data store in this cache line. When speculatively read a memory data A thread can perform a speculative read either in sp-execution state or precomputation state. When in sp-execution state, the thread first performs a local read attempting to get the data with the newest version from its own L1 cache, if misses, it will then request the version control logic to read the newest data from its predecessors. If all the previous read miss, the data is read from memory. While in pre-computation state, the thread read data first from its “direct-parent” thread (the thread that has spawned it) in order to make sure that only the data before its spawn point are visible to itself. The data it should read is the one with the version that is the max meanwhile less than or equal to its thread version. If this read misses, it will read the newest data from its “direct-parent” thread’s predecessors in reverse order defined by speculative list just as in sp-execution state. All remotely read data is stored in local cache with RL field set true and Ver field set its thread version.
404
Z. Chen et al.
When speculatively write a memory data When in sp-execution state, performing a write operation requires to check the version of the cache line to be written. If its version equals to the current thread version, the cache line will be modified directly without changing any other state fields. Otherwise, a new cache line with version equal to current thread version will be created and the previous one will be set as old. While in pre-computation state, the value field of the cache line is directly modified without checking its version. All the newly created cache lines in pre-computation have a version valued 0, indicating the data is generated during pre-computation and should be verified before committing. All write operations in both states must be propagated to its successors along speculative list to detect data dependence violation.
⑵ Register Data L1 Cache Line Fig. 5. Register cache line
Figure 5 depicts all the fields in the register cache line with whose semantics as follows: Load: Read field of local register. When the register has been read in local thread, it will be set 1. Store: Write field of local register. When the register has been written in local thread, it will be set 1. Valid: Validation field of local register. This field is initialized as -1, indicating this register is neither read nor written. If the first operation performed on this register is read, it will be set 0; otherwise it will be set 1. Regnum and regvalue fields contain the number of the register and its speculative value. The register cache is initialized the moment that thread quits pre-computation state. When the thread performs a register read or write operation in sp-execution state, its associated cache line’s state fields are set or updated. 5.2.2 Memory Data Dependence Violation Detection Prophet capitalizes on a single snoopy bus protocol to detect memory data dependence in sp-execution state. When a thread speculatively writes a data in sp-execution state, it will send a write message to the bus. Its successive sub thread will detect the message and get the write address to check in its own local L1 cache whether a RAW violation has occurred. If so, all the more speculative threads are squashed and the sub thread itself will be restarted. Write operation in pre-computation state does not send a write message, Prophet relies on verification to detect memory dependence violations that may occurred in pre-computation state. Before the stable thread commits, it will verify the speculative modifications generated by its immediate sub thread in pre-computation state. This is carried out just by comparing the values pre-computed by its sub thread with the values generated by the stable thread. If all the values with the same address are equal,
An Overview of Prophet
405
this means that no violation occurs. Otherwise all the sub threads are squashed and the stable thread will continue running. 5.2.3 Register Synchronization Since p-slice can forecast the register values, Prophet doesn’t synchronize register values at runtime. The register synchronization is postponed until thread committing[9]. Just as the verification and committing of memory speculative modifications, register values are also verified by the stable thread and committed to its immediate sub thread. In Prophet, all the register values need verification are stored in the sub thread’s L1 register cache and with valid field set 0. These values are read before they are written. If a register value is neither read nor written, the stable thread will commit its value to the sub thread and the register value is synchronized.
6 Experimental Evaluations We have implemented the Prophet compiler prototype based on SUIF/MACHSUIF compiler framework. The MIPS assemble code is expanded with some special thread control instructions to support SpMT. Table 1. Characterization of the Olden benchmarks
Benchmark
mst treeadd power tsp bisort voronoi perimeter health
Thread Size
31.5 33.5 51.9 35.2 31.7 86.4 40.5 40.3
% of Dynamic Instr. in loop 90.8% 0.0% 91.0% 74.5% 73.3% 89.2% 0.0% 100%
Slice Size
3.8 3.4 3.7 3.2 3.5 4.4 3.7 3.5
Slice/ Thread
12% 10.1% 7.1% 9.0% 11% 5.0% 9.1% 8.6%
Thread Live-ins
2.8 2.4 2.5 2.3 2.2 3.4 2.5 3.5
Speedup
22% 13% 17% 10% 11% 18% 15% 12%
For benchmarks, 8 programs from Olden[8] are used. According to different setup, the compiler generates different kinds of SpMT threads with different speedup. The default compiler threshold value, which defined by the lower and upper limits of the dynamic instructions number in a thread, is set 15~50. The default value for interthread data dependence count threshold is 3. Table 1 presents some statistics of the speculative threads generated by Prophet with 4 thread units. The second column shows the average number of instructions executed by speculative threads. The fourth column shows the average dynamic size of the p-slices and the fifth column shows the relative size between speculative thread and its corresponding p-slice. The sixth column shows the average number of thread input values computed by the p-slice.
406
Z. Chen et al.
2xOOO
Perfect Mem
Prophet
1.25 1.2 1.15 1.1 1.05 1 0.95
mst
treeadd
power
tsp
bisort
voronoi perimeter
health
Fig. 6. Speedup compared with other architectures
Finally, the right-most column gives the speedup of Prophet with 4 thread units; it is acquired by an estimation model implemented to estimate the execution time when the program is executed in the SpMT manner. It shows that most of the benchmarks have good speedup. In the case of mst, it outperforms single-threaded execution by 22%. Although perimeter and treeadd have no loops, they have recursive function calls instead. Both of the two benchmarks have large percentages of non-loop threads. While in health, mst and tsp, most of the partition time is spent in loops. Figure 6 shows the performance of the Prophet compared with the other singleand multi-threaded architectures. Performance is obtained over a single thread unit. The compares architectures are: a) an out-of-order superscalar processor and b) a single thread unit with perfect memory. The last bar in each group of bars shows the speedup estimated by our estimation model. It shows that the Prophet system is effective at exploiting thread-level parallelism from almost all the benchmark programs despite their irregular program structure.
7 Conclusions In this paper the Prophet compiler and simulator are presented for exploiting speculative thread-level parallelism. The Prophet compiler system can deal with both loop-based partition and non-loop based partition. The partition algorithm supports out-of-order spawning of threads and spawning from anywhere in a thread. The p-slice is also constructed to reduce inter-thread data dependence. The SpMT architecture is designed to support speculatively execution of multithreading programs. The conventional multi-version cache is extended to support tracking data both among multi-threads and within individual thread. A register bus is introduced to make the register value transferred more effective. In contrast with many previous approaches to synchronize register value at runtime[10], Prophet capitalizes on p-slice to predict register value and uses register verification and committing mechanism to synchronize register value. Also the Prophet simulator is developed to execute the binary code generated by Prophet compiler. The results obtained by the Prophet compiler for a subset of the Olden benchmarks are encouraging. Overall, this work shows that the combination of loops and nonloops, speculative and non-speculative threads has the potential to extract tread-level parallelism in general-purpose programs.
An Overview of Prophet
407
References 1. Sohi, G., Breach, S., Vijaykumar, T.: Multiscalar Processors. In: Proceedings of the 22nd International Symp on Computer Architecture, Margherita Ligure, Italy, pp. 414–425. ACM Press, New York (1995) 2. Hammond, L., Hubbert, B., Siu, M., et al.: The Stanford Hydra CMP. In: IEEE Micro, vol. 20(2), pp. 71–84. IEEE Computer Society, Los Alamitos (2000) 3. Dubey, P.K., Brien, K.O., Barton, C.: Single-program speculative multithreading(SPSM) architecture: Compiler-assisted fine-grained multithreading. In: Proceedings of the IFIP WG10.3 working conference on Parallel architectures and compilation techniques, Limassol, Cyprus, IFIP Working Group on Algol, pp. 109–121 (June 1995) 4. Kun, D.: Compiling for the Speculative Multithreading Architecture. National University of Defense Technology, Changsha. PhD thesis(2001) (in Chinese) 5. Madriles, C., Quiñones, C.G., Sánchez, J., et al.: The Mitosis Speculative Multithreaded Architecture. In: Proceedings of the International Conference ParCo 2005, John von Neumann Institute for Computing, vol. 33, pp. 27–38 (2006) 6. Wilson, R., et al.: SUIF: An Infrastructure for Research on Parallelizing and Optimizing Compiler. ACM SIGPLAN Notices 29(12) (December 1996) 7. http://www.eecs.harvard.edu/hube/software/ 8. Olden Benchmark Suite[EB/OL], http://www.cs.princeton.edu/~mcc/olden.html 9. Zhai, A., Steffan, J.G., Colohan, C.B., Mowry, T.C.: Compiler and Hardware Support for Reducing the Synchronization of Speculative Threads. ACM Transactions on Architecture and Code Optimization 5(1), Article 3 (May 2008) 10. Ohsawa, T., Takagi, M., Kawahara, S., Matsushita, S.: Pinot:Speculative Multi-threading Processor Architecture Exploiting Parallelism over a Wide Range of Granularities. In: Proceedings of the 38th Annual IEEE/ACM International Symposium on Michroarchitecture (MICRO 2005) (2005) 11. Vijaykumar, T.N., Gopal, S., Smith, J.E., et al.: Speculative Versioning Cache. IEEE Trans. Parallel Distrib. Syst. 12(12), 1305–1317 (2001) 12. Renau, J., Tuck, J., Liu, W., et al.: Tasking with out-of-order spawn in TLS chip multiprocessors: microarchitecture and compilation. In: Proceedings of ICS 2005: Proceedings of the 19th annual international conference on Supercomputing, pp. 179–188. ACM Press, New York (2005) 13. Quiñones, C.G., Madriles, C., Sánchez, J., et al.: Mitosis compiler: an infrastructure for speculative threading based on pre-computation slices. In: Proceedings of PLDI 2005: Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation, pp. 269–279. ACM Press, New York (2005) 14. Liao, S., Wang, P., Wang, H., Hoflehner, G., Lavery, D., Shen, J.: Post-Pass Binary Adaptation for Software-Based Speculative Precomputation. In: ACM Conference on Programming Language Design and Implementation (June 2002) 15. Madriles, C., Sánchez, C.G.Q.J., Marcuello, P., et al.: The Mitosis Speculative Multithreaded Architecture. In: Proceedings of Parallel Computing: Current & Future Issues of High-End Computing, pp. 27–38 (2006)
Fast License Plate Localization Using Discrete Wavelet Transform Yuh-Rau Wang1,*, Wei-Hung Lin2, and Shi-Jinn Horng2,3 1
Dept. of Computer Science and Information Engineering, St. John’s University, Taipei, Taiwan
[email protected]
2
Dept. of Computer Science and Information Engineering, National Taiwan University of Science and Technology, Taipei, Taiwan
[email protected] 3
Dept. of Electronic Engineering, National United University, Miao-Li, Taiwan
[email protected]
Abstract. Some previous works use discrete wavelet transform (DWT) to extract license plate (LP), however, most of them are not capable of dealing with complex environments such as the low-contrast source images and the dynamic-range problems. In this paper, we propose a license plate localization (LPL) algorithm based on DWT. The LP can be extracted from complex environments and different quality of source images by using two frequency subbands. We first use the HL subband to search the features of LP and then verify the features by checking whether a horizontal line around the feature exists in the LH subband or not. The proposed method can extract both front and back LPs of various vehicles. The experiments show that the proposed method can achieve good LPL results with both short run-time and high accurate detection rate. Keywords: License plate localization, license plate recognition, discrete wavelet transform, histogram, digital image processing.
1 Introduction Intelligent transport system (ITS) is developed and applied in our life recently. Same as flow of traffic, traffic analysis, parking automation, identification of stolen vehicles, the license plate recognition (LPR) is one of the applications in ITS. The license plate (LP) can be detected and recognized by digital image processing and computer vision. LPR algorithm can be separated into three main processing steps: 1). license plate localization (LPL), i.e., detecting the location of LP; 2). character segmentation (CS), i.e., segmenting the characters of LP; and 3). character recognition (CR), i.e., recognizing the characters of LPR. Among the three main processing steps of LPR, LPL is the most important part of the three steps. The main difficulty of the LPL is the environment. *
Corresponding author.
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 408–415, 2009. © Springer-Verlag Berlin Heidelberg 2009
Fast License Plate Localization Using Discrete Wavelet Transform
409
There exist (one or) two horizontal lines and many vertical lines in an LP. Many proposed LPL methods, such as Sobel operator [1-5], invoke image enhancement and edge detection to find these features; but LP is not easy to be detected when the image is blurry. Furthermore, using edge detection to detect the LP, within which there exists “rectangle like” image, takes lots of execution time. In [6-9], the color-based LPL are proposed. These methods can not be used widely, since the colors between different cars are different (for example, the color of taxi is different from that of other vehicles in Taiwan) and the colors of LP are country specific. In [10], a wavelet based method is used, the license plate can be find quickly from LH subband by a reference line. However, the method is not suitable to be applied in complex environments and the distance between vehicle and camera can be neither too far nor too close [11]. Li and Xie [9] proposed a color and texture feature based for LPL. They use projection and DWT to detect the LP. The disadvantage is that the LP is too small to be detected when the color of LP loses its original color or there exist similar color and texture features with other objects. Guo and Liu [12] proposed a feedback selflearning for LPL. They use edge detection, texture property, aspect ratio, and color similarity to find the LP. The disadvantage is that only the still image can be used and the size of LP is fixed. For applying in real-time LPR, not only high accuracy but also quick response time is needed. Moreover, since it takes more time for the LP to be recognized in various distances between camera and cars, the proposed LPR algorithm requires performance improvement as well. In this paper we propose a wavelet-based LPL method. We compute the horizontal and vertical gradients from LH and HL subbands, respectively. Then in terms of the texture of character of LP and background of LP, we detect the location of LP. Experimental results show that the average execution time of LPL is less than 0.2 sec and can be implemented in complex environments and achieve 97.33% accurate rate in real-time application
2 The Proposed Method The received color image, which is taken by CMOS camera, is first converted to gray image and then transformed into frequency domain by employing 1-level 5/3 discrete wavelet transform (DWT) as shown in Fig.1. Since there exist vertical information in the HL subband and horizontal information in the LH subband, we employ these two subbands to find the candidate. Fig. 2 shows the LP is detected by the proposed method. The detailed algorithm is described as follows: Step 1. Convert the color image to gray image. Step 2. The gray image is transformed into frequency domain by 1-level 5/3 DWT. Step 3. This step is to reduce the noise in HL and promote the accurate rate of LP detection by removing some insignificant coefficients as follows. We calculate the histogram of every vertical line in HL subband by its length. Then, we remove the number which is greater than one hundred and above. Let the longest length in the remaining histogram be denoted as AvglengthV. Then
410
Y.-R. Wang, W.-H. Lin, and S.-J. Horng
LL
HL
LH
HH
Fig. 1. One-level DWT for a car image
Fig. 2. The LP is detected by the proposed method
we remove the length which is less than the average length AvglengthV,. by employing Eq.(1).
⎧ HL , HLVi > Avg lengthV , HLV = ⎨ Vi ⎩0 , otherwise, where HLV is the set of vertical lines in HL, HLvi ∈ HLV , 0 < i the width of the received image.
(1)
≦ W/2, W is
Step 4. We first calculate the average of the coefficients of LH, denoted as AvgLH, and then clear any of the coefficients whose value is less than this average value AvgLH. w/2
∑ x j, LH
Avg LH =
j =0
w/2
∑
j =0
1, if x j , LH > 0
(2)
Fast License Plate Localization Using Discrete Wavelet Transform
, if x j ,LH > Avg HL ⎧x x j ,LH = ⎨ j ,LH otherwise. ⎩0,
411
(3)
Step 5. Assume that the width of LP is one fifths of the width of input image. We scan the HL subband from bottom to top and from left to right within this one fifths width to count the number of white points and then find the one which has the largest number (at least greater than six) of white points in HL subband. Then scanning the corresponding five rows above this position to check whether there exists a horizontal line or not. If there exists a horizontal line, then we denote it as the candidate LP and record its row coordinate Y. Step 6. This step is to set the coordinates of LP. We adjust the size of the block. The starting vertical coordinate SY of the LP in HL subband is equal to the corresponding row coordinate Y which is recorded in LH subband. Then expending the size of the block in HL subband. The ending vertical coordinate EY is set to SY plus 10. The starting horizontal coordinate SX is set to the initial horizontal coordinate of the block. The ending horizontal coordinate EX is set to (EY-SY) x 4. Step 7. Adjust SX and EX. We use a sliding window where the width is equal to (EXSX)/3 and the height is equal to (EY-SY). We slide the window from the left hand side (i.e., the beginning) of the candidate LP to 1/3 of the candidate LP and to find out the X coordinate of the window where there exists the largest cardinality of white pixels in this window and denote it as the new SX. Similarly, we move the window from the right hand side (i.e., the ending) of the
(a)
(b) Fig. 3. Using a window to adjust (a) SX and (b) EX within a candidate LP
412
Y.-R. Wang, W.-H. Lin, and S.-J. Horng
candidate LP to 2/3 of the range of the candidate LP and to find out the X coordinate of the window where there exists the largest cardinality of white pixels in this window and denote it as the new EX. Step 8. Adjust SY and EY. We employ the new rectangle, which is formed in Step 6, to calculate the number of pixels in every row respectively. First, from top of the rectangle to the top of HL, if no white pixels are in a row, then the new row is set to be SY. Then from bottom of the rectangle to the bottom of HL, if no pixels are in a row, then the new row is set to be EY (see Fig. 4). Fig. 4 shows how to find the location of license plate from these candidates in an image.
Fig. 4. Adjusting the SY and EY of the candidate LP within the captured image
Step 9. Transform the coordinate from HL frequency to spatial domain
3 Experimental Results In the experiments, the proposed method is evaluated on IBM X61 notebook 2.4 GHz CPU, 2GB RAM, Windows XP. The test images include 300 different images of size
Fig. 5. The images of still cars captured outdoors
Fast License Plate Localization Using Discrete Wavelet Transform
413
400 × 300. All of the images are taken by CMOS camera of mega-pixel resolution. Both the indoor and outdoor environments are included. Both still and moving cars images are evaluated. LP images of different angles and different lighting conditions are also considered. Some of them are shown in Figs. 5-8. Figs. 5 and 6 show the images of still cars captured outdoors and indoors, respectively. Fig. 7 shows the images of still cars captured in different angles. Fig. 8 shows the images of moving cars captured in the daytime. The experimental results show that the number of successful detection is 292, and the number of fault detection is 8. That is, the correct rate is 97.33%. The average execution time of LPL is 0.18sec. The comparison results with various methods are shown in Table 1. The proposed method, which employs the cheaper CMOS camera and does not restrict the distance between camera and cars, is only inferior to the method proposed by Hung et al. [14]. Overall, it shows that the proposed method achieves excellent performance.
Fig. 6. The images of still cars captured indoors
Fig. 7. The images of still cars captured in different angles
414
Y.-R. Wang, W.-H. Lin, and S.-J. Horng
Fig. 8. The images of moving cars captured in the daytime
Table 1. Comparison results of various methods Methods
Correct rate
Guo [12] Zhang [13] Li [9] Hung [14] Hsieh [10] The paper
97.1% 93.5% 96.4% 97.31% 92.4% 97.33%
Average execution time 0.532 sec 0.8 sec 3 sec 0.016 sec N/A 0.18 sec
5 Conclusion In this paper, we propose an LPL algorithm based on DWT. LP detection is the most important step in the LPR. The proposed LPL algorithm can be used in complex environments and different size of LP image. By using DWT instead of edge detection to find the vertical and horizontal gradients of LP, in the proposed algorithm, we achieve fast real-time LPL. The experimental results show that the proposed algorithm can quickly detect the location of LP in different environments with high accuracy.
Acknowledgements This work was partially supported by the National Science Council of Taiwan under contract number NSC 97-2221-E-129-007.
Fast License Plate Localization Using Discrete Wavelet Transform
415
References [1] Wang, S.Z., Lee, H.-J.: Detection and recognition of license plate characters with different appearances. In: Proc. IEEE Int. Conf., Intell. Transp., pp. 979–984 (2003) [2] Zheng, D., Zhao, Y., Wang, J.: An efficient method of license plate location. Pattern Recognit. Lett. 26(15), 2431–2438 (2005) [3] Yang, F., Ma, Z.: Vehicle license plate location based on histogramming and mathematical morphology. In: Proc. 4th IEEE Workshop Autom. Identification Advanced Technol., pp. 89–94 (2005) [4] Suryanarayana, P.V., Mitra, S.K., Banerjee, A., et al.: A morphology based approach for car license plate extraction. In: Proc. IEEE INDICON, Chennai, India, pp. 24–27 (2005) [5] Ma, Z., Yang, J.: A license plate locating algorithm based on multiple Gauss filters and morphology mathematics. In: Proc. 24th IASTED Int. Multiconference, Signal Process, Pattern Recog. Appl., Insbruck, Austria, pp. 90–94 (2006) [6] Shi, X., Zhao, W., Shen, Y.: Automatic License Plate Recognition System Based on Color Image Processing. In: Gervasi, O. (ed.), pp. 1159–1168. Springer, Heidelberg (2005) [7] Cao, G., Chen, J., Jiang, J.: An adaptive approach to vehicle license plate localization. In: Proc. 29th Annu. Conf. IECON, pp. 1786–1791 (2003) [8] Chang, S.L., Chen, L.S., Chung, Y.C., et al.: Automatic license plate recognition. IEEE Trans. Intell. Transp. Syst. 5(1), 42–53 (2004) [9] Li, J., Xie, M.: A color and texture feature based approach to license plate location. In: Proc. Int. Conf. Computational Intelligence and Security, Harbin, pp. 376–380 (2007) [10] Hsieh, C.T., Juan, Y.S., Hung, K.M.: Multiple license plate detection for complex background. In: Proc. IEEE 19th Int. Conf. AINA, pp. 389–392 (2005) [11] Anagnostopoulos, C.N.E., Anagnostopoulos, I.E., Psoroulas, I.D., et al.: License plate recognition from still images and video sequences: A Survey. IEEE Trans. Intelligent Transportation Systems 9(3), 377–391 (2008) [12] Guo, J.M., Liu, Y.F.: License plate localization and character segmentation with feedback self-learning and hybrid binarization techniques. IEEE Trans. on Vehicular Technology 57(3), 1417–1424 (2008) [13] Zhang, H., Jia, W., He, X., Wu, Q.: Learning-based license plate detection using global and local features. In: Proc. ICPR, pp. 1102–1105 (2006) [14] Hung, K.M., Chuang, H.L., Hsieh, C.T.: License plate detection based on expanded Haar wavelet transform. In: Fuzzy Systems and Knowledge Discovery, Proc. 4th Int. Conf. FSKD, Haikou, pp. 415–419 (2007)
Fast Parallel Molecular Solution for DNA-Based Computing: The 0-1 Knapsack Problem Sientang Tsai Department of Information Management Southern Taiwan University, Yuan Kung city,Tainan county, Taiwan, R.O.C.
[email protected]
Abstract. It is shown first by Adleman that deoxyribonucleic acid (DNA) strand could be employed towards calculating solution to an instance of the NPcomplete Hamiltonian Path Problem (HPP). Lipton also demonstrated that Adleman’s techniques could be used to solve the satisfiability (SAT) problem. In this paper, it is demonstrated how the DNA operations presented by Adleman and Lipton can be used to develop the DNA-based algorithm for solving the 0-1 Knapsack Problem.
1 Introduction In 1961, Feynman first offered bio-molecular computation, but his idea was not implemented by experiments for a few decades [1]. Adleman [2] in 1994 succeeded to solve an instance of the Hamiltonian path problem in a test tube, just by handling DNA strands. From [5], it was indicated that an optimal solution of every NPcomplete or NP-hard problem is determined from its characteristics. DNA-based algorithms had been proposed to solve many computational problems and those consisted of the satisfiability problem [3], the maximal clique [6], three-vertexcoloring [7], the set-splitting problem [8], the set-cover problem and the problem of exact cover by 3-sets [9], the dominating-set [10], the maximum cut problem [11], the binary integer programming problem [12] and the set-partition problem [24]. One potentially significant area of application for DNA algorithms is the breaking of encryption schemes [13,14]. From [15-17], DNA-based arithmetic algorithms are proposed. Furthermore from [18], DNA-based algorithms for constructing DNA databases are also offered. The aim of this work is to use the biological operations in the Adleman-Lipton filtering model to develop the DNA-based algorithms for solving the 0-1 knapsack problem. The rest of the paper is organized as follows. Section 2 introduces DNA models of computation proposed by Adleman and his co-authors in details. Section 3 introduces the DNA program to solve the 0-1 kapsack problem from solution spaces of DNA strands. Conclusions are drawn in Section 4.
2 DNA Model of Computation In the last decade there have been revolutionary advances in the field of biomedical engineering particularly in recombinant DNA and RNA manipulating. Due to the A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 416–427, 2009. © Springer-Verlag Berlin Heidelberg 2009
Fast Parallel Molecular Solution for DNA-Based Computing
417
industrialization of the biotechnology field, laboratory techniques for recombinant DNA and RNA manipulation are becoming highly standardized. Basic principles about recombinant DNA can be found in [22-26]. In this subsection we describe eight biological operations useful for solving the 0-1 knapsack problem. The method of constructing DNA solution space for the 0-1 knapsack problem is based on the proposed method in [20, 21]. A (test) tube is a set of molecules of DNA (a multi-set of finite strings over the alphabet {A, C, G, T}). Given a tube, one can perform the following operations: 1. Extract: Given a tube T and a short single strand of DNA, “s”, produce two tubes +(T, s) and –(T, s), where +(T, s) is all of the molecules of DNA in T which contain the strand “s” as a sub-strand and −(T, s) is all of the molecules of DNA in T which do not contain the short strand “s”. 2. Merge: Given tubes T1 and T2, yield ∪(T1, T2), where ∪(T1, T2) = T1 ∪ T2. This operation is to pour two tubes into one, without any change of the individual strands. 3. Amplify: Given a tube T, the operation Amplify (T, T1, T2), will produce two new tubes T1and T2 so that T1 and T2 are a copy of T (T1 and T2 are identical) and T becomes an empty tube. 4. Append: Given a tube T and a short strand of DNA,” s”, the operation will append the short strand, “s”, onto the end of every strand in the tube T. It is denoted by Append (T, s). 5. Append-head: Given a tube T and a short strand of DNA, “s”, the operation will append the short strand, “s”, onto the head of every strand in the tube T. It is denoted by Append-head (T, s). 6. Detect: Given a tube T, say ‘yes’ if T includes at least one DNA molecule, and say ‘no’ if it contains none. It is denoted by Detect (T). 7. Discard: Given a tube T, the operation will discard the tube T. It is denoted by Discard (T). 8. Read: Given a tube T, the operation is used to describe a single molecule, contained in the tube T. Even if T contains many different molecules each encoding a different set of bases, the operation can give an explicit description of exactly one of them. It is denoted by Read (T).
3 The DNA Algorithms for Solving the 0-1 Knapsack Problem 3.1 Definition of the 0-1 Knapsack Problem Assume that there are q items. Let S = {item1, item2, …, temq}, wi = weight of itemi, pi = profit of itemi , M = maximum weight the knapsack can hold, where wi, pi, and M are positive integers. Determine a subset A of S such that q p x is maximized subject
∑
i =1
to
q
∑wx i =1
i
i
≤M
i
i
, where xi ∈{0, 1}. xi =1 if the ith item in set S is selected for the
knapsack and xi = 0 otherwise. Without loss of generality we also assume that wi ≤ M for 1≤ i ≤ q, so each item fits into the knapsack.
418
S. Tsai
For example, suppose we have three items expressed by a finite set S = {item1, item2, item3}, the weight and profit for each item are listed as Table 1. The value of M, the maximum weight that knapsack can carry, is 10 lb. The total subsets of S are, respectively, ∅, {item1}, {item2}, {item3}, {item1, item2}, {item2, item3}, {item1, item3} and {item1, item2, item3}. According to the definition above of the 0-1 knapsack problem, their corresponding binary values of {x3, x2, x1} are subsequently, 000, 001, 010, 100, 011, 110, 101, 111. The feasible solutions satisfying the constraint w1x1 + w2x2 + w3x3 ≤ 10 are ∅, {item1},{item2}, {item3}, {item1, item2} and {item1, item3}. Clearly the optimal solution is to fill the knapsack with items whose profit is the largest. Then the optimal solution to this problem instance is A = {item1, item3}, because total profit $11 is the maximum satisfied the constraint that the total weight of all selected items doesn’t exceed 10 lb. Table 1. The 0-1 knapsack problem instance Item ( itemi )
Weight ( wi )
Profit ( pi )
item1
w1=3 lb
p 1= $ 6
item2
w2=5 lb
P2=$ 4
item3
w3=7 lb
P 3= $ 5
3.2 Construct the Solution Space of DNA Strands for the 0-1 Knapsack Problem Assume that xqxq-1…x2x1 is a q-bit binary number, which is applied to represent one of the 2q subsets of a q-element set S. From [20, 21], for every bit xk representing the kth element in S for 1≤ k ≤ q, two distinct 15-base value sequences are designed. One represents the value “0” for xk, and the other represents the value “1” for xk. For sake of convenience in our representation, assume that xk1, which represents the kth item selected in set S, denotes the value of xk to be 1 and xk0, which represents the kth item not selected in set S, denotes the value of xk to be 0. The following DNA-based algorithm is used to construct the solution space for 2q possible subsets of a q-element set S. The result generated by Init (T0, q) for our example in the previous section is shown in Table 2. Procedure Init (T0, q) (1) Append (T1, xq1) (2) Append (T2, xq0) (3) T0 = ∪(T1, T2) (4) For k= q –1 downto 1 (4a) Amplify (T0, T1, T2) (4b) Append (T1, xk1) (4c) Append (T2, xk0) (4d) T0 = ∪(T1, T2) End For EndProcedure
Fast Parallel Molecular Solution for DNA-Based Computing
419
Table 2. The result is generated by Init (T0, q) Tube
The result generated by Init (T0, q)
T0
{x31x21x11, x31 x21 x10, x31 x20 x11, x31 x20 x10, x30 x21 x11, x30 x21 x10, x30x20x11, x30x20x10}
T1
∅
T2
∅
Lemma 1: The algorithm, Init (T0, q) is used to construct the solution space of 2q possible subsets for a q-element set S. Proof: The algorithm, Init (T0, q), is implemented via amplify, append and merge operations. Step (1) and Step (2) are subsequently applied to append DNA sequences, which represent the value “1” for xq and the value “0” for xq respectively, onto the end of every strand in tube T1 and tube T2. This means that subsets containing the qth element appear in tube T1, and subsets not containing the qth element appear in tube T2. Next, Step (3) is used to pour tube T1 and T2 into tube T0. This indicates that DNA strands in tube T0 include DNA sequences of xq = 1 and xq = 0. Each time Step (4a) is performed, it uses amplify operation to copy the contents of tube T0 into two new tubes, T1 and T2, which are copies of T0. Tube T0 becomes empty. Step (4b) and Step (4c) are used to subsequently append DNA sequences, respectively representing the value “1” for xk and the value “0” for xk, onto the end of every strand in tube T1 and tube T2. This implies that subsets containing the kth element appear in tube T1 and subsets without containing the kth element appear in tube T2. Next, Step (4d) is used to pour tube T1 and T2 into tube T0. This indicates that DNA strands in tube T0 include DNA sequences of xk = 1 and xk = 0. After repeating execution of Step (4a) through Step (4d), it finally produces tube T0 that consists of 2q DNA sequences representing 2q possible subsets. Therefore, it is inferred that 2q possible subsets of a q-element set S can be constructed with DNA strands via this algorithm. From Init (T0, q), it takes (q−1) amplify operations, 2 × q append operations, q merge operations and three test tubes to construct the solution space for a q-element set S. A q-bit binary number corresponds to a subset. A value sequence for every bit contains 15 bases. Therefore, the length of a DNA strand, encoding a subset, is 15 × q bases, which is comprised of the concatenation of one value sequence for each bit. 3.3 Solution Space of the Value for Every Element of Each Subset for Solving the 0-1 Knapsack Problem of a Finite Set For the purpose of appending the DNA strands that encode the weight wm or profit pm of all selected items, an element wm (pm) for 1≤ m ≤ q representing the size of weight (profit) of items m can be converted as a n-bit binary number, wm,n, wm,n-1,…, wm,2, wm,1(pm,n, pm,n-1,…, pm,2, pm,1). Suppose that wm,n (pm,n) is the most significant bit, while wm,1 (pm,1) is the least significant bit. For every bit wm,k (pm,k) , 1≤ m ≤ q and 1 ≤ k ≤ n, from [20, 21] two distinct DNA sequences are designed. One corresponds to the value
420
S. Tsai
“0” for wm,k (pm,k), and the other corresponds to the value “1” for wm,k (pm,k). For the sake of convenience in our representation, assume that wm,k1(pm,k1) denotes the value of wm,k (pm,k) to be 1 and wm,k0(pm,k0) defines the value of wm,k(pm,k) to be 0. The following algorithm is employed to construct the binary values of weight and profit for each element in 2q subsets of a q-element set S. The partial result generated by ValueWT_PT (T0, q, n) for our example in Section 1 is shown in Table 3. Procedure ValueWT_PT (T0, q, n) (1) or m = 1 to q 1 1 (1a) T1 = + (T0, x m ) and T2 = − (T0, xm) (1b) For k = n downto1 (1c) Append (T1, wm, k) (1d) Append (T2, wm,k0) End For (1e) For k = n downto1 (1f) Append (T1, pm, k) (1g) Append (T2, pm,k0) End For (1h) T0 = ∪(T1, T2) EndFor EndProcedure Table 3. The result is generated by ValueWT_PT(T0, q, n) The result generated by ValueWT_PT (T0, q, n)
Tube T0
1
1
1
0
0
{x3 x2 x1 w1,4 w1,3 w1,21w1,11p1,40p1,31p1,21p1,10w2,40w2,31w2,20w2,11p2,40p2,31p2,20p2,10w3,40 w3,31w3,21w3,11 p3,40p3,31 p3,20p3,11 x31x21x10w1,40w1,30w1,20w1,10p1,40p1,30p1,20p1,10w2,40w2,31w2,20w2,11p2,40p2,31p2,20p2,10w3,40 w3,31w3,21w3,11 p3,40p3,31 p3,20p3,1
. . .
x30x20x11w1,40w1,30w1,21w1,11p1,40p1,31p1,21p1,10w2,40w2,30w2,20w2,10p2,40p2,30p2,20p2,10w3,40 w3,30w3,20w3,10p3,40p3,30p3,20p3,10 x30x20x10w1,40w1,30w1,20w1,10p1,40p1,30p1,20p1,10w2,40w2,30w2,20w2,10p2,40p2,30p2,20p2,10w3,40 w3,30w3,20w3,10 p3,40p3,30 p3,20p3,10}
Lemma 2: The binary value of weight and profit for each element in 2q subsets of a q-element set S can be constructed from the algorithm, ValueWT_PT (T0, q, n). Proof: Refer to Lemma 1.
From ValueWT_PT (T0, q, n), it takes q extract operations, 4 × n × q append operations, q merge operations and three test tubes to construct the solution space for elements in 2q subsets of a q-element set S. A q-bit binary number corresponds to a choice of items and an n-bit binary number encodes the weight or profit of an item. A value sequence for every bit contains 15 bases. Therefore, the length of a DNA strand, encoding the corresponding weight and profit for 2q possible choices of q items, is 15
Fast Parallel Molecular Solution for DNA-Based Computing
421
× (4 × n × q) bases which consist of the concatenation of one value sequence for each bit. 3.4 The Construction of a Parallel One-Bit Adder A one-bit adder is a Boolean function that forms the arithmetic sum of three inputs. It includes three inputs and two outputs. Two of the input bits represent augend and addend, respectively. The third input represents the carry from the previous lower significant position. The first output gives the value of the least significant bit of the sum for augend, addend and previous carry. The second output gives the output carry transferred into the input carry of the next one-bit adder. The truth table of the one-bit adder is shown in Table 4. Suppose that two one-bit binary numbers, αm-1,k and αm,k, represent the first input (addend) and the first output (sum) of a one-bit adder for 1≤ m ≤ q and 1≤ k ≤ n, respectively. A one-bit binary number, βm,k, is applied to represent the second input(augend) of a one-bit adder. Two one-bit binary numbers, γm,k-1 and γm,k, are used to represent the third input (previous carry) and the second output (carry) of a one-bit adder respectively. From [20, 21], two distinct DNA sequences are designed to represent the value “0” and “1” for every corresponding bit. For the sake of convenience in our representations, assume that βm,k1 contains the value of βm,k to be 1, and βm,k0 contains the value of βm,k to be 0. Also suppose that αm-1,k1 denotes the value of αm-1,k to be 1, and αm-1,k0 defines the value of αm-1,k to be 0. Similarly, suppose that αm, k1 contains the value of αm,k to be 1, and αm, k0 denotes the value of αm, k to be 0 γm,k-11 denotes the value of γm,k -1 to be 1, and γm,k-10 contains the value of γm,k-1, to be 0. γm,k1 defines the value of γm,k to be 1, and γm,k0 contains the value of γm,k to be 0. The following algorithm is proposed to perform the Boolean function of a parallel one-bit adder. Table 4. The true table of a one-bit adder Augend bit 0 0 0 0 1 1 1 1
Addend bit 0 0 1 1 0 0 1 1
Previous bit 0 1 0 1 0 1 0 1
Sum bit 0 1 1 0 1 0 0 1
Carry bit 0 0 0 1 0 1 1 1
Procedure ParallelOneBitAdder (T0, αm-1,k , β1m,k, γm,k-1, m, k) 1 (1)T1 = + (T0, αm-1,k ) and T2 = −( T0, αm-1,k ) 1 1 (2)T3 = + (T1, βm,k1 ) and T4 = − (T1, βm,k1 ) (3)T5 = + (T2, βm,k )1 and T6 = − (T2, βm,k ) 1 (4)T7 = + (T3, γm,k-1 ) and T8 = − (T3, γm,k-1 ) 1 1 (5)T9 = + (T4, γm,k-1 ) and T10 = − (T4, γm,k-1 ) 1 1 (6)T11 = + (T5, γm,k-11) and T12 = − (T5, γm,k-11) (7)T13 = + (T6, γm,k-1 ) and T14 = − (T6, γm,k-1 )
422
S. Tsai
(8)If (Detect (T7) = =”yes”) then 1 1 Append-head (T7, αm,k ) and Append-head (T7, γm,k ) EndIf (9)If (Detect (T8) = =”yes”) then 0 1 Append-head (T8,αm,k ) and Append-head (T8, γm,k ) EndIf (10)If (Detect (T9) = =”yes”) then 0 1 Append-head (T9,αm,k ) and Append-head (T9, γm,k ) EndIf (11)If (Detect (T10) = =”yes”) then 1 0 Append-head (T10, αm,k ) and Append-head (T10,γm,k ) EndIf (12)If (Detect (T11) = =”yes”) then 0 1 Append-head (T11, αm,k ) and Append-head (T11, γm,k ) EndIf (13)If (Detect (T12) = =”yes”) then 1 0 Append-head (T12, αm,k ) and Append-head (T12, γm,k ) EndIf (14)If (Detect (T13) = =”yes”) then 1 0 Append-head (T13, αm,k ) and Append-head (T13, γm,k ) EndIf (15)If (Detect (T14) = =”yes”) then 0 0 Append-head (T14, αm,k ) and Append-head (T14, γm,k ) EndIf (16) T0 = ∪(T7, T8, T9, T10, T11, T12, T13, T14) EndProcedure Lemma 3: The algorithm, ParallelOneBitAdder (T0, αm-1,k , βm,k, γm,k-1, m, k), can be applied to perform the Boolean function of a parallel one-bit adder. Proof: Refer to Lemma 1.
From ParallelOneBitAdder (T0, αm-1,k, βm,k, γm,k-1, m, k), it takes seven extract operations, eight detect operations, sixteen append-head operations, one merge operation, and fifteen test tubes to compute the addition of three input bits. Two output bits of a one-bit adder encode the sum and the carry to the addition of a bit. A value sequence for every output bit contains 15 base pairs. Therefore the length of a DNA strand, encoding two output bits has 30 base pairs, consists of the concatenation of one value sequence for each output bit. 3.5 The Construction of a Parallel N-Bit Adder The parallel one-bit adder introduced in Section 4 figures out the arithmetic sum of two bits and a previous carry. Similarly, A binary parallel n-bit adder is also directly to perform the arithmetic sum for the two input operands of n-bit and the input carry by means of performing this one-bit adder n times. The following algorithm is proposed to perform the arithmetic sum for a parallel n-bit adder. Procedure ParallelAdder (T0, α, β, γ, q, n) (1) For k = n downto 1 0 (1a) Append (T0, α0,k ) EndFor (2) For m =1 to q
Fast Parallel Molecular Solution for DNA-Based Computing
423
(2a) Append (T0, γm,0 ) (2b) For k =1 to n (2c) ParallelOneBitAdder (T0, αm-1,k , βm,k , γ m,k-1, m, k) 0
EndFor EndProcedure Lemma 4: The algorithm, ParallelAdder (T0, α, β, γ, q, n), can be applied to perform the Boolean function to a binary parallel adder of n bits.
Proof: Refer to Lemma 1.
From ParallelAdder (T0, α, β, γ, q, n), it takes 7× n × q extract operations, (n + q + 2 × n × q) append operations, n × q merge operations and fifteen test tubes to compute the sum of weight for elements in 2q subsets of a q-element set S. A q-bit binary number corresponds to a subset. An n-bit binary number encodes the size of weight for an element in S. Therefore, (q + 1)× n bits correspond to the sum of weight for q elements, and one accumulator element (α). q × (n + 1) bits encode the carry of the sum. A value sequence for every bit contains 15 bases. Therefore, the length of a DNA strand, encoding the total weight of selected items, is 15 × n base pairs consisting of the concatenation of one value sequence for each bit. 3.6 Parallel Comparator for Comparing the Sum of Weight Corresponding to Subsets of a Finite Set with Any Given Positive Integer Any given positive integer, M, can be converted as n one-bit binary numbers, MnMn1…M2M1. The main advantage is that it is feasible for bit operations of the DNA algorithm in a parallel comparator. MaxiWeight (TM, n) is proposed to construct DNA strands for encoding M. OneBitComparator (T0, TM, T0>, T0=, T0, T0=, T0, T0=, T0 = ∪ (T0> , T0ON) EndIf (4) TM= ∪ (TMON, TMOFF) Endprocedure Lemma 6: The algorithm, OneBitComparator (T0, TM, T0>, T0=, T0
=
<
From OneBitComparator (T0, TM, T0 , T0 , T0 , q, k), it takes two extract operation, one detect operations, three merge operations and seven test tubes to carry out the function of a one-bit comparator. Procedure ParallelComparator (T0, TM, T0>, T0=, T0, T0=, T0, T0=, T0
<
From Parallel Comparator (T0, TM, T0 , T0 , T0 , q, n), it takes 2 × n extract and detect operations, 4 × n + 1 merge operations, one discard operation and seven test tubes to carry out the function of an n-bit parallel comparator. =
3.7 Search and Calculation of the Maximum Total Profit under the Restriction That the Total Weight Does Not Exceed the Capacity of Knapsack M The following algorithm is applied to determine which strand has the maximum profit among those chosen items satisfying the constraint of problem. The strand that
Fast Parallel Molecular Solution for DNA-Based Computing
425
remains in tube T0 has the greatest binary value of profit after performing this algorithm. Procedure SearchMaxi (T0, q, n) (1) For k= n downto 1 (1a) T0ON = + (T0, Pq,k1) and T0OFF = − (T0, Pq,k1) (1b) If (Detect (T0ON) = =”yes”) then T0 = ∪ (T0, T0ON) and Discard (T0OFF) (1c) Else (1d) T0 = ∪ (T0, T0OFF) EndIf EndFor EndProcedure Lemma 8: The algorithm, SearchMaxi (T0, q, n) can be used to search the strands that encode the maximum value of profit. Proof: Refer to Lemma 1.
From SearchMaxi (T0, q, n), it takes n extract operations, n detect operations, 2 × n merge operations and n discard operations, and three test tubes to carry out the function of searching the maximum total profit subject to the condition that the total weight of selected items must not exceed the capacity of the knapsack. 3.8 DNA Algorithm for Solving the 0-1 Knapsack Problem Algorithm 1. Solving the 0-1 Knapsack Problem (1) Init (T0, q) (2) ValueWT_PT (T0, q, n) (3) ParallelAdder (T0, W, w, z, q, n) (4) MaxiWeight (TM, n) (5) ParallelComparator (T0, TM, T0>, T0=, T0 N is an integer with gcd(R, N) = 1, and n equals T N ′ mod R [13]. In order to obtain the correct result T ′, an additional −1 quantity N ′ is needed, and the property R × R − N × N ′ = 1 holds. In 1990, Dusse and Kaliski [14] proposed an efficient Montgomery modular multiplication algorithm to perform both multiplication and modular reduction simultaneously. This algorithm allows the precomputation of N 0′ = − N 0−1 mod 2 instead of n N ′ = − N −1 mod R where R = 2 . Let N = N n −1 × 2 n −1 + N n − 2 × 2 n − 2 + …+ N1 × 2 + N0 and X = X n −1 × 2 n −1 + X n − 2 × 2 n −2 + … + X 1 × 2 + X 0 , we can compute X one digit
X i in every modular
Fast Parallel Montgomery Binary Exponentiation Algorithm Using CSD Technique
431
reduction step instead of computing the whole X at one time [14]. Here given two Nresidue n-digit integers (in base 2) A and B, the Montgomery modular reduction −1
n
REDC(AB) result can be denoted as ABR mod N where R = 2 . The Montgomery modular reduction REDC(AB) algorithm is depicted as follows. Montgomery Modular Reduction (REDC) Algorithm Input: A, B, N /*A, B and N are n-digit integers in base 2 */ −1
−1
Output: X = AB R mod N X = Y = 0; begin for i = 0 to n − 1 do begin X = X + Ai B;
n
/*X = ABR mod N where R = 2 * /
Y = X i N 0′ mod 2 ;
/* N 0′ = − N 0 mod 2 and N ′ = − N −1
−1
mod R */
X = ( X + Y × N ) / 2; end; while (X ≥ N) X = X − N; end. From the Montgomery REDC algorithm depicted above, note that R and N ′ can be computed using the Euclidean algorithm [11]. In the Montgomery multiplication −1
algorithm, R > N is selected as an integer 2 , relatively prime to N, for simple processing. Given two N-residue n-digit integers A and B, the N-residue with respect to R of the product AB < N is defined by ABR mod N, and the Montgomery reduction for n
−1
−1
an integer X (< RN ) by XR mod N, where R is the inverse of R modulo N.
If R′ (= R mod N ) has been precomputed and stored before we using the Montgomery reduction algorithm, A′ and B′ in the N-residue can be easily computed from REDC( AR′) and REDC( BR′) respectively as follows. −1
A′ = REDC ( AR′) = AR mod N B′ = REDC ( BR′) = BR mod N X = A′ × B′ = AR × BR mod N C ′ = REDC ( X ) =ABR mod N C = REDC (C ′) = AB mod N
(7) (8) (9) (10) (11)
Notice that, formulas (7) to (11) shown above describe modular multiplication using the Montgomery REDC algorithm require a longer processing time than other methods due to the residue transformation of the multiplier and the multiplicand. The modular multiplication using formulas (7) to (11) requires 7n2 + 4n multiplications since every reduction operation takes n2 + n multiplications. The classical Montgomery modular reduction algorithm only requires 2n2 + n multiplications and m divisions [15].
432
C.-L. Wu
3 The Parallel Montgomery Algorithm In this section, we will first introduce the canonical-signed-digit (CSD) recoding arithmetic and the CSD recoding algorithm. Then, we will summarize some mathematical preliminaries for the proposed fast Montgomery exponentiation algorithm using the common-multiplicand multiplication method and CSD recoding technique. Finally, we will propose the parallel version of the CMM-CSD Montgomery binary algorithm for fast evaluating the modular exponentiation operation. 3.1 Canonical Signed-Digit Recoding Arithmetic
A signed-digit representation of an integer n in radix r is a sequence of digits a = (…, a2, a1, a0) with ai ∈ {0, ±1 ,…, ± ( r − 1) } such that n =
∑
∞ i =0
ai × r i . Signed-digit
representations of this form have been applied successfully in many modern computer arithmetic applications [6] by reducing the number of multiplications [7]. In 1993, Arno and Wheeler [8] proposed the signed-digit recoding (redundant representations) algorithm for finding signed digit representations of minimal Hamming weight. The CDR (canonical signed digit recoding) arithmetic algorithm [9] can find the signed-digit representation of minimal weight [10] and this algorithm can be shown in Figure 1 2r =
(rm−1, rm−2, rm−3,...., r1, r0,0)2
+ r=
(rm−1, rm−2 ,...., r2, r1, r0 )2
3r = (sm, sm−1, sm−2 , sm−3,..., s1, s0, r0 )2 "no-carrysubtraction" →−
r=
(rm−1, rm−2 ,...., r2 , r1, r0 )2
2r = (em, em−1, em−2 , em−3,..., e1, e0,0)2 Fig. 1. Canonical-signed-digit recoding arithmetic
Signed-digit representations of this form have been applied successfully in many modern computer arithmetic applications [16][17], including the modular exponentiation problem and modular multiplication problem used in public-key cryptosystems by reducing the number of multiplications [18][19][20][21]. In 1993, Arno and Wheeler [22] proposed the canonical-signed-digit recoding algorithm for finding signed digit representations of minimal Hamming weight. Let radix r ≥ 2 be an integer, we refer to Sr as the set of all signed digit radix r representations of elements of Z. If a = ∑ m ai′ × 2i denotes the binary signed expansion with signed-digit recoding of i =0
radix r = 2 (so called radix-2 signed-digit system) for a where ai′ ∈ { 1 ,0,1}, then we
Fast Parallel Montgomery Binary Exponentiation Algorithm Using CSD Technique
433
denote a = ( am′ ,…, a0′ )SD. The CSD recoding arithmetic algorithm can generate the canonical-signed-digit representation of minimal Hamming weight [23]. 3.2 The Proposed Montgomery Exponentiation Algorithm
By using mathematical techniques in number theory, the proposed CMM-CSD Montgomery binary exponentiation algorithm is depicted as follows. CMM-CSD Montgomery Binary Exponentiation Algorithm Input: M, ECSD, N, R E
Output: C= M CSD mod N begin S = MR mod N, C = R mod N; for i = 0 to m do begin if (ei = 1) then C = REDC(SC); if(ei = 1 )then C = REDC( S S = REDC(SS); end;
C = REDC(C); end.
−1
/* C=
C);
M ECSD mod N, 0 ≤ C < N * /
Here we can therefore further speedup and improve the proposed CMM-CSD Montgomery binary exponentiation algorithm as follows. Improved CMM-CSD Montgomery Binary Exponentiation Algorithm Input: M, ECSD, N, R Output: C=
M
ECSD[1]
mod N,
ECSD[1]
D= M mod N begin S = MR mod N, C = D = R mod N; for i = 0 to m do begin if (ei = 1) then C = REDC(SC); if (ei = 1 ) then D = REDC(SD); S = REDC(SS); end; C = REDC(C); D = REDC(D); end.
Note, in the improved CMM-CSD Montgomery algorithm, we have sped up the whole modular exponentiation operation by transforming the multiplicative inverse operations for negative CSD recoding part (i.e. ECSD[1] ) to multiplicative operations.
434
C.-L. Wu
In this improved algorithm, we put the operation results of “1s” in the register C, and we put the operation results of “ 1 s” in the register D. Hence, C and D are used to store the operation results of positive digit and negative digits in exponent ECSD, respectively. In the case ei = 1 that in the above improved CSD Montgomery exponentiation algorithm, both REDC(SC) and REDC(SS), the so-called commonmultiplicand multiplications are performed for the same common-multiplicand “S”. Meanwhile, in the case ei = 1 , both REDC(SD) and REDC(SS), the commonmultiplicand multiplications are also performed for the same common-multiplicand “S”. Our main goal for applying common-multiplicand multiplication technique is that the common part among REDC(SC), REDC(SD) and REDC(SS) can be therefore computed once rather than twice. Also notice that each step of a single modular multiplication in the CMM-CSD Montgomery exponentiation algorithm has a similar step in the Montgomery REDC algorithm shown previously. In the proposed CMM-CSD Montgomery exponentiation algorithm, the computation results after the first loop (for i = n − 3 to 0) are 0 ≤ X, Y < (n − 2) × N. All intermediate computation results in the proposed CMM-CSD algorithm are at most (n + 2)-digit integers. After the second loop (for i = 0 to 1), the computation results are 0 ≤ X, Y < (n/4+1) × N, and are enough to accept for 0 ≤ X, Y < 3N. The basic idea of using common-multiplicand multiplication technique in the proposed CMM-CSD Montgomery binary exponentiation algorithm is to compute the common part in REDC(SC), REDC(SD) and REDC(SS) once rather than triple. The modular operations of S × 2 − i mod N for 1 ≤ i ≤ n − 2 are common to − i +1
REDC(SC), REDC(SD) and REDC(SS). If we denote T as S × 2 mod N , the modular operations of S × 2 − i mod N for 1 ≤ i ≤ n − 2 are repeatedly computed using the previous computation result of T, where S × 2 − i mod N = T × 2 −1 mod N . Thus, we can conserve memory space for the proposed CMM-CSD Montgomery −1
binary exponentiation algorithm by alternatively computing S × 2 mod N , Cn −3S × 2 −1 mod N (or Dn −3 S × 2 −1 mod N ), Sn −3S × 2 −1 , S × 2 −2 , and so on. By adopting the common-multiplicand multiplication technique (depicted in Section 2.2) to the CMM-CSD Montgomery binary algorithm to compute REDC(SC) and REDC(SD) for nonzero digits in exponent ECSD. Moreover, to further speed up the CMM-CSD Montgomery algorithm, we can put the multiplicative inverse operation in the proposed algorithm over an elliptic curve or a finite filed (where the division is replaced by subtraction such as GF(2n) using normal basis [24]). 3.3 Parallel CMM-CSD Montgomery Binary Exponentiation Algorithm
As we can execute the modular multiplication, multiplicative inverse, and modular squaring operations of the proposed CMM-CSD algorithm separately, we can therefore apply “parallel-processing” technique on the CMM-CSD Montgomery algorithm to speed up the overall modular exponentiation evaluation as follows.
Fast Parallel Montgomery Binary Exponentiation Algorithm Using CSD Technique
435
Parallel CMM-CSD Montgomery Binary Exponentiation Algorithm Input: M, ECSD, N, R E Output: C= M CSD[1] mod N, E
D= M CSD[1] mod N begin S = MR mod N, C = D = R mod N; for i = 0 to m do parbegin {if (ei = 1) then C = MM(SC);} {if (ei = 1 ) then D = MM(SD);} {S = MS(SS);} end; parbegin {C = REDC(C);} {D = REDC(D);} end; end.
4 Complexity Analyses In this section, we will detailed describe the theoretical analyses for the performance of the proposed parallel CMM-CSD Montgomery binary exponentiation algorithm. We use the number of multiplications to express the speed-up efficiency. Let m denotes the digit-length of the radix-r signed-digit exponent ECSD in the proposed CMM-CSD Montgomery algorithm. As we use radix r = 2 in our proposed method, the occurrence of the digit “0” in signed exponent ECSD is approximately 2/3, and the occurrence of the nonzero digits “1” and “ 1 ” in ECSD is close to 1/6 and 1/6, respectively [25]. Based on the computational analyses of Montgomery reduction algorithm [15], the probability of executing REDC(SC), REDC(SD), and REDC(SS) is equivalent to the occurrence probability of signed-digit “1”, “ 1 ” , and “0” in ECSD, respectively. Therefore, by using the Lemma 2 shown in Section 3.2, REDC(SC) requires 1 [(n − 2)(2n+1)+2(2n+1)]= 1 (2n2+ n) single-precision multiplications. 6
6
REDC(SD) requires 1 [(n − 2)(2n+1)+2(2n+1)]= 1 (2n2+n) 6 6 single-precision multiplications. REDC(SS) requires 2 [n × (n − 2) + 2(2n+1)] = 2 (n2 + 2n + 2) single-precision multiplications, as the 3
3
( S × 2 − j mod N ) operations are computed once. Based on the computational complexity analysis in [14], a binary exponentiation with a m-bit exponent adapted Montgomery reduction algorithm requires on average
436
C.-L. Wu
1.5m × (2n2 + n) multiplications. Meanwhile, the Ha-Moon’s improved Montgomery algorithm [15] takes 0.5m × (5n2 + 4n) multiplications. However, the proposed parallel CMM-CSD Montgomery algorithm only takes
2
1
0.5m × [ 2 × 1 (2n2 + n) + (n2 + 2n + 2) + 2] + 0.5m × [ 2 × (2n2 + n) + 2] 3 6 6 = 0.5m × (2n2 + 2n+ 16 ) 3
single-precision multiplications. n
Take a 512-bit E exponent and 2 - base N to evaluate “ME mod N” for example, our parallel CMM-CSD Montgomery modular binary exponentiation algorithm on average reduces the overall number of single-precision multiplications (compared to the original Montgomery reduction algorithm [4]) by about
1−
16 16 ) 4n2 + n − 3 = 3 ≈ 66.7% (as n grows). 1.5m(2n2 + n) 6n2 + 3n
0.5m(2n2 + 2n +
Moreover, our parallel CMM-CSD Montgomery modular binary exponentiation algorithm on average reduces the overall number of single-precision multiplications (compared to the Ha-Moon’s improved Montgomery algorithm [15]) by about
1−
16 16 ) 3n2 + 2n − 3 = 3 ≈ 30% (as n grows). 0.5m(5n2 + 4n) 5n2 + 4n
0.5m(2n2 + 2n +
5 Conclusions As we know one of the most important computer arithmetic operations in public-key cryptosystems for information security is modular exponentiation, and the Montgomery modular reduction algorithm is very useful for modular exponentiation due to its simplicity and high speed. In this paper, a new CMM-CSD Montgomery exponentiation method for speeding up modular exponentiation to benefit the RSA public-key cryptosystem was proposed based on the binary exponentiation algorithm, commonmultiplicand method, and canonical-signed-digit recoding technique. By using the proposed CMM-CSD Montgomery binary algorithm, the total number of multiplications can be reduced by about 66.7% and 30% compare the original Montgomery modular reduction algorithm and Ha-Moon’s improved Montgomery algorithm, respectively. Under the application of our proposed algorithm, “ME mod N” for a 512-bit exponent E in RSA cryptographic scheme, can be computed with the computational cost of approximately 256 modular multiplications instead of 646 modular multiplications (using the Ha-Moon’s improved Montgomery algorithm) or 768 modular multiplications (using the original Montgomery reduction algorithm).
Fast Parallel Montgomery Binary Exponentiation Algorithm Using CSD Technique
437
References [1] Rivest, R.L., Shamir, A., Adleman, L.: A method for obtaining digital signatures and public key cryptosystems. Communications of the ACM 21(2), 120–126 (1978) [2] ElGamal, T.: A public key cryptosystem and a signature scheme based on discrete logarithms. IEEE Trans. on Inform. Theory 31(4), 469–472 (1985) [3] Alia, G., Martinelli, E.: Fast modular exponentiation of large numbers with large exponents. Journal of Systems Architecture 47(14), 1079–1088 (2002) [4] Montgomery, P.L.: Modular multiplication without trial division. Mathematics of Computation 44(170), 519–521 (1985) [5] Blum, T., Parr, C.: High-radix Montgomery modular exponentiation on re- configurable hardware. IEEE Trans. on Computers 50(7), 759–764 (2001) [6] Lou, D.-C., Chang, C.-C.: Fast exponentiation method obtained by folding the exponent in half. Electronics Letters 32(11), 984–985 (1996) [7] Nozaki, H., Shimbo, A., Kawamura, S.: RNS Montgomery multiplication for duplicate processing of base transformations. IEICE Trans. on Fundamentals E.86-A(1), 89–97 (2003) [8] Joye, M., Yen, S.-M.: Optimal left-to-right binary signed-digit recoding. IEEE Trans. on Computers 49(7), 740–748 (2000) [9] Chang, C.-C., Kuo, Y.-T., Lin, C.-H.: Fast algorithms for common-multiplicand multiplication and exponentiation by performing complements. In: Proceedings of the 17th IEEE Symposium on Advanced Inform. Networking and Applications, March 2003, pp. 807– 811 (2003) [10] Menezes, A., van Oorschot, P., Vanstone, S.: Handbook of Applied Cryptography. CRC Press, Boca Raton (1997) [11] Knuth, D.E.: The Art of Computer Programming, Seminumerical Algorithms, 3rd edn., vol. II. Addison-Wesley, MA (1997) [12] Yen, S.-M., Laih, C.-S.: Common-multiplicand multiplication and its applications to public key cryptography. Electronics Letters 29(17), 1583–1584 (1993) [13] Gueron, S.: Enhanced Montgomery multiplication. In: Kaliski Jr., B.S., Koç, Ç.K., Paar, C. (eds.) CHES 2002. LNCS, vol. 2523, pp. 46–56. Springer, Heidelberg (2003) [14] Dusse, S.R., Kaliski, B.S.: A cryptographic library for the motorola DSP 56000. In: Damgård, I.B. (ed.) EUROCRYPT 1990. LNCS, vol. 473, pp. 230–244. Springer, Heidelberg (1991) [15] Ha, J.-C., Moon, S.-J.: A common-multiplicand method to the Montgomery algorithm for speeding up exponentiation. Information Processing Letters 66(2), 105–107 (1998) [16] Reitwiesner, G.W.: Binary arithmetic. In: Advances in Computers, vol. 1, pp. 231–308. Academic Education Press, NY (1960) [17] Avizienis, A.: Signed digit number representation for fast parallel arithmetic. IRE Trans. on Electronic Computers EC-10(3), 389–400 (1961) [18] Hwang, K.: Computer Arithmetic, Principles, Architecture and Design. John Wiley & Sons, NY (1979) [19] Manochehri, K., Pourmozafari, S.: Modified radix-2 Montgomery modular multiplication to make it faster and simpler. In: Proceedings of the IEEE Conference on Information Technology: Coding and Computing (ITCC), vol. 1, pp. 598–602 (2005) [20] Tawalbeh, L.A., Tenca, A.F., Koc, C.K.: A radix-4 scalable design. IEEE Potentials 24(2), 16–18 (2005)
438
C.-L. Wu
[21] Fournaris, A.P., Koufopavlou, O.: A new RSA encryption architecture and hardware implementation based on optimized Montgomery multiplication. In: Proceedings of the IEEE Symposium on Circuits and Systems (ISCAS), vol. 5, pp. 4645–4648 (2005) [22] Arno, S., Wheeler, F.S.: Signed digit representations of minimal Hamming weight. IEEE Trans. on Computers 42(8), 1007–1010 (1993) [23] Park, I.-C., Kang, H.-J.: Digital filter synthesis based on an algorithm to generate all minimal signed digit representation. IEEE Trans. on Computers-Aided Design of Integrated Circuits and Systems 21(12), 1525–1529 (2002) [24] Takagi, N., Yoshiki, J., Takagi, K.: A fast algorithm for multiplicative inversion in GF(2n) using normal basis. IEEE Trans. on Computers 50(5), 394–398 (2001) [25] David, J.P., Kalach, K., Tittley, N.: Hardware complexity of modular multiplication and exponentiation. IEEE Trans. on Computers 56(10), 1308–1319 (2007)
Fault-Free Cycles in Conditional Faulty Folded Hypercubes Che-Nan Kuo and Sun-Yuan Hsieh Department of Computer Science and Information Engineering, National Cheng Kung University, No. 1, University Road, Tainan 70101, Taiwan
[email protected],
[email protected]
Abstract. An n-dimensional folded hypercube F Qn is an attractive variance of an n-dimensional hypercube Qn , which is obtained by a standard hypercube with some extra edges established between its vertices. F Qn for any odd n is known to be bipartite. In this paper, for any F Qn (n ≥ 2) with at most 2n − 3 faulty edges in which each vertex is incident with at least two fault-free edges, we prove that there exists a fault-free cycle of every even length from 4 to 2n , and when n ≥ 2 is even, there also exists a fault-free cycle of every odd length from n + 1 to 2n − 1. The result is optimal with respect to the number of edges faults tolerated. Keywords: Bipancyclicity, folded hypercubes, fault-tolerant cycle embedding, graph-theoretic interconnection networks, Hamiltonian cycles, pancyclicity.
1
Introduction
Design of interconnection networks (networks for short) is an important integral part of the parallel processing or distributed system. There are a large number of topological choices for interconnection networks. The interested readers may refer to [2,10,25] for extensive references. Among the proposed networks, the hypercube [3] has several excellent properties such as recursive structure, regularity, symmetry, small diameter, relatively short mean internode distance, low degree, and much small edge complexity, which are very important for designing massively parallel or distributed systems [15]. Numerous variants of the hypercube have been proposed in the literature [1,4,19]. One variant that has been the focus of great deal of research is the folded hypercube, which is an extension of the hypercube, constructed by adding an edge to every pair of vertices that are the farthest apart, i.e., two vertices with complementary addresses. The folded hypercube has been shown to be able to improve the system’s performance over a regular hypercube in many measurements [1,23]. Since faults may happen when a network is put into use, it is practically meaningful and important to consider faulty networks. An edge (u, v) is said
Corresponding author.
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 439–448, 2009. c Springer-Verlag Berlin Heidelberg 2009
440
C.-N. Kuo and S.-Y. Hsieh
to be faulty if the communication link between the end-vertices u and v fails. Usually, two models are used for fault-tolerant cycle embedding: The standard fault model assumes that the distribution of faulty edges and faulty vertices is not restricted. More recently, Fu [5] posited the conditional fault model which assumes that each node is incident with at least two fault-free edges. Under the conditional fault model, Fu [6] showed that, for any n-dimensional star graph with at most 2n − 7 faulty edges, there exists a fault-free Hamiltonian cycle. Fu [8] also showed that an n-dimensional twisted cube T Qn with at most 2n − 5 edge faults contains a fault-free Hamiltonian cycle. Hung et al. [9] showed that an n-dimensional crossed cube with at most 2n − 5 edge faults contains a fault-free Hamiltonian cycle. Previously, the problem of cycle embedding on an n-dimensional folded hypercube F Qn has been studied in [7,13,18,23,26,27]. Let F Fe be the sets of faulty edges of F Qn . In this paper, under the conditional fault model with |F Fe | = 2n − 3, we prove that F Qn − F Fe for n ≥ 2 exists a cycle of every even length from 4 to 2n , and when n ≥ 2 is even, F Qn − F Fe also exists a cycle of every odd length from n + 1 to 2n − 1. The remainder of this paper is organized as follows: In Section 2, we provide some necessary definitions and notations. Embedding cycles of every length is presented in Section 3. Some concluding remarks are given in Section 4.
2
Preliminaries
A graph G = (V, E) is an ordered pair in which V is a finite set and E is a subset of {(u, v)|(u, v) is an unordered pair of V }. We say that V is the vertex set and E is the edge set. We also use V (G) and E(G) to denote the vertex set and edge set of G, respectively. Two vertices u and v are adjacent if (u, v) ∈ E. A graph G = (V0 ∪ V1 , E) is bipartite if V0 ∩ V1 = ∅ and E ⊆ {(x, y)|x ∈ V0 and y ∈ V1 }. A path P [v0 , vk ] = v0 , v1 , . . . , vk is a sequence of distinct vertices in which any two consecutive vertices are adjacent. We call v0 and vk the end-vertices of the path. In addition, a path may contain a subpath, denoted as v0 , v1 , . . . , vi , P [vi , vj ], vj , vj+1 , . . . , vk , where P [vi , vj ] = vi , vi+1 , . . . , vj−1 , vj . The length of a path is the number of edges on the path. A path with end-vertices u and v is abbreviated to an u-v path. A cycle in a graph G is a sequence of vertices v0 , v1 , ..., vk , v0 , where k ≥ 2, such that v0 , v1 , ..., vk are all distinct, and any two consecutive vertices are adjacent. For graph-theoretic terminologies and notations not mentioned here, see [24]. An n-dimensional hypercube Qn can be represented as an undirected graph such that V (Qn ) consists of 2n vertices which are labeled as binary strings of length n from 00 . . . 0 to 11 . . . 1. Each edge e = (u, v) ∈ E(Qn ) connects two n
n
vertices u and v if and only if u and v differ in exactly one bit of their labels, i.e., u = bn bn−1 . . . bk . . . b1 and v = bn bn−1 . . . b¯k . . . b1 , where b¯k is the one’s complement of bk such that b¯k = 1 − i iff bk = i for i = 0, 1. For convenience, we call e as an edge of dimension k, denoted by dim(e) = k. Clearly, each vertex
Fault-Free Cycles in Conditional Faulty Folded Hypercubes
441
connects to exactly n other vertices, and there are 2n−1 edges in each dimension and |E(Qn )| = n2n−1 . Let x = xn xn−1 . . . x1 and y = yn yn−1 . . . y1 be two n-bit binary strings. Let y = x(k) , where 1 ≤ k ≤ n, if yk = 1 − xk and yi = xi for all i = k and 1 ≤ i ≤ n. Also, let y = x¯ if yi = 1 − xi for all 1 ≤ i ≤ n. The Hamming distance dH (x, y) between two vertices x and y is the number of different bits in the corresponding strings of both vertices. The Hamming weight hw(x) of x is the number of i’s such that xi = 1. Note that Qn is a bipartite graph with bipartition {x| hw(x) is odd} and {x| hw(x) is even}. Let dQn (x, y) be the distance of a shortest path between two vertices x and y in graph Qn . Then, dQn (x, y) = dH (x, y). An n-dimensional folded hypercube F Qn is a regular n-dimensional hypercube augmented by adding more edges among its vertices. More specifically, F Qn is obtained by adding an edge between two vertices whose addresses are comple¯ . . . b¯1 . mentary to each other; i.e., vertex x = bn bn−1 . . . b1 and vertex x ¯ = b¯n bn−1 n−1 So F Qn has 2 more edges than a regular Qn . We call these augmented edges skips, to distinguish them from regular edges, and use Es to denote the set of skips and Er to denote the set of regular edges, i.e., Er = E(Qn ). Clearly, E(F Qn ) = Er ∪ Es = {e = (u, v)| dH (u, v) = 1 ∈ Er or dH (u, v) = n ∈ Es }. It has been shown that F Qn for any odd n ≥ 3 is bipartite [12]. For convenience, F Qn can be represented with ∗ ∗ . . . ∗ ∗ = ∗n , where ∗ ∈ n
{0, 1} means the “don’t care” symbol. A Qn can be partitioned into two subcubes Qn−1 along some dimension i, where 1 ≤ i ≤ n. We denote them as Q0n−1 = ∗n−i 0∗i−1 and Q1n−1 = ∗n−i 1∗i−1 , in which the ith bits of each vertex are 0 and 1, respectively. Formally, Q0n−1 (respectively, Q1n−1 ) is a subgraph of F Qn induced by {xn . . . xi . . . x1 ∈ V (F Qn )| xi = 0} (respectively, {xn . . . xi . . . x1 ∈ V (F Qn )| xi = 1}). Furthermore, we call those non-skip edges which are between Q0n−1 and Q1n−1 the crossing edges, denoted by Ec , that is, Ec = {(x, y) ∈ E(Qn )| x ∈ V (Q0n−1 ) and y ∈ V (Q1n−1 )}. Definition 1. An i-partition on F Qn = ∗n , where 1 ≤ i ≤ n, is to partition F Qn along dimension i into two (n − 1)-dimensional hypercubes ∗n−i 0∗i−1 (Q0n−1 ) and ∗n−i 1∗i−1 (Q1n−1 ). In this paper, we consider faulty F Qn , i.e., F Qn contains faulty edges. An edge is fault-free if it is not faulty. A path (cycle) is fault-free if it does not contain any faulty edge. Throughout this paper, let F Fe (respectively, Fe ) be the set of faulty edges in F Qn (respectively, Qn ). In F Qn , let Fs denote the set of faulty skips in Es . For 1 ≤ i ≤ n, let Fi denote the set of i-dimensional edges in F Fe . Therefore, ni=1 |Fi | + |Fs | = |F Fe |. If we execute an i-partition on F Qn to form two (n − 1)-dimensional hypercubes Q0n−1 and Q1n−1 , then we use Fe0 = F Fe ∩E(Q0n−1 ) and Fe1 = F Fe ∩E(Q1n−1 ). Hence, F Fe = Fe0 ∪Fi ∪Fs ∪Fe1 . In the remainder of this section, we provide some previously known results for path (cycle) embedding in hypercubes and folded hypercubes, which are useful to our method.
442
C.-N. Kuo and S.-Y. Hsieh
Lemma 1. [28] The following two statements hold: (a) Qn − Fe for n ≥ 3 has a cycle of length l for every even 4 ≤ l ≤ 2n if |Fe | ≤ 2n − 5 and each vertex in Qn − Fe is incident to at least two fault-free edges. (b) Qn − Fe for n ≥ 3 has a cycle of length l for every even 4 ≤ l ≤ 2n − 2 if |Fe | ≤ 2n − 3 and a certain vertex in Qn − Fe is incident to less than two fault-free edges. Lemma 2. [18] F Qn − F Fe for n ≥ 3 contains a Hamiltonian cycle of length 2n if |F Fe | ≤ 2n − 3 and each vertex in F Qn − F Fe is incident to at least two fault-free edges. Lemma 3. [27] In an F Qn , there is an automorphism σ of F Qn such that σ(Ei ) = Ej and F Qn − Ei ∼ = Qn for i, j ∈ {1, 2, . . . , n, s}. Lemma 4. [22] Every non-faulty edge in Qn − Fe for n ≥ 3 lies on a cycle of every even length from 6 to 2n provided that |Fe | ≤ 2n − 5 and each vertex is incident to at least two fault-free edges. Lemma 5. [17] Every non-faulty edge in Qn − Fe for n ≥ 3 lies on a cycle of every even length from 4 to 2n if |Fe | ≤ n − 2. Lemma 6. [21] Assume that n ≥ 3, and x and y are in the same partite set. Then, Qn −Fe contains a fault-free path of length 2n −2 between any two vertices x and y in the same partite set, provided that |Fe | ≤ 2n − 5 and every vertex is incident to at least two fault-free edges. Lemma 7. [20] Let u and v be any two different vertices in Qn and dQn (u, v) = d. Then there exist n internally disjoint u-v paths in Qn such that d of them are of length d, which lie in a d-dimensional subcube, otherwise of length d + 2. Lemma 8. [27] Let u and v be any two different vertices in Qn . Then, Qn − Fe for n ≥ 2 exists a fault-free u-v path of length dQn (u, v) + 2 if |Fe | ≤ n − 2.
3
Embedding Cycles in a Faulty Folded Hypercube
In this section, under the conditional fault model with |F Fe | = 2n − 3, we prove that F Qn − F Fe for any even n ≥ 2 contains a fault-free cycle of every odd length from n + 1 to 2n − 1. Lemma 9. Under the conditional fault model with |F Fe | = 2n − 3, F Qn − F Fe for any even n ≥ 2 contains a fault-free cycle of every odd length from n + 1 to 2n − 1. Proof. It is easy to check that the result holds for n = 2. We now consider F Qn for any even n ≥ 4 with |F Fe | = ni=1 |Fi |+|Fs | = 2n−3. By Lemma 3, without loss of generality, we assume that |Fs | ≥ |Fn | ≥ · · · ≥ |F1 |. Then, we consider the following two cases according to n = 4 and n ≥ 6 is even.
Fault-Free Cycles in Conditional Faulty Folded Hypercubes
443
Case 1: n = 4. In this case, 4i=1 |Fi | + |Fs | = |F Fe | = 5. Then, we have the following scenarios. Case 1.1: 4 ≤ |Fs | + |F4 | ≤ 5. In this case, |F3 | ≤ 1 and |F2 | = |F1 | = 0. We can execute a 4-partition on F Q4 to form two subcubes Q03 and Q13 such that |Fe0 | + |Fe1 | ≤ 1. Without loss of generality, we can assume that |Fe0 | ≤ 1 and |Fe1 | = 0. We choose an edge (u, v) of dimension 1 in Q03 such that either (u, u(4) ) and (v, v) are both fault-free or (u, u) and (v, v (4) ) are both faultfree. (If such an edge does not exist, then |Fs | + |F4 | ≥ 8, which contradicts the assumption that |Fs |+|F4 | ≤ 5). Note that (u, v) is fault-free by |F1 | = 0. Without loss of generality, let (u, u) and (v, v (4) ) are both fault-free. Let l be any odd integer with 5 ≤ l ≤ 15. Then, we consider the following subcases: Case 1.1.1: l = 5. Note that dQ13 (u, v (4) ) = 2. By Lemma 7, there exists a fault-free path P [u, v (4) ] of length 2 in Q13 . Therefore, u, u, P [u, v (4) ], v (4) , v, u forms a fault-free cycle of length l = 5. Case 1.1.2: 7 ≤ l ≤ 11. By Lemma 5, (u, v) in Q03 − Fe0 lies on a fault-free cycle C1 of every even length from 4 to 23 . Clearly, C1 can be represented by u, P1 [u, v], v, u. Note that dQ13 (u, v (4) ) = 2. Then, by Lemma 7, there exists a fault-free path P2 [u, v (4) ] of length 2 in Q13 . Therefore, u, P1 [u, v], v, v (4) , P2 [v (4) , u], u, u forms a fault-free cycle of every odd length l with 7 ≤ l ≤ 11. Case 1.1.3: 11 ≤ l ≤ 15. By Lemma 5, (u, v) in Q03 − Fe0 lies on a fault-free cycle C1 of every even length from 4 to 23 . Clearly, C1 can be represented by u, P1 [u, v], v, u. Since dQ13 (u, v (4) )(= 2) is even, u and v (4) are in the same partite set in Q13 . Then, by Lemma 6, there exists a fault-free path P2 [u, v (4) ] of length 23 − 2 = 6 in Q13 . Therefore, u, P1 [u, v], v, v (4) , P2 [v (4) , u], u, u forms a fault-free cycle of every odd length l with 11 ≤ l ≤ 15. Case 1.2: |Fs | = 2 and |F4 | = 1. In this case, |Fs | + |F4 | = 3, |F3 | + |F2 | = 2 and |F1 | = 0. We can execute a 4-partition on F Q4 to form two subcubes Q03 and Q13 such that |Fe0 | + |Fe1 | = 2. Then, we have the following scenarios. Case 1.2.1: (|Fe0 | = 2 and |Fe1 | = 0) or (|Fe0 | = 0 and |Fe1 | = 2). Without loss of generality, we can assume that |Fe0 | = 2 and |Fe1 | = 0. Let l be any odd integer with 5 ≤ l ≤ 15. When l = 5, the proof is similar to that presented in Case 1.1.1. Then, in order to complete the proof of cycle of every odd length l with 7 ≤ l ≤ 15, we consider the following subcases: Case 1.2.1.1: Two faulty edges are not incident to the same vertex in Q03 . In this case, we can choose a faulty edge (u, v) in Q03 such that either (u, u(4) ) and (v, v) are both fault-free or (u, u) and (v, v (4) ) are both faultfree. (If such an edge does not exist, then |Fs | + |F4 | ≥ 4, which contradicts the assumption that |Fs | + |F4 | = 3). Without loss of generality, let (u, u) and (v, v (4) ) are both fault-free. By Lemma 5, (u, v) in Q03 − (Fe0 − (u, v)) lies on a fault-free cycle C1 of every even length from 4 to 23 . Clearly, C1 can be represented as u, P1 [u, v], v, u. Note that dQ13 (u, v (4) ) = 2. Then, we consider the following two subcases: Case 1.2.1.1.1: 7 ≤ l ≤ 11. By Lemma 7, Q13 contains a fault-free path P2 [u, v (4) ] of length 2. Therefore, u, P1 [u, v], v, v (4) , P2 [v (4) , u], u, u forms a fault-free cycle of every odd length l with 7 ≤ l ≤ 11.
444
C.-N. Kuo and S.-Y. Hsieh
Case 1.2.1.1.2: 11 ≤ l ≤ 15. By Lemma 6, there exists a fault-free path P2 [u, v (4) ] of length 23 − 2 = 6 in Q13 . Therefore, u, P1 [u, v], v, v (4) , P2 [v (4) , u], u, u forms a fault-free cycle of every odd length l with 11 ≤ l ≤ 15. Case 1.2.1.2: Two faulty edges are incident to the same vertex in Q03 . We assume that Fe0 = {(u, v), (u, w)}. By assumption that there are at least two fault-free edges incident to u, without loss of generality, we assume that (u, u) is fault-free. Clearly, either (v, v (4) ) is fault-free or (w, w(4) ) is faultfree because of |F4 | = 1. Without loss of generality, suppose that (v, v (4) ) is fault-free. By Lemma 5, (u, v) in Q03 − (u, w) lies on a fault-free cycle C1 of every even length from 4 to 23 . Note that dQ13 (u, v (4) ) = 2. Then, the construction of a cycle of every odd length l with 7 ≤ l ≤ 15 is similar that presented in Case 1.2.1.1.1 and Case 1.2.1.1.2. Case 1.2.2: |Fe0 | = 1 and |Fe1 | = 1. The proof is similar to that presented in Case 1.1. Case 1.3: |Fs | = |F4 | = |F3 | = |F2 | = |F1 | = 1. In this case, we execute an i-partition on F Q4 to form two subcubes Q03 and Q13 such that Qj3 for some j ∈ {0, 1} contains two faulty edges and Q1−j contains exactly one faulty edge. 3 Without loss of generality, we can assume that i = 4, |Fe0 | = 2 and |Fe1 | = 1. Then, the proof of cycle of every odd length from 5 to 15 is similar to that presented in Case 1.2.1. n Case 2: n ≥ 6 and n is even. In this case, since i=1 |Fi | + |Fs | = |F Fe | = 2n−3 ≥ n+3 for n ≥ 6 and |Fs | ≥ |Fn | ≥ · · · ≥ |F1 |, it leads to |Fs |+|Fn | ≥ 4, which implies that |Fs | ≥ 2. Furthermore, there exists at most one vertex which is incident to exactly one fault-free edge in F Qn − Es ∼ = Qn . (If there are two vertices in F Qn − Es such that each vertex is incident to exactly one fault-free edge, then |F Fe | ≥ (n − 1) + (n − 1) − 1 + 2 = 2n − 1, which contradicts the assumption that |F Fe | ≤ 2n − 3). Hence, we can execute an npartition on F Qn to form two subcubes Q0n−1 and Q1n−1 so that |Fe0 | + |Fe1 | ≤ 2n − 3 − 4 = 2n − 7. Without loss of generality, we assume that |Fe0 | ≥ |Fe1 | 1 which implies that |Fe1 | ≤ 2n−7 2 = n − 4 and thus every vertex in Qn−1 is incident to at least two fault-free edges. Let l be any odd integer with n + 1 ≤ l ≤ 2n − 1. We first construct a fault-free cycle with length l = n + 1 and l = n + 3. We can choose an edge (u, v) ∈ E(Q0n−1 ) of dimension 1 such that {(u, v), (u, u), (v, v (n) )} ∩ F Fe = ∅. (If the three edges do not exist, then |F1 | + |Fs | + |Fn | ≥ 2n−2 > 2n − 3 for n ≥ 5, which contradicts the assumption that |F Fe | ≤ 2n − 3). Since dQ1n−1 (u, v (n) ) = n − 2, then by Lemma 7 (resp., Lemma 8), there exists a fault-free path P [u, v (n) ] of length n − 2 (resp., n) in Q13 . Therefore, u, u, P [u, v (n) ], v (n) , v, u forms a fault-free cycle of length l = n + 1, n + 3. In order to construct a cycle of every odd length l with n + 5 ≤ l ≤ 2n − 1, we consider the following subcases: Case 2.1: Every vertex in F Qn − Es ∼ = Qn is incident to at least two faultfree edges. Note that Q0n−1 contains at most one vertex which is incident to exactly one fault-free edge in Q0n−1 . (If there are two vertices in Q0n−1 such that each vertex is incident to exactly one fault-free edge in Q0n−1 , then
Fault-Free Cycles in Conditional Faulty Folded Hypercubes
445
|Fe0 | ≥ (n − 2) + (n − 2) − 1 = 2n − 5 > 2n − 7, which contradicts the assumption that |Fe0 | ≤ 2n − 7). Case 2.1.1: Every vertex in Q0n−1 is incident to at least two fault-free edges. We can choose an edge (u, v) of dimension 1 such that {(u, v), (u, u), (v, v (n) )} ∩F Fe = ∅. By Lemma 4, (u, v) in Q0n−1 − Fe0 lies on a fault-free cycle C1 of every even length from 6 to 2n−1 . Clearly, C1 can be represented as u, P1 [u, v], v, u. Note that dQ1n−1 (u, v (n) ) = n − 2. Then, we consider the following two subcases: Case 2.1.1.1: n + 5 ≤ l ≤ 2n−1 + n − 1. By Lemma 7, there exists a faultfree path P2 [u, v (n) ] of length n − 2 in Q1n−1 − Fe1 . Therefore, u, P1 [u, v], v, v (n) , P2 [v (n) , u], u, u forms a fault-free cycle of every odd length l with n + 5 ≤ l ≤ 2n−1 + n − 1. Case 2.1.1.2: 2n−1 + 5 ≤ l ≤ 2n − 1. By Lemma 6, there exists a fault-free path P2 [u, v (n) ] of length 2n−1 − 2 in Q1n−1 − Fe1 because of |Fe1 | ≤ n − 4 < 2n − 7 for n ≥ 4. Therefore, u, P1 [u, v], v, v (n) , P2 [v (n) , u], u, u forms a fault-free cycle of every odd length l with 2n−1 + 5 ≤ l ≤ 2n − 1. Note that l = 2n−1 + n − 1 ≥ 2n−1 + 5 for n ≥ 6. Therefore, a cycle of every odd length l with n + 1 ≤ l ≤ 2n − 1 is constructed in F Qn − F Fe . Case 2.1.2: There is a unique vertex u in Q0n−1 which is incident to exactly one fault-free edge. In this case, there are n − 2 faulty edges with different dimensions which are all incident to u in Q0n−1 . By the assumption of Case 2.1 and |Fn | ≥ |Fi | for 1 ≤ i ≤ n − 1, (u, u(n) ) is fault-free and |Fn | ≥ 1. Then, we consider the following subcases: Case 2.1.2.1: (u, u) is fault-free. In this case, we can choose a faulty edge (u, v) ∈ E(Q0n−1 ) incident to u such that (v, v (n) ) is fault-free. (If such an edge does not exist, then |Fe0 | + |Fn | + |Fs | ≥ (n − 2) + (n − 2) + 2 = 2n − 2 > 2n − 3, which contradicts the assumption that |F Fe | ≤ 2n − 3). By Lemma 4, (u, v) in Q0n−1 − (Fe0 − (u, v)) lies on a cycle C1 of every even length from 6 to 2n−1 in Q0n−1 . Note that dQ1n−1 (u, v (n) ) = n − 2. Then, the construction of cycle of every odd length l with n + 5 ≤ l ≤ 2n − 1 is similar to that presented in Case 2.1.1.1 and Case 2.1.1.2. Case 2.1.2.2: (u, u) is faulty. In this case, we can choose a faulty edge (u, v) ∈ E(Q0n−1 ) incident to u such that (v, v) is fault-free. (If such an edge does not exist, then |Fe0 | + |Fs | + |Fn | ≥ (n − 2) + (n − 1) + 1 = 2n − 2 > 2n − 3, which contradicts the assumption that |F Fe | ≤ 2n − 3). Then, the construction of a fault-free cycle of every odd length l with n + 5 ≤ l ≤ 2n − 1 is similar to that used in Case 2.1.2.1. Case 2.2: There is a unique vertex u in F Qn − Es ∼ = Qn which is incident to exactly one fault-free edge. In this case, since u is incident to at least two faultfree edges, (u, u) is fault-free. Moreover, because |Fs | ≥ 2 and the number of faulty regular edges which are incident to u equals n − 1, there are at most (2n − 3) − (n − 1) − 2 = n − 4 other faulty regular edges and every vertex in F Qn −u is incident to at least n−(n−4)−1 = 3 fault-free regular edges. In this case, we repartition F Qn along dimension j for some 1 ≤ j ≤ n to form two subcubes Q0n−1 and Q1n−1 such that one faulty edge (u, uj ) is a crossing edge,
446
C.-N. Kuo and S.-Y. Hsieh
i.e., (u, uj ) ∈ Ec . Without loss of generality, we assume that u ∈ V (Q0n−1 ) and j = 1. Hence, |Fs | + |F1 | ≥ 3, |Fe0 | + |Fe1 | ≤ 2n − 6, and |Fe1 | ≤ n − 4. We can choose a faulty edge (u, v) ∈ E(Q0n−1 ) such that (v, v (1) ) is fault-free. (If such an edge does not exist, then |Fe0 | + |Fs | + |F1 | ≥ (n − 2) + 2 + (n − 2) + 1 = 2n − 1 > 2n − 3, which contradicts the assumption that |F Fe | ≤ 2n − 3). By Lemma 4, (u, v) in Q0n−1 − (Fe0 − (u, v)) lies on a fault-free cycle C1 of every even length from 6 to 2n−1 . Note that dQ1n−1 (u, v (1) ) = n − 2. Then, the construction of a fault-free cycle of every odd length l with n + 5 ≤ l ≤ 2n − 1 is similar to that presented in Case 2.1.1.1 and Case 2.1.1.2. By combining the above two cases, we complete the proof. Under the conditional fault model with |F Fe | = 2n − 3, we can prove that F Qn − F Fe for n ≥ 2 contains a fault-free cycle of every even length from 4 to 2n . Due to the space limitation, the proof of the following lemma is omitted. Lemma 10. Under the conditional fault model with |F Fe | = 2n− 3, F Qn − F Fe for n ≥ 2 contains a fault-free cycle of every even length from 4 to 2n . By Lemmas 9 and 10, we have the following theorem. Theorem 1. Under the conditional fault model with |F Fe | = 2n−3, F Qn −F Fe for n ≥ 2 contains a fault-free cycle of every even length from 4 to 2n , and when n ≥ 2 is even, F Qn − F Fe contains a fault-free cycle of every odd length from n + 1 to 2n − 1.
4
Concluding Remarks
There exists an n-dimensional folded hypercube with 2n − 2 faulty edges, in which each vertex is incident to at least two fault-free edges such that a faultfree Hamiltonian cycle does not exist. For example, let u = bn bn−1 . . . bi . . . b2 b1 and v = b¯n bn−1 . . . bi . . . b2 b¯1 . One can consider the 2n− 2 faulty edges in F Qn as (u, u), (v, v), (u, u(i) ) and (v, v (i) ) for all 2 ≤ i ≤ n − 1. Obviously, vertices u and v each have exactly two fault-free edges incident to them. Hence the four edges (u, u(1) ), (u, u(n) ), (v, v (1) ) and (v, v (n) ) form a four cycle by themselves. Therefore, in this worst case, it is impossible to construct a fault-free Hamiltonian cycle. Therefore, our result is worst-case optimal with respect to the number of edges faults tolerated.
References 1. El-Amawy, A., Latifi, S.: Properties and performance of folded hypercubes. IEEE Transactions on Parallel and Distributed Systems 2(1), 31–42 (1991) 2. Bermond, J.C. (ed.): Interconnection networks, a special issue of Discrete Applied Mathematics, vol. 37/38 (1992) 3. Bhuyan, L., Agrawal, D.P.: Generalised hypercubes and hyperbus structure for a computer network. IEEE Transactions on Computers C-33, 323–333 (1984)
Fault-Free Cycles in Conditional Faulty Folded Hypercubes
447
4. Esfahanian, A.H., Ni, L.M., Sagan, B.E.: The twisted n-cube with application to multiprocessing. IEEE Transactions on Computers 40, 88 (1991) 5. Fu, J.-S.: Longest fault-free paths in hypercubes with vertex faults. Information Science 176, 759–771 (2006) 6. Fu, J.-S.: Conditional fault-tolerant Hamiltonicity of star graphs. Parallel Computing 33, 488–496 (2007) 7. Fu, J.-S.: Fault-free cycles in folded hypercubes with more faulty elements. Information Processing Letters 108(5), 261–263 (2008) 8. Fu, J.-S.: Fault-free Hamiltonian cycles in twisted cubes with conditional link faults. Theoretical Computer Science 407(1-3), 318–329 (2008) 9. Hung, H.S., Chen, G.H., Fu, J.S.: Fault-free Hamiltonian cycles in crossed cubes with conditional link faults. Information Sciences 177(24), 5664–5674 (2007) 10. Hsu, D.F.: Interconnection networks and algorithms, a special issue of Networks 23(4) (1993) 11. Hsieh, S.Y., Chen, G.H., Ho, C.W.: Hamiltonian-laceability of star graphs. Networks 36(4), 225–232 (2000) 12. Hsieh, S.Y., Kuo, C.N.: Hamiltonian-connectivity and strongly Hamiltonianlaceability of folded hypercubes. Computers and Mathematics with Applications 53(7), 1040–1044 (2007) 13. Hsieh, S.Y.: Some edge-fault-tolerant properties of the folded hypercube. Networks 51(2), 92–101 (2008) 14. Hsieh, S.Y.: A note on cycle embedding in folded hypercubes with faulty elements. Information Processing Letters 108(2), 81 (2008) 15. Leighton, F.T.: Introduction to Parallel Algorithms and Architecture: Arrays· Trees· Hypercubes. Morgan Kaufmann, San Mateo (1992) 16. Lewinter, M., Widulski, W.: Hyper-Hamilton laceable and caterpillar-spannable product graphs. Computer and Mathematics with Applications 34(11), 99–104 (1997) 17. Li, T.K., Tsai, C.H., Tan, J.M., Hsu, L.H.: Bipanconnectivity and edge-faulttolerant bipancyclicity of hypercubes. Information Processing Letters 87(2), 107– 110 (2003) 18. Ma, M.J., Xu, J.M., Du, Z.Z.: Edge-fault-tolerant hamiltonicity of folded hypercubes. Journal of University of Science and Technology of China 36(3), 244–248 (2007) 19. Preparata, F.P., Vuillemin, J.: The cube-connected cycles: a versatile network for parallel computation. Communication of the ACM 24, 300–309 (1981) 20. Saad, Y., Schultz, M.H.: Topological properties of hypercubes. IEEE Transactions on Computers 37(7), 867–872 (1988) 21. Tsai, C.H.: Linear array and ring embeddings in conditional faulty hypercubes. Theoretical Computer Science 314(3), 431–443 (2004) 22. Tsai, C.H., Lai, Y.C.: Conditional edge-fault-tolerant edge-bipancyclicity of hypercubes. Information Sciences 177(24), 5590–5597 (2007) 23. Wang, D.: Embedding Hamiltonian cycles into folded hypercubes with faulty links. Journal of Parallel and Distributed Computing 61(4), 545–564 (2001) 24. West, D.B.: Introduction to Graph Theory, p. 07458. Prentice-Hall, Upper Saddle River (2001) 25. Xu, J.: Topological Structure and Analysis of Interconnection Networks. Kluwer academic publishers, Dordrecht (2001)
448
C.-N. Kuo and S.-Y. Hsieh
26. Xu, J.M., Ma, M.J.: Cycles in folded hypercubes. Applied Mathematics Letters 19(2), 140–145 (2006) 27. Xu, J.M., Ma, M.J., Du, Z.Z.: Edge-fault-tolerant properties of hypercubes and folded hypercubes. Australasian Journal of Combinatorics 35, 7–16 (2006) 28. Yang, M.C., Tan, J.M., Hsu, L.H.: Highly fault-tolerant cycle embeddings of hypercubes. Journal of Systems Architecture 53(4), 227–232 (2007)
Research on Parallel HW/SW Partitioning Based on Hybrid PSO Algorithm* Yue Wu**, Hao Zhang, and Hongbin Yang School of Computer Engineering and Science, Shanghai University, Shanghai 200072, China
[email protected],
[email protected],
[email protected]
,
Abstract. Generally Hardware/Software (HW/SW) partitioning can be approximately resolved through some kinds of optimal algorithms. Based on both characteristics of HW/SW partitioning and Particle Swarm Optimization (PSO) algorithm, a novel parallel HW/SW partitioning method is proposed in this paper. A model of parallel HW/SW partitioning on the basis of PSO algorithm is established after analyzing the particularity of HW/SW partitioning. A hybrid strategy of PSO and Tabu Search (TS) is proposed in this paper, which uses the intrinsic parallelism of PSO and the memory function of TS to speed up and improve the performance of PSO. To settle the problem of premature convergence, the reproduction and crossover operation of genetic algorithm (GA) is also introduced into procedure of PSO. Experimental results indicate that the parallel PSO algorithm can efficiently reduce the running time even for large task graphs. Keywords: SoC, HW/SW partitioning, particle swarm optimization algorithm, Tabu search, parallel algorithm.
1 Introduction An important phase in Hardware/Software co-design in embedded system is to partition the specification into hardware and software implementation sets. Achieving the optimum partition can reduce the system cost and the time-to-market. Moreover, flexibility, low cost and reconfiguration are the characters of software realization. While hardware usually operates much faster than that of software, it is also significantly much more expensive than the use of software. Therefore, how to achieve optimal tradeoff between cost and performance is the crucial problem that must be resolved in HW/SW partitioning [1], [2]. PSO algorithm is the optimization algorithm which developed by Kennedy and Eberhart in 1995[3]. Its development is originated from the observations of the bird crowds flying and the thinking of why they always change their flying direction suddenly. As an optimization algorithm, the purpose of the individuals in PSO is to find out *
This work has been Supported by the Shanghai-Applied Materials Research and Development Fund under grant No.06SA18. ** Corresponding author. A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 449–459, 2009. © Springer-Verlag Berlin Heidelberg 2009
450
Y. Wu, H. Zhang, and H. Yang
the best position when they move through the problem space. These individuals in PSO, called particles, will be initialized by a randomized velocity and position at the beginning of searching, and then these particles will change their initial velocities and positions under the companion's influence [4]. PSO has been applied into the field of HW/SW partitioning for its high implement efficiency. It has been proved that PSO can find the optimal solution of the problem with stochastic mechanism based on probability theory. However, it also has been proved that PSO takes too much time in addressing larger scale problems. Searching the same feasible solution repeatedly can’t be avoided, either [5]. Meanwhile, many heuristic algorithms have been proposed for HW/SW partitioning problem. Though those algorithms are not able to always definitely find the global optimal solution, they can solve the problem with high efficiency and even have higher performance in searching local optimum. According to these merits, a parallel HW/SW partitioning method based on hybrid PSO algorithm which absolutely improves the efficiency and quantity of HW/SW partitioning is presented in the paper. The memory function of Tabu Search and the reproduction and crossover operation of genetic algorithms are both introduced into the procedure of PSO algorithm. By comparison, it has been proved that this method is more viable and effective than that of conventional GA.
2 Mathematical Model for HW/SW Partitioning Let H={h1,h2…hk} denote all possible mappings sets of the tasks to hardware, where h1,h2…hk stand for different IP cores; S be a software implementation set and O a total function set. Then the following relationships hold, i.e., H ⊂ O, S ⊂ O, H S=O, H∩S=φ. An SoC system is defined as a 3-tuple: S={V, E, I}, where V={v1,v2…vN}is the task nodes set; E={eij} denotes data dependency among nodes; and I={I1,I2…IN} is an implementation set for each node. Ii ⊂ H S, is the realization set for node i where
∪
∪
⎧1,vi realized in hardware Ii = ⎨ ⎩0,vi realized in software
(1)
vi is the parameter model, i.e., vi=. AiH denotes the area when node vi is realized in hardware. TiH, TiS denote the running time when node vi is realized in hardware and software, respectively. PiH, PiS denote the power consumption when node vi is realized in hardware and software respectively. CiH, CiS denote the cost when node vi is realized in hardware and software, respectively. Therefore, the process of the HW/SW partitioning is to find a map from the node set V to the final partition I: V→I, with the minimal cost and performance constraint satisfaction. 2.1 Objective Function The system will be terminated when all constraints are satisfied, i.e., time and cost are under restriction, respectively; generations aren’t up to the maximum; the majority
Research on Parallel HW/SW Partitioning Based on Hybrid PSO Algorithm
451
cost and running time are almost the same. Concretely, choose k individuals randomly after every evolution and the terminating condition is as follows: k
∑|t i =1
i
k
− t constrain |
≤ xt ∩
k
∑|c i =1
i
− c constrain | k
≤ xc
(2)
In this paper, we are aiming at minimizing the system overhead such as execution time, power consumption, hardware area and manufacturing costs under the assumption along some pre-determined system constrains. Assume that Farea is hardware area overhead after partitioning, i.e., F area ( s ) =
Where
n
∑
i=1
A iH I i
N
∑
A iH I i + A mem + A bus x c
i =1
(3)
denotes the area of functional components, Amem represents the
area of storage components and Abus is the total area of connected buses under the partitioning.
n
∑
i=1
A iH I i
, as IP groupware, depends on the number of nodes mapping in
hardware realization. Amem relies on the size of storage which can be estimated roughly. Abus is dependent on the total interconnect buses. Ftime(s) is the system running time, i.e., F time ( s ) =
N
∑ {T
H i
I i + (1 − I i ) T i S }
(4)
i =1
Fcost(s) is the total costs after partitioning, i.e., F cos t ( s ) =
N
∑ {C i =1
H i
I i + (1 − I i ) C iS }
(5)
The total functional costs are the sum of dynamic and static functional cost in system framework. The former is the static cost in functional modules and the latter is communicating cost among modules. Generally, the latter can be omitted. With respect to node vi, the communicating cost can be defined as follows:
Pi =
∑e
ij I i ⊕ I j =1∩ ∃ e ij ∈ E
(6)
So the total power consumption can be defined as F power ( s ) =
N
∑ {P + P i =1
i
i
H
I i + (1 − I i ) Pi S }
(7)
The HW/SW partitioning modeling is the optimal combination of time, area, power consumption and cost. That is also a multiple-objective optimization and the objective function is as follows: V – min F(s)=[ Farea(s), Ftime(s), Fcost(s), Fpower(s)]
T
(8)
452
Y. Wu, H. Zhang, and H. Yang ⎧ ⎪ ⎪ ⎪ s .t . ⎨ ⎪ ⎪ ⎪⎩
k
∑
| t
i = 1
i
−
t
constrain
|
k k
∑
i = 1
| c
i
−
c k
constrain
≤
x
≤
x
t
| c
Where tconstrain represents the running time under system constraints and cconstrain is functional cost. When the number of nodes N≤150, we can define k=15, or else k = ⎡N ⎤ . Meanwhile, xc, xt are needed to be confirmed by the idiographic system time 10
and cost parameters. This terminating strategy is so adaptive that it can avoid both inanition search and no optimal solution. Furthermore, xc and xt can also take control of the searching time. 2.2 Maximum Iterations The system must be forced to terminate when the convergence rate trends to 0 and it has not yet satisfied the terminating condition. So the maximum iterations must be predetermined in advance. Several factors affecting the iterations of PSO are as follows: 1. Search strategy: The iterations can’t be set too small or too large: for too small the optimal candidate solutions can hardly be found, for too large it will be time-consuming. Therefore, most likely, the iterations can vary from 500 to 1000. 2. Function components size: The significant factor that affects the iterations is the amount of function components. The larger scale of the functions is, the larger search space and the more iteration are needed. 3. If an initial candidate solution approximates the optimal solution, the algorithm’s complexity can be reduced, otherwise more iterations are needed. PSO’s iterations can be adjusted by the precision of initial partition. g(tx, tconstrain, cx, cconstrain) represents the precision of function partition and the expression of maximum iteration is as follows: ⎞ ⎛ ⎛N⎞ ⎞ ⎛ 1 ⎟⎟ N MAX _ iter = 150 × ⎜⎜ log⎜ ⎟ + 1⎟⎟ × ⎜⎜ δ − + 10 g ( t , t , c , c ) λ ⎝ ⎠ ⎝ ⎠ ⎝ x constrain x constrain ⎠
(9)
Where δ and λ are convertible parameters which can be confirmed by the systemic need.
3 Hybrid Particle Swarm Optimization Algorithm 3.1 Tabu Search TS is a local search technology through self-adaptive memory structure. TS algorithm has high search rate with memory function [6]. It has high hill-climbing capability for inferior solutions to be accepted. So TS can be out of the constraint of local optimal solution space and converts to other solution space so as to find better solution or global optimal solution.
Research on Parallel HW/SW Partitioning Based on Hybrid PSO Algorithm
453
3.2 Hybrid Particle Swarm Optimization Algorithm (HPSOA) This is a merit colligation of PSO and TS so as to obtain relatively high efficiency. In this paper, the new particle generated via PSO will be viewed as the initial solution in TS and the selection of population in PSO is replaced by TS. In this way, it cannot only enhance the hill-climbing capability of PSO but also improve the TS searching capability. New particle generated by updating PSO is used as the current solutions’ neighborhoods in TS, and then be evaluated so as to obtain better convergence and avoid local optimum. Multiple solutions are selected at a time as long as the candidate solutions can pass the TS selection, which is different from simple TS. It is just the instinct parallel characteristic of PSO. Individuals passed TS selection can be accepted as new generations in HPSOA. That’s just the concept of HPSOA and the premature convergence is delayed or avoided. 3.3 Fitness Function Generally, fitness is concerned with the iteration benchmark of particles from users and searching principles. Two factors must be considered in the fitness design. 1. High discrepancy in the particles must be forbidden or mass gathering from particles will wreck the diversity of the population even the premature convergence will occur. 2. When constraints existing, how to reserve the unsatisfied excellent gene must be considered into the step of fitness design. Penalty technique is introduced to fine the unsatisfied individuals. Costs usually attract more attentions of SoC designers than time or performance in practice. The value of fitness displays the individual’s performance. Higher fitness means higher superiority. Particles between critical points have a few differences in fitness but many differences in performance. Now the definition of fineness function is following:
n fit = e
t c ∗ t − t co n s tr a in c − c c o n s tr a in
(10) .
Time and cost parameters of individuals whose constraints are satisfied should be both greater than 1. If at least one of the parameters is less than 1, then that will be unsatisfied individuals. So the final fitness function is defined as follows:
Fitness = α j × e
t − tY c − cY ∗ t − t constrain c − c constrain
⎧ t − tY ⎪ f tim e = t − t constrain ⎪ s .t . ⎨ c − cY ⎪ ⎪ f cos t = c − c constrain ⎩
+ ( int ) m in ( ftim e , f cos t ) × nfit (11)
where t is the maximum running time in software realization of the whole system, c represents the maximum hardware realization cost, tY is software executing time of
454
Y. Wu, H. Zhang, and H. Yang
individual Y, cY is the hardware cost of individual Y, tconstrain is time constraint, cconstrain represents cost constraint, ftime is a time parameter and fcost is a cost parameter, is a parameter which could vary with the discrepancy of individuals. Then individual fitness can be changed via fineness function so as to improve the selection probability. 3.4 Update Operation Instead of using evolutionary operators to manipulate the individual as in other evolutionary computational algorithms, each individual in PSO flies in the search space with a velocity which is dynamically adjusted according to its own flying experience and its companions’ flying experience. Each individual is treated as a volume-less particle in the d-dimensional search space. Each particle keeps track of its coordinates in the problem space, which are associated with the best solution (fitness) called pbest. Another best value that is tracked by the global version of the particle swarm optimizer is the overall best value, and its location, obtained so far by any particle in the population. This location is called gbest. At each time step, the PSO algorithm consists of velocity changes of each particle toward its pbest and gbest locations. Acceleration is weighted by a random term, with separate random numbers generating for acceleration toward pbest and gbest locations. The modified velocity and position of each individual particle can be calculated using the current velocity and the distance from pbestid to gbestid, as shown in the following equations:
vk +1id = w× vk id + c1 × r1 × ( pbestid − xk id ) + c2 × r2 × (gbestid − xk id ))
(12)
if (rand () < sig mo id (vk +1id )) then xk +1id = 1 else xk +1id = 0
(13)
Where (V
min
xidk and vidk are current position and velocity of individual i at iteration k.
≤ Vidk ≤ V max ) The pbest is the historical best position of xidk and gbest is the
global best position in the population’s history. Sigmoid(v) is a sigmoid limiting transformation function f (x) = 1 −x , and rand() is a random number selected from a (1+ e ) uniform distribution in [0.0, 1.0]. Besides, there are five parameters should be defined, w is the inertia weight factor, c1 and c2 are acceleration constants, r1 and r2 are uniform random numbers between 0.0 and 1.0. Suitable selection of inertia weight w in Equation (12) provides a balance between global and local exploration and exploitation, and on average results in less iterations required to find a sufficiently optimal solution. As originally developed, w often decreases linearly from about 0.9 to 0.4 during one execution [7]. In general, the inertia weight w is set according to the following equation:
w = w max −
w max − w min × iter . itermax
(14)
Where itermax is the maximum iteration number and iter is the current iteration number.
Research on Parallel HW/SW Partitioning Based on Hybrid PSO Algorithm
455
3.5 Reproduction Operation In this paper, integer vector encoding is adopted and multiple-point crossover is applied with a probability 0.9 equal to mutation rate, i.e., pc=0.9. If generations is below 10, i.e., mM’. Input function Iuv is the number of tokens or data items consumed by v of edge (u, v) in each firing of v, output function Ouv is the number of tokens or data items produced by v of edge (u, v) in each firing or invocation of u, r is the set of invocation times of the nodes, and marking M(e) [resp. M0(e)] is the set of (resp. initial) delay counts or tokens on edge e. G is an SRDFG (MRDFG) if none (some) of Iuv and Ouv are more than one. For SRDFG, Tk= ∑ni ∈Lk ri denotes the sum of the invocation times ri of nodes ni in loop Lk. Nk= ∑eι∈Lk Mi denotes the total number of delay elements Mi of every edge ei in loop Lk. Loop Bound of loop Lk, LBk=Tk/Nk, is the total loop computation time, Tk, divided by the number of delay elements, Nk, inside loop Lk. Cycle time or Iteration Bound (I =max{Tk/Nk. ; k 1, 2, …, q}, q being the number of loops) of a system is the lower bound on the achievable iteration period. The loop with the (resp. next) largest loop bound is called the (resp. sub-) critical loop. Ru (denoted by ku in [1]) denotes the number of invocations of node u in an iteration.
3 The Approach When an MRDFG behaves like an SRDFG (i.e., can complete one system iteration by executing each loop once), we can extend the technique for SRDFG [6] to MRDFG [2, 3]. The IB for MRDFG with no loop-combination is similar to that for SRDFG except the sum of delays must be weighted; i.e., I = max {Tk/Dek; k = 1,2, . . . , q}, where the equivalent D, Dek=∑eh∈Lk ℑh with the weighted delay ℑh=ℑ(eh) =Mh/(ao(eh)R(no)). Note that Mh is the delay at edge eh in the loop Lk , ao(eh)=Oeh denotes the number of data consumed from eh by one invocation of the end node n0 of the edge, R(no) is the the number of invocations of node no in an iteration, and q is the total number of loops. For the example in Fig. 1, RT=[2 2 1 1 2], q=2, ℑT=[1 1/2 0 0 0 0] where ℑ2=1/2 is not an integer and hence it does not behave like an SRDFG (unless we add one delay to the edge e2 to make ℑ2=1) since in order for n2 to execute for the first time, each node (except n1) in L2 must have been executed once — a so-called loop-combination which occurs when there is a loop which must execute more than once in order to complete one system iteration. We propose to develop an algorithm to find iteration bounds of MRDFG with loop-combination. We attack this problem first from simple cases such as the one in Fig 1. Note that in order for n3 to execute once, n1 must execute twice. The first invocation of n1 leads to a delay blocked at the input edge of n3. The delay produced by the second invocation of n1, however, will not lead to delay blocking and the net behaves like an SRDFG. The time duration between the two invocations of n1 is T2, the sum of invocation times in L2. Hence, after T2, the net behaves like an SRDFG and after T’=max(T1, T2), the net returns to its initial state. Thus, we have the iteration period I= T2+max(T1, T2). Note that the MRDFG can be reduced to an SRDFG (single rate DFG) in Fig. 2 with the same set of nodes, edges and node invocation times except for nodes (e.g. n1, increased by T2) involved with the loop combination. In general, if n1 executes k times for n2 to execute once, I=(k-1)T2+max(T1, T2). In the reduced net, the invocation time of node n1is increased by (k-1)T2.
Unfolding of Multirate Data-Flow Graph to Compute Iteration Bound
Fig. 1. Example of an MRDFG with loop combination
Fig. 2. Reduced SRDFG where all arcs are of unit weights and all r remain the same except r1 is replaced by r1+T2
463
Fig. 3. SRDFG reduced from the MRDFG in Fig. 2
4 The Algorithm We propose to compute the iteration bound (IB) of an MRDFG by converting the MRDFG into an equivalent SRDFG. It consists of the following steps: 1) decomposing it into a number of loop-combination free subnets or islands (lcf-islands), 2) find the duplication factor di for each lcf-island Πi, 3) Setting all edge weights unity and expanding Πi di times, 4) Merge all Πi along common subislands, and 5) Compute the IB for the resulting SRDFG. Each step is explained after the following example. There are 2 loops in Fig. 1 and each is an lcf-island. For L1 to execute once, L2 must execute twice implying u=2 for L2. Thus, we unfold L2 twice while making all edge weights unity and setting all nonzero initial delays to unity also. Now we expand (Step 6 in Algorithm I) n1 in L1 to n1-e’1- n12 since n1 is enlarged to n1 and n’1 in L2. We now merge (Step 7 in Algorithm I) the new L1 with the expanded L2 along the common nodes n1 and n’1. The IB for the resulting net in Fig. 3 equals that of the MRDFG in Fig. 1. We assume that Πi is single-enabled; that is only one node in each loop is executable initially. However, the results also apply to the case of multiple-enabled Πi using the retiming technique [2]. That is, we fire nodes in Πi so that only one node is executable in Πi. Definition 1: Let Ri denote the R for island Πi. Let R(n) (Ri(n)) be the component of reproduction vector of node n for the DFG (island Πi) and n be an initially enabled node in Πi. The total enabling factor of Πi, ςni= M0(e’)/(ao(e’)Ri(n)) where n∈ e’● is the ouput node of edge e’. di=R(n)/Ri(n) is the duplicate factor of Πi, ςti, when being an integer, is the number of island iterations (the system iteration for the isolated island) that can be performed by firing one round of all nodes in Πi to return to the initial marking of Πi. We say that Πi is enabled ςni times. di indicates the number of island iterations needed to complete one system iteration. We assume in Algorithm I that the fraction part alone would not make the island live; i.e.,
464
D.Y. Chao
continuous executions of the island will reach a deadlock to simplify the presentation. Thus, ςni will be assumed to be an integer in the algorithm. If ςni≥di, then Πi is able to complete one system iteration by firing one round of all transitions in Πi to return to M0 and there is no need to unfold the island and the unfolding factor q=1. On the other hand, if ςni 0, such that (¶k-1)c=(¶k)c, (¶k-1)d≠(¶k)d. The set of incompatible subislands in N is denoted by ¶c. Island Πi (each node n) is unfolded into Πi1, Πi2, …, and Πiq (n1, n2, …, and nq). Except for the last Πiq, the execution of each Πij, j∈{1,2,...,q-1}completes ςni loop iterations. One execution of Πiq finishes di - (q-1) ςni ( , where S is a finite set of states, A is a finite set of actions, T is a transition function and R is a reward function. The system described by the MDP can be controlled using the set of actions. By applying action a in a state s , the system makes a transition from s to a new state s ' , based on a probability distribution over the set of possible transitions. The transition function T is defined as T : S × A × S → [0,1] , i.e. the probability of ending up in state s ' after doing action a in state s is denoted T ( s, a, s ') . It is required that for all actions a , and all states s and s ' , T ( s, a, s ') ≥ 0 and T ( s, a, s ') ≤ 1 . Furthermore, for all states s and actions a , A Markov Decision Process (MDP) is defined as a tuple
∑
s '∈S
T ( s, a, s ') = 1 , i.e. T defines a proper probability distribution over possible
next states. The set of actions that can be applied in a state
s is denoted A( s ) . The
468
Q. Zhang, G. Sun, and Y. Xu
reward function R is defined as R : S → \ . It attaches a reward to each state, i.e. a value that is obtained due to being in some state. State-action, or state-action-state reward functions can be defined similarly. However, for reasons of simplicity we will mainly work with state-based reward functions throughout the paper. [1] 2.2 Finding the Optimal Policy Before we consider algorithms for learning to behave in MDP environments, we will explore techniques for determining the optimal policy given a correct model. These dynamic programming techniques will serve as the foundation and inspiration for the learning algorithms to follow. We will speak of the optimal value of a state. It is the expected infinite discounted sum of reward that the agent will gain if it starts in that state and executes the optimal policy [4]. Using π as a complete decision policy, it is written ∞
V * ( s ) = max E (∑ γ t R( st ) | s0 = s ) π
t =0
This optimal values function is unique and can be defined as the solution to the simultaneous equations
V * ( s ) = max( R( s ) + γ ∑ T ( s, a, s ')V * ( s ')), ∀s ∈ S , a
s '∈S
which assert that the value of a state s is the expected instantaneous reword plus the expected discounted value of the next state, using the best available action. Given the optimal value function, we can specify the optimal policy as
π * ( s) = arg max( R( s) + γ ∑ T ( s, a, s ')V * ( s ')) a
s '∈S
.
2.3 Dynamic Programming Solving MDP Solving a given MDP means computing an optimal policy π that assigns the best action to every state in the state space. To achieve this, many dynamic programming methods exist. The main idea is to compute value functions and derive optimal policies from them, usually in an iterative way. *
1) Policy Iteration Policy iteration (PI) [5] is a classical dynamic programming algorithm. It starts with an arbitrary initialized policy. Then a sequence of iterations follows, in which the current policy is evaluated and improved. For a finite MDP, the number of different policies is finite, so policy iteration converges in finite time. The value function of a policy is just the expected infinite discounted reward that will be gained, at each state, by executing that policy. It can be determined by solving a set of linear equations. Once we know the value of each state under the current policy, we consider whether the value could be improved by changing the first action taken. If it can, we change the policy to take the new action whenever it is in that
Parallel Algorithms for Solving Markov Decision Process
469
situation. This step is guaranteed to strictly improve the performance of the policy. When no improvements are possible, then the policy is guaranteed to be optimal. |S |
Since there are only | A | distinct policies and each new policy dominates the previous one [7], it is obvious that policy iteration terminates in at most an exponential number of steps. Policy improvement can be performed in
O(| A | × | S |2 ) arithmetic operations,
3
and value determination in O (| S | ) steps by solving a system of linear equations.1 The total running time, therefore, is polynomial if and only if the number of iterations required to find an optimal policy is polynomial. But there is no known tight worstcase bound available for policy iteration. However, it is an important open question how many iterations policy iteration takes in the worst case. It is known that the running time is pseudo-polynomial and that for any fixed discount factor there is a polynomial bound in the total size of the MDP [6]. In practice, it usually converges after a small number of iterations and per-iteration is completed in
O(| A | × | S |2 + | S |3 ) . Value Iteration Algorithm:
Policy Iteration Algorithm: choose an arbitrary policy π ' loop
initialize V ( s ) arbitrarily loop until policy good enough loop for s ∈ S
π =π ' compute the value function of policy π : solve the linear equations
loop for a ∈ A Q ( s , a ) = R ( s ) + γ ∑ T ( s , a , s ')V ( s ')
V π ( s) = R( s) + γ ∑ T ( s, π ( s), s ')V π (s ')
s '∈ S
end loop
s '∈S
improve the policy at each state :
π '( s) = arg max( R( s) + γ ∑ T ( s, a, s ')V π ( s ')) a
s '∈S
until π = π '
V ( s ) = max a Q ( s , a ) end l oop end loop
Fig. 1. Policy Iteration Algorithm
Fig. 2. Value Iteration Algorithm
2) Value Iteration The value iteration (VI) algorithm finds an optimal policy indirectly via the optimal value function, rather than manipulating the policy directly. It operates as follows: [4] The VI algorithm can be stated as follows: starting with a value function V0 over all states, one iteratively updates the value of each state to get the next value functions
Vt (t = 1, 2,3,...) . VI is guaranteed to converge in the limit towards V * . A deterministic policy 1
π
for all states
s ∈ S can be computed using V * .
In theory, value determination can probably be done somewhat faster, since it primarily requires inverting a N×N matrix, which can be done in O(N2.376) steps [8].
470
Q. Zhang, G. Sun, and Y. Xu
Value iteration works by producing successive approximations of the optimal value function. Each iteration can be performed in O (| A | × | S | ) . However, the number of iterations required can grow exponentially in the discount factor. 2
3 Parallel Algorithms Although dynamic programming algorithms compute the optimal policy for a given MDP in finite time, they are relatively inefficient. In this section, we give two basic parallel algorithms solving MDP to reduce computational time. In all parallel algorithms, we assume that the system has P processors, and all processors are working synchronously. Parallel Policy Iteration Algorithm 1. Require: V(s) ∈ \ and π (s) ∈ A(s) arbitrarlly 2. {Policy Evaluation} 3. while ∆ ≥ σ repeat ∆= 0 4. 5. for all Pi where 0 ≤ i ≤ p-1 do 6. m=0 for s=i to state_num-1 step p do 7. 8. v=V[s] 9. V[s]=R ( s) + γ ∑ s ' T ( s, π ( s), s ')V ( s ') 10. m=max(m,|v-V[s]|) 11. end for ∆ = max(∆, m ) 12. 13. end for 14. end while 15. {Policy Improvement} 16. policy-stable=true 17. for all Pi where 0 ≤ i ≤ p-1 do 18. for s = i to state_num-1 step p do 19. b = π (s) π (s)=R( s ) + γ arg max a [∑ s ' T ( s, a, s ')V ( s ')] 20. 21. if b ≠ (s) then policy-stable=false 22. if policy-stable then stop 23. else go to 2. Policy Evaluation
Parallel Value Iteration Algorithm: 1. Require: initialize V arbitrarily 2. while ∆ ≥ σ repeat 3. ∆=0 4. for all Pi where 0 ≤ i ≤ p-1 do 5. m=0 6. for s=i to state_num-1 step p do 7. v=V[s], V[s]=0 8. for a=0 to action_num-1 do 9. q = R(s) + γ ∑s '∈S T (s, a, s ')V (s ') 10. V[s]=max(V[s],q) 11. end for 12. m=max(m,|v-V[s]|) 13. end for 14. ∆=max(∆,m) 15. end for 16. end while 17. for all Pi where 0 ≤ i ≤ p-1 do 18. for s=i to atate_num-1 step p do 19. π (s)=R(s) + γ argmaxa[∑s ' T (s, a, s ')V (s ')] 20. end for 21. end for
Fig. 3. Pseudo code of Parallel PI Algorithm
Fig. 4. Pseudo code of Parallel VI Algorithm
3.1 Parallel Policy Iteration Algorithm In the sequential dynamic programming, algorithm has been separated into several iterations. For each iteration, there is a great deal of computation, and it takes a long time. So we wanted to find a method which processes iterations in parallel. In the following paragraphs, we propose a parallel policy iteration (PPI) algorithm. Assuming the sequential algorithm, an iteration consists of policy evaluation and policy improvement. The first step, the policy evaluation step, computes each
s∈S :
V π ( s ) = R( s ) + γ ∑ T ( s, π ( s ), s ')V π ( s ') . s '∈S
V π ( s ) for
Parallel Algorithms for Solving Markov Decision Process
471
π
To compute V ( s ) in parallel, we partition the state into P groups on an average, and assign each state group to one processor. Each processor holds the π
π
previous V vector ( V ( s ') , so it can compute the next V ( V ( s ) ). And after all processors complete their task, we have to gather all computer result in pre-processor. The second step, the policy improvement step, computes π ( s ) by V ( s ) . In the same way as the first step, all processor work independently. By the two steps, we get a policy, but it’s allocated in so many processors. As this point, the master processor (is the processor whose id is 0 as usual) check if the policy is stable. If the policy is stable, the master processor gathers the result π ( s ) and the parallel algorithm can stop, or else go to the next iteration. The complete pseudo of our parallel algorithm can be found in Figure 3. π
3.2 Parallel Value Iteration Algorithm Using the similar approach as the parallel policy iteration algorithm, we also developed a parallel value iteration (PVI) algorithm. A pseudo code of PVI algorithm is shown in Figure 4.
4 Analysis of the Parallel Algorithm In this section, we provide a detailed analysis for our parallel algorithms. 4.1 Computation and Communication Cost The flow chart of our parallel policy iteration algorithm is shown in Figure 5. In phase 0, the algorithm starts with an arbitrary initialized policy π ( s ) and value function
V ( s) . In phase 1, all processors work in parallel. Every processor computes the new value of a portion of states which is assigned to the processor statically in the start. Assume one processor manage | S | P state, so the local computation cost in this phase is
O(| S | ×(| S | P)) = O(| S |2 P) . In phase 2, each processor must gather the result of phase 1 from other processor. And the master processor receives the difference between the new value function and old one. So the communication cost is
O(( P − 1) × (| S | P) × P) + O( P − 1) = O( P× | S |) In phase 3, the master processor checks it needs further compute the value function. In practice, one can stop once the difference between two successive value functions is small. In the worst case, it needs O (| S |) loop.
472
Q. Zhang, G. Sun, and Y. Xu
Fig. 5. Flow chart of PPI algorithm
At this point, the policy evaluation step is completed. In this step, the computation cost is
O(| S |2 P) × O(| S |) = O(| S |3 P) . And the communication cost is
O( P× | S |) × O(| S |) = O( P× | S |2 ) . In phase 4, all processor determine the better action of states in parallel. To select an optimal action given the state function V , we applied the following rule:
π ( s) = arg max( R( s) + γ ∑ T ( s, a, s ')V ( s ')) . a
s '∈S
Clearly, it needs | A | × | S | step for one state and there are processor. So the local computation cost is
| S | P states in each
O(| A | × | S | ×(| S | P)) = O(| A | × | S |2 P) In phase 5, the master processor receives the policy information from other processor. In practical, this message only holds one integer. So the communication cost is O ( P ) .
Parallel Algorithms for Solving Markov Decision Process
473
In phase 6, the master processor checks the policy is stable and the policy iteration can stop. In phase 7, the master processor gathers the result, i.e. the optimal policy, and its communication cost is
O((| S | P) × ( P − 1)) = O(| S |) . And then the algorithm stops. So in one iteration of PPI algorithm, the computation consists of phase 1 and phase 4. The total computation cost is
O (| S |3 P ) + O (| A | × | S |2 P ) = O ((| S |3 + | A | × | S |2 ) P ) . And the communication consists of phase 2 and the phase 5. The total communication cost is
O( P× | S |2 ) + O( P) = O( P× | S |2 ) . Similarly, in one iteration of PVI algorithm, the computation cost is
O(| A | × | S |2 P) , and the communication cost is O( P× | S |) . 4.2 Scalability Analysis Isoefficiency metric has been found to be a very useful metric of scalability for a large number of problems on a large class of commercial parallel computers [9]. It is defined as follows. Let P is the number of processors and W is the problem size (in total time taken for the best sequential algorithm). If maintain an efficiency
W needs to grow as f E ( P) to
E , then f E ( P) is defined to be the Isoefficiency function for
E and the plot of f E ( P) with respect to P is defined to be the Isoefficiency curve for efficiency E . efficiency
The computation cost and communication cost in each iteration of PPI algorithm is given in the previous section.
Total Computation Time = O((| S |3 + | A | × | S |2 ) P ) Total Communication Time = O( P× | S |2 ) . Total parallel run time is the sum of computation time and communication time.
Parallel Run Time = O( P× | S |2 + (| S |3 + | A | × | S |2 ) P ) In the serial case, the time for one iteration is
SerialTime = O(| S |3 + | A | × | S |2 ) . To get the Isoefficiency function, we equate total parallel run time to serial computation time
O( P× | S |2 +(| S |3 + | A | × | S |2 ) P) = O (| S |3 + | A | × | S |2 ) .
474
Q. Zhang, G. Sun, and Y. Xu
Therefore, the Isoefficiency function of PPI algorithm is
W =| S |3 + | A | × | S |2 = O(| S |2 ×P) . Similarly, the Isoefficiency function of PVI algorithm is
W =| A | × | S |2 = O(| S | ×P) . The both parallel algorithms are scalable well. 4.3 Load Balance In most of parallel algorithms, load balance problem is a serious impediment to achieve good performance. In our parallel algorithms, when the states are split at first, each portion is assigned to one of processors. In order for the number of states of each portion is approximately the same, all states are to be equally divided between those processors. So that, each processor has | S | P states independently, this guarantees the load balance performance of large scale problems.
5 Experimental Results In this section, we have solved a challenging problem based on an aspect of a realtime strategy war game by MDP. And then, we have implemented the parallel algorithm using the MPI programming library.
(a)
(b)
(c)
(d)
Fig. 6. Stratagus PC-game: 3 assaults against 3 enemies executing the generalized Policy computed by our algorithm. The red is our army and the blue is the enemy.
5.1 Apply MDP in Stratagus For our experiments, we used an instance of the Stratagus (Freecraft) domain outlined in [10]. Stratagus is a freeware real-time strategy war game. The goal of playing is to control a set of agents and manage resources so as to construct an army and defeat an opponent. Stratagus problems tend to involve dense, rather than isolated, interactions between variables, so they are not readily factored. The tactical problem [11] is a test of agent control. An in-game screenshot of the tactical scenario is shown in Figure 6. The player (or agent, in our example) starts with n assaults, and is confronted by an enemy with an equal number of equivalent footmen. Each assault is capable of attacking any individual enemy, and may switch
Parallel Algorithms for Solving Markov Decision Process
475
targets at any time. Rewards are achieved for each enemy killed or wounded. The overall goal is to defeat the opposing force as quickly as possible, and this be met at least cost. We find the optimal policy for the agent control using MDP. More formally, the environment of the battle is associated with state variables. The state is consists of assault and enemy’s health state and each assault weather been attacked. The health state of a unit can take one of three values: Healthy, Wounded and Dead. Assume there are n assaults, so the number of states is 2 × 3 . The action of the agent at each time step is assigning an order to each assault of our army. The order shows the attacking target which is one of enemy, or command for escape. When an assault is dead, it only be assigned order Die. So there are n + 2 n
2n
(n + 2) n . For our experiments, we use n = 3 , then there are 5832 states and 125 actions.
orders for one assault, and the total number of actions is
As this MDP model and our program, we get an optimal policy. We assigned this policy to the game agent, and combat with enemy which is controlled by the originality AI (Artificial Intelligence). The result is shown in Figure 6. By the end of the battle, our army defeats the enemy. They killed all the enemy’s assaults and cost only one assault. 5.2 The Performance of Our Parallel Algorithm Experiments were done on HP Superdome9000. The results for comparing speedup of the parallel algorithm are reported for parallel runs on 1, 2, 4, 8, 12, 16, 24, 32, 40 processors. Each processor has a clock speed of 1 GHz. The operating system is HP-UX. 1) Speedups of PPI algorithm We explore the performance of the parallel algorithm on up to 40 processors. For measuring the speedups, we worked with MDP problems of different sized datasets. We increased the processors from 1 to 48 and compared the run time to the sequential program. The result in Figure 7 shows the run time curve with different number of processors for solving a MDP which holds 5832 states and 125 actions. And the results in Figure 8 show speedup of the parallel algorithm proposed in this paper. From the graph in Figure 7, we can see that the run time is reduced as increasing the number of processors. In the case of this example, the growth of speedup can be represented by a linear trend until the number of processors has increased to 8. After that the increase of speedup will be moderated for 10 or more processors. There are two reasons for this. First, our parallel algorithm incurs high communication cost, while the number of processors is lager. Second, a synchronization has to be done among different processors as soon as their communication buffer fills up. The communication buffer has the result of all the discrete variables for each state’s value. While the number of processors is large, this synchronization is done many times in each iteration. Therefore, the processors wait for each other during synchronization, and thus, contribute to poor speedups.
476
Q. Zhang, G. Sun, and Y. Xu
From the graph in Figure 8, we can see that our parallel program have obtained good speedups on most of the datasets we tested. The speedups are scalable up to 40 processors on our system. From the comparison of speedup curves of different size datasets, we can see that the performance of our parallel algorithm is better on large size datasets than on small ones. This is because that the proportion of computation cost is greater on large size datasets. All the processors can work in parallel during most of the run time. The results confirm that our parallel algorithm is indeed very effective.
Fig. 7. Run time of PPI algorithm
Fig. 8. Speedups of PPI algorithm
2) Speedups of PPI algorithm Based on the same input data as those in the above experiments, we observed the performance of our PVI algorithm. As the number of processors increases, the total run time of this algorithm reduces just as figure 9 shows. Meanwhile, the speedup results of our algorithm are shown in figure 10. It is scalable from 1 to 40 processors.
Fig. 9. Run time of PVI algorithm
Fig. 10. Speedups of PVI algorithm
6 Conclusion In this paper, we proposed two parallel algorithms to solve the MDP problem and analyzed the performance of them. The two parallel programs are implemented to solve a real problem. The experimental results have shown that our parallel algorithms have achieved good speedups on various datasets.
Parallel Algorithms for Solving Markov Decision Process
477
There are several optimizations which can further improve the performance and scalability of those parallel algorithms. Chief of all, the communication cost is dearly heavy in our parallel algorithms, and it embarrasses the performance of parallel. Furthermore, the parallel method of our algorithms may be extended to other interesting MDP algorithms, such as Value Iteration [12] and Q-Learning [13]. Acknowledgments. This research was supported by National Natural Science Foundation of China (Grant No.60533020 and 60873210).
References 1. Otterlo, M.V.: A Survey of Reinforcement Learning in Relational Domains, Technical Report, TR-CTIT-05-31, ISBN ISSN 1381-3625, CTIT Technical Report Series, P. 70 (2005) 2. Foster, I., Kesselman, C.: The Grid: Blueprint for a New Computing Infrastructure. Morgan Kaufmann, San Francisco (1999); Sutton, R.S., Barto, A.G.: Reinforcement Learning: an Introduction. The MIT Press, Cambridge (1998) 3. Bhulai, S.: Markov Decision Processes the control of high-dimensional system, Dissertation. University press, Amsterdam (2002) 4. Kaelbling, L.P., Littman, M.L., Moore, A.W.: Reinforcement Learning: A Survey. Journal of Artificial Intelligence Research 4, 237–285 (1996) 5. Howard, R.A.: Dynamic Programming and Markov Processes. The MIT Press, Cambridge (1960) 6. Littman, M.L., Dean, T.L., Kaelbling, L.P.: On the complexity of solving Markov decision problems. In: Proceedings of the Eleventh Annual Conference on Uncertainty in Artificial Intelligence (UAI 1995) Montreal, Quebec, Canada (1995) 7. Puterman, M.L.: Markov Decision Processes. John Wiley & Sons, New York (1994) 8. Coppersmith, D., Winograd, S.: Matrix multiplication via arithmetic progressions. In: Proceedings of 19th Annual ACM Symposium on Theory of Computing, pp. 1–6 (1987) 9. Kumar, V., Grama, A., Gupta, A., Karypis, G.: Introduction to Parallel Computing: Algorithm Design and Analysis. Benjamin Commings/Addison Wesley, Redwod City (1994) 10. Guestrin, C.E., Koller, D., Gearhart, C., Kanodia, N.: Generalizing plans to new environments in relational MDPs. In: Proceedings of the Eighteenth International Joint Conference on Artificial Intelligence (IJCAI 2003), Acapulco, Mexico (2003) 11. Gearhart, C.: Genetic Programming as Policy Search in Markov Decision Processes. In: Genetic Algorithms and Genetic Programming at Stanford 2003, Stanford California, USA, pp. 61–67 (2003) 12. Bellman, R.E.: Dynamic Programming. Princeton University Press, Princeton (1957) 13. Watkins, C.J.C.H., Dayan, P.: Q-learning, Machine Learning Journal. Special Issue on Reinforcement Learning 8(3/4) (1992) 14. Stratagus, http://www.stratagus.org/
Parallel Algorithms for the Weighted Distance Transform on Linear Arrays with a Reconfigurable Pipelined Bus System Horng-Ren Tsai Department of Information Technology, Ling Tung University, 1, Lingtung Road, Nantun, Taichung City, Taiwan, R.O.C.
[email protected]
Abstract. In this paper, based on the advantages of both optical transmission and electronic computation, we first provide an O(log log N) bus cycles parallel algorithm for weighted distance transforms of an N × N binary image on a linear array with a reconfigurable pipelined bus system using N2 processors. By increasing the number of processors, the proposed algorithm can be run in 2 +1 / ε O(loglogq N) and O(1) bus cycles using qN2 and N processors respectively, where 2 ≤ q ≤ N , ε is a constant and ε ≥ 1 . These results improve on previously known algorithms developed on various parallel computation models. Keywords: Distance transform, image processing, parallel algorithms, linear array with a reconfigurable pipelined bus system.
1 Introduction The distance transform is an operation that converts an image consisting of black and white pixels to an image, where each pixel has a value or coordinate that represents the distance or location to the nearest black pixel. The distance transform is first introduced by Rosenfeld and Pfaltz [12]. Because the distance transform based on the Euclidean distance is quit time consuming, there are many approximate distance transforms based on various distance functions are developed, such as city block, chessboard and chamfer distances. These distance transforms are extensively used in a variety of image processing and computer vision problems [8, 12]. Efficient sequential and parallel algorithms for distance transform of an N × N binary image based on different distance functions have been well studied by many researchers [1, 2, 4, 5, 13]. Borgefors [1] gave an O(N2) time sequential algorithm for the city block distance transform. Hirata [4] also gave an O(N2) time sequential algorithm which is applicable to a wide class of distance transforms. The class contains almost all kinds of distance transforms for image processing operations. Schwarzkopf [13] gave an O(log N) time parallel algorithm for the city block distance transform and an O(log2 N) time parallel algorithm for the chessboard distance transform on the mesh of trees using N2 processors. Lee and Horng [5] gave three cost optimal algorithms for the chessboard distance transform on various parallel computation models. A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 478–489, 2009. © Springer-Verlag Berlin Heidelberg 2009
Parallel Algorithms for the Weighted Distance Transform on Linear Arrays
479
These proposed algorithms could be run in O(log N) time on the EREW PRAM using O(N2/log N) processors, in O(loglog N) time on the CRCW PRAM using O(N2/loglog N) processors, and in O(log N) time on the hypercube using O(N2/log N) processors, respectively. Fujiwara et al. [2] also gave several cost optimal algorithms for the weighted distance transform on various parallel computation models. The weighted distance transform is generalization of distance functions such as city block, chessboard and chamfer distances. These proposed algorithms could be run in O(log N) time on the EREW PRAM using N2/log N processors, in O(loglog N) time on the CRCW PRAM using N2/loglog N processors, in O(N2/p2 + N) time on the mesh using p2 processors, and in O(N2/p2+(Nlog p)/p) time on the hypercube using p2 processors, where 1≤ p ≤ N . The array with a reconfigurable optical bus system have received a great deal of attention during the last few years. An array with a reconfigurable optical bus system can be defined as a set of processors connected to a reconfigurable optical bus system whose configuration can be dynamically changed by setting up the local switches of each processors at run time, and a message can be transmitted concurrently on a bus in a pipelined fashion. Recently, two related models have been proposed, namely the linear array with a reconfigurable pipelined bus system (LARPBS) [7, 9] and the array with reconfigurable optical buses (AROB) [10]. The minor difference between the two models lies in the fact that the counting is not permitting in the LARPBS model during a bus cycles but is allowed in the AROB model. By integrating the advantages of both optical transmission and electronic computation, many problems can be solved in constant time upon such a machine [7, 9, 10, 14, 15]. In this paper, we are interested in using the LARPBS model to develop the parallel algorithms for the weighted distance transform of an N × N binary image. All algorithms proposed in this paper can be easily modified to run on the AROB model. We first design an O(loglog N) bus cycles parallel algorithm for this problem using N2 processors. Then, by increasing the number of processors, two O(loglogq N) and O(1) bus cycles parallel algorithms are also derived using qN2 and N
2 +1 / ε
processors re-
spectively, where 2 ≤ q ≤ N , ε is a constant and ε ≥ 1 . Clearly, compared to the results shown in the literature [2, 5], our results are more scalable and flexible in both time and processor complexities. These results improve on previously known algorithms developed on various parallel computation models. The rest of this paper is organized as follows. We first discuss the computation model in Section 2. Section 3 describes some definitions and notations of the weighted distance transform. Section 4 deals with some basic operations. Section 5 presents the efficient parallel algorithms for the weighted distance transform. Finally, some concluding remarks are included in the last section.
2 The Computation Model A pipelined optical bus system uses optical waveguides instead of electrical signals to transfer messages among electronic processors. In addition to the high propagation speed of light, there are two important properties of optical signal (pulse) transmission on an optical bus, unidirectional propagation and predictable propagation delay per
480
H.-R. Tsai
unit length. These two advantages enable synchronized concurrent accesses of an optical bus in a pipelined fashion [3, 6]. Such pipelined optical bus systems can support a massive volume of communications simultaneously and are particularly appropriate for applications that involve intensive communication operations. Fig. 1 shows a linear array of size N in which electronic processors are connected to an optical bus each with two directional couplers. One is used to write data on the upper (transmitting) segment of the bus and the other is used to read the data from the lower (receiving) segment of the bus. Optical signals propagate unidirectionally from left to right on the upper segment and from right to left on the lower segment.
0
1
Porcessor
2
N-1
Directional Coupler
Fig. 1. A pipelined optical bus system of size N
To route messages on an optical bus system, the coincident pulse addressing technique [6, 11] can be applied. Using this approach, a source processor Pi determines the relative time delay of a select pulse and a reference pulse so that they will coincide and produce a double-height pulse only at a destination processor Pj. By properly adjusting the detecting threshold of the detector at processor Pj, this double-height pulse can be detected, thereby addressing Pj. A linear array with a reconfigurable pipelined bus system (LARPBS) extends the capabilities of the pipelined optical bus system [3, 6] by permitting each processor to connect to the bus through a pair of configuration switches. That is, each processor with a local memory is identified by a unique index denoted as Pi and each processor has two configuration switches: RST(i), a 1 × 2 optical switch, on the section between Pi and Pi+1 of the transmitting segment, and RSR(i), a 2 × 1 optical switch, on the section between Pi and Pi+1 of the receiving segment, where 0 ≤ i ≤ N . Both configuration switches RST(i) and RSR(i) are controlled by processor Pi. These configuration switches are able to reconfigurable a bus system into several independent subsystems that can operate in parallel. When all configuration switches are set to straight, the bus system operates as a regular pipelined bus system. When RST(i) and RSR(i) are set to cross, the bus system is split into two separate systems, one consisting of P0, P1, " , Pi, and the other consisting of Pi+1, Pi+2, " , PN-1. For a unit of time, assume each processor can perform ordinary arithmetic and logic computations and interprocessor communication. All computations and
Parallel Algorithms for the Weighted Distance Transform on Linear Arrays
481
communications are synchronized by bus cycles, which is similar to an SIMD machine. Let var(k) denote the local variable var (memory or register) in a processor with index k. For example, sum(1) is a local variable sum of processor P1.
3 Definitions and Notations Given an N × N image F with f (i , j ) ∈ {0, 1} , 0 ≤ i , j < N , where "1" denotes a black pixel and "0" denotes a white pixel. The pixel f(0, 0) is located on the top corner of the image. Let B={(i, j) | f(i, j)=1} be the set of all block pixels of F. The weighted distance dw(p1, p2) between a pixel p1=(i1, j1) and p2=(i2, j2) is defined by the following expression [2, 8]. ⎧ w | i − i | + w1 | j1 − j2 | if |i1 − i2 |≥| j1 − j2 |, d w (i , j ) = ⎨ 0 1 2 otherwise, ⎩ w1 | i1 − i2 | + w0 | j1 − j2 | where the weighted coefficients w0 and w1 are nonnegative constants. The weighted distance can be considered as a generalization of many distance functions. For example, by setting w0 and w1 appropriately, the weighted distance dw can be obtained as follows. z z
a city block distance if (w0, w1)=(1, 1), a chessboard distance if (w0, w1)==(0, 1),
z
a optimal chamfer distance if (w0, w1)=(1, 1 / a chamfer 2-3 distance if (w0, w1)=(2, 3), a chamfer 3-4 distance if (w0, w1)=(3, 4),
z
a quasi-Euclidean distance if (w0, w1)=(1,
z z
2 −1+
2 − 1 ),
2 − 1 ).
The distance transform of a black and white binary image is an operation which each pixel finds the distance to its nearest black pixel. In other words, the distance transform is to compute the distance d(i, j) given by
d(i, j)= min{ d(p, pB) | pB ∈ B }, where d(p, pB) is the distance from the pixel p=(i, j) to a black pixel pB of B. If d=dw, we call the distance transform as the weighted distance transform. The nearest feature transform is an operation which each pixel finds the coordinates of its nearest black pixel. In other words, the nearest feature transform is to compute the coordinate NFT(i, j) given by NFT(i, j)= (x, y) s.t. d(p, pB) =d(i, j), where p=(i, j) and pB=(x, y) ∈ B. Assume that the distance functions are based on the city block distance (w0=w1=1) and the chessboard distance (w0=0 and w1=1), an example for the weighted distance transform and the nearest feature transform of a given image F of size 4 × 4 is shown in Fig. 2.
482
H.-R. Tsai 0 0 1 2 3
1 1
2
3 0 1 2 3
1 1
0 1 2 1 0
1 0 1 2 1
2 1 2 1 2
(a) 0 1 1 1 0
0 1 2 3
1 0 1 1 1
3 2 1 0 1
(b) 2 1 1 1 1
3 2 1 0 1
0 1 2 3
0 (0,1) (0,1) (3,0) (3,0)
1 (0,1) (0,1) (3,0) (3,0)
(c)
2 (0,1) (0,1) (2,3) (2,3) (d)
3 (0,1) (2,3) (2,3) (2,3)
Fig. 2. An example for the weighted distance transform and the nearest feature transform of a binary image. (a) An input binary image F of size 4×4. (b) The weighted distance transform of F based on the city block distance(w0=w1=1). (c) The weighted distance transform of F based on the chessboard distance(w0=0 and w1=1). (d) The nearest feature transform of F based on the city block distance.
4 Basic Operations In this section, we shall introduce two parallel algorithms for the triangular matrix transpositions and the diagonal prefix minima computations. These two basic operations will be used to find the weighted distance transform of a binary image in the next section. Before our discussion, several primitive operations proposed on the LARPBS are summarized in the following. z
One-to-One Communication: Assume that processors Pi , Pi , …, Pi 0
and processors Pj , Pj , … , Pj 0
1
m −1
1
m −1
are senders
are receivers. In particular, processor Pi sends a k
value ri to Pj for all 0 ≤ k < m simultaneously. k
z
k
Broadcasting: A source processor Pi sends a value x to all the N processors P0 , P1 , … , PN −1 .
z
Multicasting: A source processor Pi sends a value ri to a subset of the N processors Pj , Pj , … , Pj . 0
z
m −1
1
Multiple Multicasting: Assume that there are g disjoint groups of distination processors Gk={ Pj , Pj , … , Pj }, 0 ≤ k < g , and there are g senders Pi , Pi , k ,0
… , Pi
k , g −1
z
k , g −1
k ,1
k ,0
k ,1
. Processor Pi have a value ri to be broadcast to all the processors in k
k
Gk, where 0 ≤ k < g . Boolean Value Aggregation: Assume that every processor Pi, 0 ≤ i < N , holds a binary value. We need to calculate the logical AND/OR operation of the N values.
Parallel Algorithms for the Weighted Distance Transform on Linear Arrays
483
By the pipelined ability of optical bus, these five primitive operations can be performed on an LARPBS in a constant number of bus cycles. The detailed implementation can be refer to [9]. This leads to the following lemma. Lemma 1. [9] The primitive operations including one-to-one communication, broadcasting, multicasting, multiple multicasting and boolean value aggregation can be performed in constant number of bus cycles on an LARPBS.
Let A=aj, 0 ≤ j < N , be a data sequence of size N. The prefix and suffix minima computations of these N data items are defined to find paj=min { ak | 0 ≤ k ≤ j } and
saj=min{ak | j ≤ k < N }, respectively. Tsai [14] gave three effiucient parallel algorithms for the prefix/suffix minima computation on an LARPBS. This leads to the following lemma. Lemma 2. [14] Given a data sequence of size N, the prefix/suffix minima of these N data items can be found in O(loglog N), O(loglogq N) and O(1) bus cycles on an
LARPBS using N, qN and N and ε ≥ 1 .
1 +1/ ε
processors, where 2 ≤ q ≤
N , ε is a constant
4.1 The Triangular Matrix Transpositions
Given a data matrix of size N × N , the triangular matrix is a square matrix in which either all the elements above the main diagonal or all the elements below the main diagonal of it are zero. There are four triangular matrices including a upper right, upper left, lower right and lower left triangular matrices. An example for these four triangular matrices is showed in Fig. 3. The triangular matrix transposition is defined to transpose the diagonal data of a triangular matrix horizontally. These include the upper right triangular matrix transposition(URTMT), the upper left triangular matrix transposition(ULTMT), the lower right triangular matrix transposition(LRTMT), and the lower left triangular matrix transposition(LRTMT). Fig. 4 shows these four triangular matrix transpositions corresponding to Fig. 3.
0 1 2
0 a0,0
1 a0,1 a1,1
2 a0,2 a1,2 a2,2
0 1 2
0 a0,0 a1,0 a2,0
(a)
1 a0,1 a1,1
2 a0,2
0 0 1 2
a2,0
(b)
1 a1,1 a2,1 (c)
2 a0,2 a1,2 a2,2
0 1 2
0 a0,0 a1,0 a2,0
1
2
a1,1 a2,1 (d)
a2,2
Fig. 3. The triangular matrices. (a) The upper right triangular matrix. (b) The upper left triangular matrix. (c) The lower right triangular matrix. (d) The lower left triangular matrix. 0 0 1 2
a0,0
1 a0,1 a1,1 (a)
2 a0,2 a1,2 a2,2
0 1 2
0 a0,0 a1,0 a2,0
1 a0,1 a1,1 (b)
2
a0,2
0 1 2
0 a2,0
1 a1,1 a2,1 (c)
2 a0,2 a1,2 a2,2
0 1 2
0 a0,0 a1,0 a2,0
1 a1,1 a2,1
2 a2,2
(d)
Fig. 4. The triangular matrix transpositions corresponding to Fig. 3. (a) URTMT. (b) ULTMT. (c) LRTMT. (d) LLTMT.
484
H.-R. Tsai
By the pipeline ability of optical bus, Tsai [14] showed that these four triangular matrix transpositions can be easily done in constant number of bus cycle on an LARPBS. This leads to the following lemma. Lemma 3. [14] The triangular matrix transpositions can be run in O(1) bus cycle on an LARPBS using N2 processors. 4.2 The Triangular Matrix Transpositions
Let A=ai,j, 0 ≤ i , j < N , be a data matrix of size N × N . The diagonal prefix minima computations are defined to find the prefix minima of A for each diagonal sequence from lower right to upper left (denoted as ULP) and from upper right to lower left (denoted as LLP). These two computations can be formulated as follows.
⎧ ULPi , j = min{ai + k , j + k | 0 ≤ k ≤ min{ N − 1 − i, N − 1 − ⎨ ⎩ LLPi , j = min{ai − k , j + k | 0 ≤ k ≤ min{i, N − 1 − j}},
j}},
where 0 ≤ i , j < N . An example for the computations of ULP and LLP are shown in Fig. 5. Assume that the data matrix A of size N × N is initially stored in the local variable a(i, j) of processor Pi,j', 0 ≤ i , j < N . Finally, the result for computing ULPi,j is stored in the local variable ulp(i, j) of processor Pi,j' (i.e., PiN+j), 0 ≤ i , j < N . We show the detailed algorithm (ULPA) in the following. Algorithm ULPA Input: a(i, j), 0 ≤ i , j < N . Output: ulp(i, j), 0 ≤ i , j < N .
0 1 2 3
0 2 2 2 3
1 3 1 2 2
2 3 2 4 1 (a)
3 2 1 3 3
0 1 2 3
0 1 1 2 3
1 2 1 1 2
2 1 2 3 1 (b)
3 2 1 3 3
0 1 2 3
0 2 2 1 2
1 3 1 2 1
2 3 2 1 1
3 2 1 3 3
(c)
Fig. 5. An example for the computations of ULP and LLP. (a) An input data matrix A of size 4 × 4. (b) The computation of ULP. (b) The computation of LLP.
0: begin 1: // Compute the suffix minima of the upper right triangular matrix diagonally. // 1.1: Processor Pi,j', 0 ≤ i < N , i ≤ j < N , applies the upper right triangular matrix transposition to routed a(i, j) to a'(N+i-j-1, j). 1.2: For each LARPBSi, 0 ≤ i < N , processor Pi,j', N − i − 1 ≤ j < N , applies the suffix minima algorithm to compute d(i, j)=min{a'(i, j+k) | j ≤ k < N }.
Parallel Algorithms for the Weighted Distance Transform on Linear Arrays
485
1.3: Processor Pi,j', 0 ≤ i < N , N − i − 1 ≤ j < N , applies the lower right triangular matrix transposition to routed d(i, j) back to ulp(i+j-N+1, j). 2: // Compute the suffix minima of the lower left triangular matrix diagonally. // 2.1: Processor Pi,j', 0 ≤ i < N , 0 ≤ j ≤ i , applies the lower left triangular matrix transposition to route a(i, j) to a' (i-j, j). 2.2: For each LARPBSi, 0 ≤ i < N , processor Pi,j', 0 ≤ i < N − i , applies the suffix minima algorithm to compute d(i, j)=min{a'(i, j+k) | j ≤ k ≤ N − i }. 2.3: Processor Pi,j', 0 ≤ i < N , 0 ≤ j ≤ N − i , applies the upper left triangular matrix transposition to route d(i, j) back to ulp(i+j, j). 3: end Lemma 4. Algorithm ULPA can be run in O(loglog N) bus cycles on an LARPBS using N2 processors.
Algorithm ULPA can be easily modified to run with better efficiency. Since the total time complexity of it is dominated by the suffix minima computation in Steps 1.2 and 2 +1 / ε
, then two 2.2, respectively. If the number of processors is increased to qN2 and N efficient results O(loglogq N) and O(1) bus cycles can be obtained. Furthermore, algorithm LLPA for the diagonal prefix minima computation of A from upper right to lower left can be also derived similarly. This leads to the following corollary. Corollary 1. Algorithms ULPA and LLPA can be run in O(loglogq N) and O(1) bus
cycles on an LARPBS using qN and N 2≤q≤
2 +1 / ε
processors respectively, where
N , ε is a constant and ε ≥ 1 .
5 Parallel Algorithms In this section, we shall develop several efficient parallel algorithms for the nearest feature transform and the weighted distance transform, respectively. 5.1 The Nearest Feature Transform
Let F be an N × N binary image with f (i , j ) ∈ {0, 1} , 0 ≤ i , j < N , where "1" denotes a black pixel and "0" denotes a white pixel. The pixel f(0, 0) is located on the top corner of the image. For each pixel, the nearest feature transform is asked to compute the coordinate of the nearest black pixel. Following the idea of Fujiwara et al. [2], the nearest feature transform can be computed by the following four steps. In the first step, divide the input image into four sets of pixels denoted as PN, PS, PE and PW. These four sets can be formulated as follows.
⎧ PN (i, j ) = {(i -g , j + h) | 0 ≤ g ≤ i, max{- j , - g} ≤ h ≤ min{ N -1-j , g }}, ⎪ P (i, j ) = {(i + g , j + h) | 0 ≤ g ≤ N -1-i, max{- j , - g} ≤ h ≤ min{ N -1-j , g}}, ⎪S ⎨ ⎪ PE (i, j ) = {(i + g , j + h) | max{-i, -h} ≤ g ≤ min{ N -1-i, h}, 0 ≤ h ≤ N -1-j}, ⎪⎩ PW (i, j ) = {(i + g , j -h) | max{-i, -h} ≤ g ≤ min{ N -1-i, h}, 0 ≤ h ≤ j}, where 0 ≤ i , j < N . The illustration of these four sets are also shown in Fig. 6.
486
H.-R. Tsai
In the second step, each pixel finds the nearest black pixel in these four sets PN, PS, PE and PW respectively. In the third step, each pixel determines the nearest black pixel among these four sets. In the finial step, each pixel stores the coordinate of its found nearest black pixel. The first, third and fourth steps can be easily computed in O(1) bus cycle. Hence, the time complexity of these four steps is dominated by the second step. For the sake of completeness, we show the detailed algorithm (NFTEA) to find the nearest black pixel of each pixel in the set PE in the following. The nearest feature black pixel of each pixel in the other three sets PN, PS and PW can be also found similarly. Algorithm NFTEA Input: f(i, j), 0 ≤ i , j < N . Output: nfte(i, j), 0 ≤ i , j < N . 0: begin
0
… j
0 . . . j . . .
….
N-1
PN
PW
p
PE
PS N-1 Fig. 6. A pixel p(i, j) and its corresponding four sets PN(i, j), PE(i, j), PS(i, j) and PW(i, j)
1: // Initialization. // Processor Pi,j', 0 ≤ i , j < N , sets a(i, j)=(i, j) if f(i, j)=1; a(i, j)= (∞, ∞ ) , otherwise. 2: // Compute ULP(i, j). // Processor Pi,j', 0 ≤ i , j < N , applies the diagonal prefix minima computation to compute the prefix minima of A for each diagonal sequence from lower right to upper left by comparing the column indices. That is, computes ulp(i, j)= a(i+r, j+r)=(ir, jr), where jr = min{ jk | a(i+k, j+k)=(ik, jk), 0 ≤ k ≤ min{ N − 1 − i , N − 1 − j} }.
Parallel Algorithms for the Weighted Distance Transform on Linear Arrays
487
3: // Compute LLP(i, j). // Processor Pi,j', 0 ≤ i , j < N , applies the diagonal prefix minima computation to find the prefix minima of A for each diagonal sequence from upper right to lower left by comparing the column indices. That is, computes llp(i, j)= a(i+r, j+r)=(ir, jr), where jr = min{ jk | a(i-k, j+k)=(ik, jk), 0 ≤ k ≤ min{i , N − 1 − j} }. 4: // Set NFTED(i, j) to the nearest one of ulp(i, j) and llp(i, j). // Processor Pi,j', 0 ≤ i , j < N , sets
nft (i , j ) = ed
{
ulp (i , j ), d w ((i , llp ( i , j ),
j ), ulp (i , j )) ≤ d w ((i , j ), llp (i , j )),
otherwise.
5: // Compute NFT E(i, j). // 5.1: processor Pi,j', 0 ≤ i < N , 0 ≤ j ≤ i , sets c(i, j) =(w0|g-h|+w1h, g, h), where (g, h)=nfted(i, j). 5.2: Processor Pi,j', 0 ≤ i , j < N , applies the suffix minima computation to compute the suffix minima of c(i, j) for each row sequence from right to left by comparing the first indices. That is, computes lp(i, j)= c(i, j+r)=(sr, gr, hr), where sr = min{sk| c(i, j+k)=(sk, gk, hk), 0 ≤ k ≤ N − 1 − j} . 5.3: Processor Pi,j', 0 ≤ i < N , 0 ≤ j ≤ N − i , sets nfte(i, j) = (g, h) where lp(i, j)=(s, g, h). 6: end Lemma 5. Algorithm NFTEA can be run in O(loglog N) bus cycles on an LARPBS using N2 processors.
By increasing the number of processors available in the system, algorithm NFTEA can be easily modified to run with a highly scalable implementation. Furthermore, algorithms NFTNA, NFTSA and NFTWA for finding the nearest feature transform of each pixel in sets PN, PS and PW can be also derived similarly. The nearest feature transform of the image can be obtained. Hence, this leads to the following theorem. Theorem 1. Given a binary image of size N × N , the nearest feature transform can be found in O(log N), O(loglogq N) and O(1) bus cycles on an LARPBS using N2, qN and
N
2 +1 / ε
processors respectively, where 2 ≤ q ≤
N , ε is a constant and ε ≥ 1 .
5.2 The Weighted Distance Transform
The weighted distance transform of the image F is an operation which each pixel finds the distance to its nearest black pixel based on the distance functions. The weighted distance transform can be computed by the following two major phases. In the first phase, each pixel p(i, j) computes the nearest feature transform NFT(i, j) of the image. In the second phase, each pixel p(i, j) compute the distance d(i, j) by d(i, j) = d(p(i, j), NFT(i, j) ). Hence, this leads to the following theorem.
488
H.-R. Tsai
Theorem 2. Given a binary image of size N × N , The weighted distance transform can be found in O(log N), O(loglogq N) and O(1) bus cycles on an LARPBS using N2,
qN and N ε ≥ 1.
1 +1/ ε
processors respectively, where 2 ≤ q ≤
N , ε is a constant and
6 Concluding Remarks The weighted distance transform is a valuable tool for image processing in which the number of pixels may be very large. However, this problem can be overcome by using parallel processing algorithms running on multiprocessor computers. In this paper, by integrating the advantages of both optical transmission and electronic computation, we design several efficient parallel algorithms on the LARPBS for the problem of the weighted distance transforms. The proposed algorithms are faster and more elegant than the previous known results on various parallel computation models. Acknowledgments. This research was supported by National Science Council under Grant NSC-94-2213-E-275-006.
References 1. Borgefors, G.: Distance transformations in arbitrary dimensions. Computer Vision, Graphics and Image Processing 27, 321–345 (1984) 2. Fujiwara, A., Inoue, M., Masuzawa, T., Fujiwara, H.: A cost optimal parallel algorithm for weighted distance transforms. Parallel Computing 25, 405–416 (1999) 3. Guo, Z., Melhem, R.G., Levitan, S.P.: Pipelined communications in optically interconnected arrays. J. of Parallel and Distrib. Comput. 12(3), 269–282 (1991) 4. Hirata, T.: A unified linear-time algorithm for computing distance maps. Information Processing Letters 58, 129–133 (1996) 5. Lee, Y.-H., Horng, S.-J.: Optimal computing the chessboard distance transform on parallel processing systems. Computer Vision and Image Understanding 73(3), 374–390 (1999) 6. Levitan, S., Chiarulli, D., Melhem, R.G.: Coincident pulse techniques for multiprocessor interconnection structures. Applied Optics 29(14), 2024–2039 (1990) 7. Li, K., Pan, Y., Zheng, S.Q.: Parallel computing using optical interconnections. Kluwer Academic, Dordrecht (1998) 8. Paglieroni, D.W.: Distance transforms: properities and machine vision applications. CVGIP: Graphical Models and Image Processing 54, 56–74 (1992) 9. Pan, Y., Li, L.: Linear array with a reconfigurable pipelined bus system - concepts and applications. Journal of Information Sciences 106(3-4), 237–258 (1998) 10. Pavel, S., Akl, S.G.: Integer sorting and routing in arrays with reconfigurable optical bus. Int. J. of Foundations of Computer Science 9(1), 99–120 (1998) 11. Qiao, C., Melhem, R.G.: Time-division communications in multiprocessors arrays. IEEE Transactions on Computers 42, 577–590 (1993) 12. Rosenfeld, A., Pfaltz, J.L.: Sequential operations in digital picture processing. Journal of ACM 13, 471–494 (1966)
Parallel Algorithms for the Weighted Distance Transform on Linear Arrays
489
13. Schwarzkopf, O.: Parallel computation of distance transform. Algorithmica 6, 685–697 (1991) 14. Tsai, H.-R.: Parallel algorithms for the medial axis transform on linear arrays with a reconfigurable pipelined bus system. In: Int. Conf. on Parallel and Distrib. Syst., pp. 123–128. National Central University, Taiwan, R. O. C (2002) 15. Wu, C.-H., Horng, S.-J., Tsai, H.-R.: Efficient parallel algorithms for hierarchical clustering on arrays with reconfigurable optical buses. Journal of Parallel and Distributed Computing 60(9), 1137–1153 (2000)
Parallel Particle Swarm Optimization with Adaptive Asynchronous Migration Strategy∗ Zhi-hui Zhan and Jun Zhang** Department of Computer Science, Sun Yat-sen university, China, 510275
[email protected]
Abstract. This paper proposes a parallel particle swarm optimization (PPSO) by dividing the search space into sub-spaces and using different swarms to optimize different parts of the space. In the PPSO framework, the search space is regarded as a solution vector and is divided into two sub-vectors. Two cooperative swarms work in parallel and each swarm only optimizes one of the subvectors. An adaptive asynchronous migration strategy (AAMS) is designed for the swarms to communicate with each other. The PPSO benefits from the following two aspects. First, the PPSO divides the search space and each swarm can focus on optimizing a smaller scale problem. This reduces the problem complexity and makes the algorithm promising in dealing with large scale problems. Second, the AAMS makes the migration adapt to the search environment and results in a very timing and efficient communication fashion. Experiments based on benchmark functions have demonstrated the good performance of the PPSO with AAMS on both solution accuracy and convergence speed when compared with the traditional serial PSO (SPSO) and the PPSO with fixed migration frequency. Keywords: Particle swarm optimization (PSO), adaptive asynchronous migration strategy, parallel particle swarm optimization (PPSO), solution accuracy, convergence speed.
1 Introduction Parallel algorithms and parallel architectures have drawn lots of attentions all over the world recently and have become very significant and promising research topics in the computer science and technology [1]. The development of the parallelization is mainly due to computational complexity of the practical problems. The problems in real-world applications are often too complex to be solved by using the serial algorithms because of the poor solution accuracy or the long computational time. Therefore, lots of researches have devoted to designing effective and efficient parallel algorithms and architectures to obtain better performance [3]-[10]. ∗
This work was supported in part by the NSF of China Project No. 60573066, the NSF of Guangdong Project No. 5003346, the Scientific Research Foundation for the Returned Overseas Chinese Scholars, State Education Ministry, P.R. China, the NSFC Joint Fund with Guangdong, Key Project No. U0835002 and the National High-Technology Research and Development Program (“863” Program) of China (2009–2010) No. 2009AA01Z208. ** Corresponding author. A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 490–501, 2009. © Springer-Verlag Berlin Heidelberg 2009
Parallel Particle Swarm Optimization with Adaptive Asynchronous Migration Strategy
491
The particle swarm optimization (PSO) algorithm is a population-based global optimizer which was proposed in 1995 [2]. As its population-based characteristic, the PSO has great potential of developing parallelization. In the literature, several parallel particle swarm optimization (PPSO) have been proposed and they can be classified into the following two types. The first type PPSO divides the population into several groups and each group runs the same algorithm on different processors [3][4]. The second type PPSO focuses on designing the architecture that uses lots of processors (as many as the particles number) to update the particle velocity, position, and evaluate the fitness separately and simultaneously. The second type of PPSO is mainly used for the very complex problems whose fitness evaluations call for long computational time or large computational resources [5]-[6]. For example, the PPSOs for the antenna designs [5] and for the electromagnetic absorbers design [6] have the same feature that they use different processors to evaluate different particles in parallel in order to reduce the computational time. The above PPSO algorithms have the same characteristic that they all focus on the population division. By using multiple populations, the algorithm may benefit from the stronger global search ability because of the larger population diversity. By evaluating different individual on different processors, the algorithm may result in a faster computational speed. However, these parallel algorithms can not reduce the complexity of the problems because that each individual has to search the global optimum in the whole search space. Therefore, some researchers proposed to divide the problem search space into sub-spaces and uses different sub-populations to optimize different sub-spaces. As the sub-space is smaller than the whole search space, each subpopulation can focus on optimizing a smaller scale problem, which can benefit from both solution accuracy and convergence speed. This type of parallel algorithm is also named coevolutionary paradigm as in [7]-[10]. These so-called coevolutionary parallel algorithms divide the search space and use different sub-populations to optimizer the sub-spaces. As each sub-population only deals with partial of the whole search space, the communication among the subpopulations plays an important role in the algorithm performance. The coevolutioanry genetic algorithm (GA) [8] uses a migration strategy to communicate whilst the cooperative PSO [9] lets the sub-populations post their search information on a share blackboard to communicate. Even though the authors in [8] claimed that the communication frequency affects the algorithm performance and has developed an adaptive migration strategy, the strategy may still suffer from the synchronous fashion that the sub-populations have to wait for each other and then perform the migration operation simultaneously. In order to avoid this, the [10] proposed an adaptive asynchronous migration controller to control the communication among the sub-populations when design a parallel ant colony optimization (ACO) algorithm. Inspired by the methods of [8] and [10], this paper extends the serial PSO (SPSO) to a parallel PSO (PPSO) with an adaptive asynchronous migration strategy (AAMS). The PPSO proposed in this paper is different from the ones in [3]-[6] because our PPSO works in parallel by dividing the search space but not the population. Also, the proposed PPSO is different from the one in [9] because our PPSO uses an AAMS while the one in [9] does not take any adaptation into account. In the proposed PPSO, the
492
Z.-h. Zhan and J. Zhang
following two features make it promising in solving complex problems. First, the search space is divided into sub-spaces and different swarms are used to optimize different parts of the search space. This can directly reduce the scale of the optimized scale for each swarm. Therefore, the proposed PPSO is expected to optimize the problem with higher accuracy and faster speed. The algorithm is suitable for the problems of large scale and high dimension. Second, the proposed PPSO uses an AAMS to communicate among different swarms, making the communication frequency adapt to different search environments. If the swarm has potential in optimizing the solution, the migration will be postponed. Otherwise, the migration will be advanced. Therefore, the PPSO is aware of the search environment and can results in better performance than the ones with fixed migration frequency. We have conducted the experiments based on a set of benchmark functions, and the experimental results demonstrate the advantages of the PPSO, in terms of solution accuracy and convergence speed. The reminder of the paper is organized as follows. In the next section, we will present a brief review on the particle swarm optimization. Then in Section 3, the PPSO is developed based on the AAMS. Section 4 presents the experimental results. At last, conclusions are summarized and future work is given in Section 5.
2 Particle Swarm Optimization Particle swarm optimization uses a swarm of particles to represent the potential solutions of the optimization problem. A particle can fly through the search space and reach any potential area during the run. Assume that the particles search in a Ddimension hyperspace, each particle i has a position vector Xi = [xi1, xi2, …, xiD] to present the solution and a velocity vector Vi = [vi1, vi2, …, viD] which is used to dynamic adjusts the position. Moreover, each particle keeps a vector called personal historical best Pi to store the best position that has been found as far as long. And the best Pi in a neighborhood is regarded as Pn. The velocity and position of each particle are first initialized randomly and will be updated by the influenced of its own Pi and the corresponding Pn generation by generation as vid = ω×vid + c1×r1d×(pid – xid) + c2×r2d×(pnd – xid) xid = xid + vid
(1) (2)
where ω is the inertia weight to balance the abilities of global search and local search; c1 and c2 are the acceleration coefficients which indicate the influence of the particle’s history best position and the best position in the neighborhood, respectively; r1d and r2d are two random generated number in range [0, 1] obeying the uniform distribution, the subscript d means that the random numbers for each dimension are independent. Moreover, a position variant Vmax,d is used to clamp the maximal value of velocity vid. After the update of velocity and position, the particles within the research range are evaluated. The Pi of each particle can be replaced by its current search position if necessary (if and only if the fitness of current position is better than Pi) and the Pn is also be replaced if another best position in the neighborhood has been found. Evolutionary process goes on and the updated velocity and position will be obtained again by the new Pi and new Pn. The process will stop when the terminated conditions are met.
Parallel Particle Swarm Optimization with Adaptive Asynchronous Migration Strategy
493
3 PPSO with Adaptive Asynchronous Migration Strategy 3.1 Parallel PSO Framework In the PPSO, the problem search space is divided into two sub-spaces, and two swarms are used to optimize the two sub-spaces respectively in parallel. Given a search space X which is a D-dimension continuous vector, the PPSO divides the X into X1 and X2 as X=X1⊕X2 (3) 1 2 where X and X are both a D/2-dimension continuous vector. For example, when optimizing a 30-dimension vector, the X1 can be the first 15 dimensions and the X2 is the last 15 dimensions. In this paper, we investigate the divisions of 2 sub-spaces because this can result in a natural and direct parallel model. If the 2 sub-spaces model work, the other models with more sub-spaces may still work and may have better performance. With the division of the search space, the search dimension for each swarm would be smaller than the original one. Therefore, the swarm can focus on optimizing a smaller scale problem, which may benefit from both higher solution accuracy and faster convergence speed.
Fig. 1. The framework of parallel particle swarm optimization (PPSO)
The PPSO framework is illustrated as Fig. 1. The particles in the two swarms are still coded as D-dimension vector (D dimension vectors for the position X, the velocity V, and the personal best position P). However, only partial of the vector X can be optimized in each swarm. For example, in Fig. 1, the Swarm1 only optimizes the shade vector X1 while the white vector X2 keeps fixed during the running. Here we name the shade vector X1 the tunable vector, and the white vector X2 the untunable vector for the Swarm1. Similarly, the Swarm2 only optimizes X2 while X1 keeps fixed. Here, we describe the search process from the angle of Swarm1. In the initialization, M particles are initialized with a random value within the search range on the
494
Z.-h. Zhan and J. Zhang
tunable vector X1. The corresponding personal best position P1 is set as X1, and the corresponding velocity V1 is initialized with a random value within velocity range. For the untunable vector X2, we first random generate a vector within the search range, and then let all the M particles share this same position. Also, the P2 is set as X2. The V2, however, is useless in the process of Swarm1 because the vector X2 is untunable during the running. After initialization, the Swarm1 starts to optimize the vector X1 like a standard PSO, with the similarly velocity update and position update. When evaluate a particle, the whole search space X is used, but not only the X1. As all the particles have the same values for the X2, the fitness is mainly determined by the values of X1. When update the personal best position P, we should copy the whole X to P. This is because the X2 may not be the same as P2 during the running (e.g., after the process of migration). The Swarm1 optimizes the sub-space X1 as the above descriptions until it needs a migration. In our PPSO framework, an AAMS is used to control the migration operation. For the Swarm1, the migration occurs when it has no (or less) potential to continue optimizing the X1. For example, it has stagnated for a certain generations. In this situation, the Swarm1 needs the migration from Swarm2 that can provide better values for X2. This operation is adaptive (will be discussed in the next sub-section) and asynchronous (the migration can be occurred any time when it needs). Therefore, it would be useful to apply the PPSO to solve different optimization problems with different running environments. During the migration, the globally best solution in Swarm2 would transfer its optimized X2 to all the particles in Swarm1. That is to say, the X2 of the particle position X in the Swarm1 would be replaced by the corresponding X2 of the globally best particle in the Swarm2. Also, the P2 of all the particles in the Swarm1 would be replaced by the P2 of the globally best particle in the Swarm2. After the migration, the Swarm1 will evaluate the present position X and the personal best position P of each particle. The personal best position P may be replaced by the present position X if X is better than P. Also, the globally best particle in Swarm1 can be newly selected. Then the Swarm1 goes on the optimization process until another migration occurs. 3.2 Adaptive Asynchronous Migration Strategy The migration strategy is adaptive and asynchronous. Adaptation means that the time for migration is determined by the optimization process but not the pre-defined strategy. Asynchrony means that the migration for one swarm can occur at any time. It is unnecessary to wait for the ready of the other swarm. The migration operation in our PPSO framework acts as a fashion of communication. Therefore, it is crucial to determine when to perform the migration. For any swarm, if it has enough ability to search the space to refine the tunable vector, it would like to postpone the migration time. However, if the swarm’s optimization process slows down, or even stops, the swarm would like to advance the migration time in order to obtain some new momentum for further search, but not waste time in the stagnation. The static migration strategy with fixed frequency may not satisfy the requirements as above, and may result in slow optimization process when it need migration, or cause useless migration when the swarm is refining the tunable vector ulteriorly. Therefore, the AAMS is designed. The AAMS works as Fig. 2 and is described as follows.
Parallel Particle Swarm Optimization with Adaptive Asynchronous Migration Strategy
495
Fig. 2. Flowchart of adaptive asynchronous migration strategy (AAMS)
In order to facilitate the instructions, we do not describe the AAMS based on any special Swarmi (i=1, 2) but use a general fashion to present the flowchart. Therefore, the description is suitable for each swarm of the PPSO algorithm. Suppose the reference migration interval in the swarm is R. That is, the migration is expected to occur in every R generations. In order to meet the dynamic requirements of the optimization process, the R is set to an initial value R0 and is adaptively adjusted during the running. The adjustments are based on the following three rules. Rule1: if Gcur 0) then the degree of adaptiveness is.
⎧(d y + h' )! d y !h'! xs and d x is an odd numer , dOE = ⎨ (d y + h)! d y !h! otherwise. ⎩ If the packet is an NW or SW packet (∆x d; MoveDataToServer(head->k, b, pVoid); head = head->next; break; } case out: { // out parameter; do nothing and skip it b = head->d; head = head->next; break; } case inout: { // inout parameter b = head->d; MoveDataToServer(head->k, b, pVoid); head = head->next; break; } defualt: { printf("Unknown parameter type\n"); } } // switch }; // for }; // if return 0; } // GETDATA int PUTDATA(void* pParameterBlock) { int rc = 0; void* pVoid; struct linked_list* head; … pVoid = pParameterBlock; head = pGlobalCurrentParms->pRoot; if (head != NULL) { for (i=0; isize; i++) { switch (head->a) { case in: { // in parameter; do nothing and skip it b = head->d; head = head->next; break; } case out: {
576
C.-C. Chiang
// out parameter b = head->d; CopyData(head->k, b, pVoid); head = head->next; break; } case inout: { // inout parameter b = head->d; CopyData(head->k, b, pVoid); head = head->next; break; } defualt: { printf("Unknown parameter type\n"); } } // switch }; // for }; // if if (pGlobalCurrentParms->pResult != NULL) { // copy the result from the server to the // designated area for transmission head = pGlobalCurrentParms->pResult; b = head->d; CopyData(head->k, head->d, pVoid); }; // if return 0; } // PUTDATA
7 The Implementation of the Host-to-Host Layer The host-to-host layer supports for network programming services. The services eliminate many tedious tasks for programmers such as concurrency, sockets, connection, memory management, marshalling, de-marshalling, de-multiplexing, and multi-threading. For example, the ‘invoke’ function in EXECOPR is implemented in the host-to-host layer. The ‘invoke’ function allows to invoke an operation on a remote target object without concern for its location, language, operating system, or platform [3]. Several systems in open source such as Java package and ACE (ADAPTIVE Communication Environment) are widely used examples of host-to-host implementation. For example, ACE is implemented in C++ using the layered framework. The framework can support a wide range of operating systems such as Windows, Linux, Macintosh, UNIX, and IBM OpenVMS, and MVS OpenEdition. We implemented this layer in our framework by adopting the code from ACE. The implementation pf ACE can be referenced in [11], [12].
An Implementation of a Framework for Open Distributed Computing
577
8 File Service A distributed file system is used to demonstrate the concept of this programming paradigm. The file system service provides multiple servers to offer high availability, performance, and fault tolerance. The system should allow a new server is added to offer the service at any time without impacting clients. Figure 3 shows a scenario with two servers and three clients.
Client A
File Service
Server 1 Client B
Server 2
Client C
Fig. 3. File service
Each client might be written in different sequential programming languages and has its local adapter running on its space. The file service system has a set of interfaces for data retrieval and processing. The data storages required for operations are declared in a target sequential language for inclusion in the client code. As the client is running, the interface definition will be stored in the temporary storage space for dynamic interface resolution at run-time. All the clients are communicating with the servers in accordance with the interface definition. Assume a client is requesting a service from a server by issuing EXCOPR(“S1”, “OBTAIN NAME”, Buffer, Exception). The message will be intercepted by its adapter. “S1” is the server name and “OBTAIN NAME” is the operation name. The adapter retrieves the interface definition for run-time interface resolution. The client then sends GETDATA(BUFFER). The adapter allocates a temporary storage area of the same size of the requested data, namely BUFFER, for temporarily storing the data from the server. The file server’s code has PUTDATA(BUFFER) to synchronize the client’s operation. This scenario can be implemented in several ways. One easy way is to implement the service using middleware. However, different implementations of middleware do not interoperate each other. One solution to this problem is to install the same middleware implementation in the platforms. Programs running on the same middleware are then using the same interfaces and the sequential languages supported by the underlying middleware. Unfortunately, even using the same middleware implementation
578
C.-C. Chiang
as the underlying communication architecture, interfaces might be different depending on the language adopted for the programs. For example, interface for the same operation might be different in COBOL and C. The framework presented in this paper resolves this problem in which the application programming interfaces will have the same syntax and semantics corresponding to the same operation. The inter-language communication mechanism and run-time interface resolution mechanism makes the framework provide consistent interfaces to programmers regardless of languages used to implement.
9 Summary In this paper, we presented an implementation of a framework for developing open distributed parallel computing. The main motivation is to provide programmers to write programs using their familiar sequential programming languages. We believe that writing programs using a language that programmers are comfortable in using it will reduce the risk of making errors in coding. In addition, hiding the communication details from programmers that allows them to concentrate on the algorithm and data structure design on the business logic also makes the programming task easy. In order to support this point, we implemented an interface mechanism that permits programmers to write programs by using interface calls. The interface calls ease the tasks for writing programs for distributed computing. Due to the layering, programmers do not have to know the implementation of the interfaces. What they need to know is to learn how to invoke the interfaces developed in the next down layer. Our on-going research includes the implementations of compilers for the generation of interface definition in different sequential programming languages from an interface. The developed framework only supports for synchronous communications among processes. We are now studying how to extend the process-to-process layer to support implicit parallelism in the programming paradigm. Under this new framework, parallelism will be handled in the process-to-process layer. Programmers are further relieved from the complexity of parallelism in addition to distribution and heterogeneity provided in the current framework.
References 1. Balen, H.: Distributed Object Architectures with CORBA, Cambridge, UK (2000) 2. Chiang, C.-C., Anderson, G., Robison, S.: Integrating Parallel Programming into Distributed Computing. In: Proceedings of the 16th International Conference on Computers in Education, pp. 193–194 (October 2008) 3. Henning, M., Vinoski, S.: Advanced CORBA Programming with C++. Addison-Wesley, New York (1999) 4. JavaBeans, http://java.sun.com/docs/books/tutorial/javabeans/ (retrieved January 28, 2009) 5. Kshemkalyani, A.D., Singhal, M.: Distributed Computing: Principles, Algorithms, and Systems, Cambridge, UK (2008) 6. Manes, A.: Web Services: A Manager’s Guide. Addison-Wesley, New York (2003) 7. Newcomer, B.: Understanding Web Services. Addison-Wesley, New York (2002) 8. Pritchard, J.: COM and CORBA: Side by Side. Addison-Wesley, Reading (1999)
An Implementation of a Framework for Open Distributed Computing
579
9. Rock-Evans, R.: DCOM Explained. Digital Press (1998) 10. Rubin, W., Brain, M.: Understanding DCOM. Prentice Hall, Upper Saddle River (1999) 11. Schmidt, D.C., Huston, S.D.: C++ Network Programming: Mastering Complexity with ACE and Patterns, vol. 1. Addison-Wesley, New York (2002) 12. Schmidt, D.C., Huston, S.D.: C++ Network Programming: Systematic Reuse with ACE and Frameworks, vol. 2. Addison-Wesley, New York (2002) 13. Siegel, J.: CORBA: Fundamentals and Programming. John Wiley & Sons, New York (1996) 14. Silberschatz, A., Galvin, P.B., Gagne, G.: Operating System Concepts, 7th edn. John Wiley & Sons, New York (2005) 15. Szyperski, C.: Component Software: Beyond Object-Oriented Programming. AddisonWesley, Reading (1998) 16. Wallace, N.: COM/DCOM: Blue Book. Coriolis, Scottsdale Arizona (1999)
Evaluating a Dependable Sharable Atomic Data Service on a Planetary-Scale Network* Chryssis Georgiou1, Nicolas Hadjiprocopiou1, and Peter M. Musial2 2
1 Dept. of Computer Science, University of Cyprus, Nicosia, Cyprus Dept. of Computer Science, University of Puerto Rico Rio Piedras, San Juan, PR, USA
Abstract. Practical implementations of atomically consistent read/write memory service are important building blocks for higher level applications. This is especially true when data accessibility and survivability are provided by a distributed platform consisting of networked nodes, where both nodes and connections are subject to failure. This work presents an experimental evaluation of the practicality of an atomic memory service implementation, called R A M B O , which is the first to support multiple reader, multiple writer access to the atomic data with an integrated reconfiguration protocol to replace the underlying set of replicas without any interruption of the ongoing operations. Theoretical guarantees of this service are well understood; however, only rudimentary analytical performance along with limited LAN testing were performed on the implementation of R A M B O – neither representing any realistic deployment setting. In order to assess true practicality of the R A M B O service, we devised a series of experiments tested on PlanetLab – a planetary-scale research WAN network. Our experiments show that R A M B O ’s performance is reasonable (under the tested scenarios) and under the somewhat extreme conditions of PlanetLab. This demonstrates the feasibility of developing dependable reconfigurable sharable data services with provable consistency guarantees on unreliable distributed systems. Keywords: Atomic Memory Service, Distributed Architecture, Performance Evaluation, Planetary Scale Experiments, Provable Guarantees.
1 Introduction Implementation of services that ensure data survivability and consistency in highly dynamic environments, where transient and permanent changes and failures may occur, is critical to many important applications. An example of such application is sharing information about the physical environment and status of the shared objectives in civilian operations that follow natural disasters and in military operations in hostile territories. In both of these cases, computer networks are created hastily and the computing, communicating devices (to which we refer as nodes) are often susceptible to physical damage *
This work is partially supported by the European Union project EGEE (#INFSO-RI-031688) and the University of Cyprus.
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 580–592, 2009. © Springer-Verlag Berlin Heidelberg 2009
Evaluating a Dependable Sharable Atomic Data Service on a Planetary-Scale Network
581
and network irregularities. To this end, theoretical groundwork has been laid by researchers who have addressed this problem in numerous works [10, 3, 22, 2, 16]. In order to achieve survivability in dynamic networks several replicas of data must be stored and maintained at different network locations. This approach introduces parallelism issues such as memory failure, message loss, and dynamic node participation. By dynamic participation we mean that old nodes may depart and fail,and new nodes may join the computation. Therefore, replication of data raises challenges of maintaining consistency among the replicas, handling their manipulation by dynamic sets of data owners as well as accommodating atomic operations on the data. Providing practical implementations of such services is a separate but equally challenging undertaking. A reconfigurable distributed (linearizable) atomic data service for dynamic systems, called R AMBO, was introduced by Lynch and Shvartsman [17]. R AMBO’s novelty originates from the fact that it is the first specification supporting multiple reader, multiple writer (MRMW) access to the atomic data with an integrated reconfiguration protocol to replace the underlying set of data owners without any interruption of the ongoing operations. The authors of R A M BO [17] consciously traded mathematical elegance and simplicity of presentation for an inefficient implementation. To make implementation of R AMBO algorithm robust and practical a series of extensions followed [11, 18, 6,8] that improve the efficiency of the service and focused on reducing communication complexity, a better use of computational resources, and improving system liveness in various deployment settings. Implementation of R A M BO algorithm and its extensions were produced by Musial [19, 18] along with preliminary empirical performance results [18]. Additional experimental performance comparison of versions of R A M BO were carried out by Georgiou et al. [9]. However, the empirical results in [18, 9] are obtained by evaluations carried out in LAN settings and do not reflect delays and failures experienced in more realistic deployments. Therefore, in order to asses the practicality of a distributed shareable data service with provable consistency guarantees, such as R A M BO , its performance must be evaluated in a dynamic environment where net- work delays and node availability fluctuate over time. In this work PlanetLab [4, 20], a planetary-scale network, is used as the experimental platform. Contributions. Shareable data services providing consistency guarantees, such as atomicity (linearizability), make building distributed systems easier. This reason, and the observation made in the preceding paragraph are precisely the motivation of this work. To the best of our knowledge, the R AMBO framework is the latest and most versatile specification of an atomic MRMW service for dynamic environments. In addition, implementation of R AMBO algorithms have been verified to preserve correctness [18]. Therefore, there is a need to analyze the performance of R A M BO implementation in a realistic deployment setting and asses its true practical utility. To this end we con- duct a series of experiments executed on the PlanetLab research network, where we test R A M BO implementation tolerance to node failures, message loss, and sensitivity of geographical distribution of R AMBO nodes on the overall performance of the service. The experiments measure system responsiveness to user requests in terms of system throughput – including read/write operation throughput, reconfiguration throughput, and join request throughput where each of these operation types is discussed in later sections.
582
C. Georgiou, N. Hadjiprocopiou, and P.M. Musial
The takeaway from our experiments is that R AMBO implementation can perform well in a realistic setting and copes well with failures of individual sites and local communication interrupts. However, in order to achieve good performance some precomputation is necessary, and we had to parameterize R AMBO implementation with information about network delays and node failure rate. These computations were performed manually based on observation of the target deployment system (i.e., Planet- Lab) behaviors (see Section 4 for details). Our experiments provide a complementary understanding of R A M BO system throughput for the supported operations in an actual and non-controlled deployment environment where many different variables contribute to operation latency. An equivalent theoretical analysis can be daunting. An analytical analysis was performed in [17] where under assumption of a steady-state, such that nor- mal timing behavior exists (or eventually reached) and all messages are delivered within a bounded time δ that is unknown to the algorithm, and that all locally performed actions take zero time. Result of that analysis is that the expected read/write operation latency is bounded by 8δ in the presence of concurrent failures and infrequent reconfigurations, regardless of how many nodes participate in the execution. Our experiments demonstrate that the latency of operations is a function of the number of participants, level of activity, and is influenced by constraints of the deployment platform. However operation latency on its own does not provide an accurate picture of system behavior. Therefore, our results are expressed as R A M BO system throughput, which is computed using collected averages of the measured operations on the participating in the experiment nodes.
2 Background Atomic Memory Services. Several approaches have been used to implement consistent data in (static) distributed systems. Starting with the work of Gifford [10] and Thomas [21], many algorithms have used collections of intersecting sets of object replicas (such as quorums) to solve the consistency problem. Upfal and Wigderson [22] use majority sets of readers and writers to emulate shared memory. Vita´nyi and Awerbuch [3] use matrices of registers where the rows and the columns are written and respectively read by specific processors. Attiya, Bar-Noy and Dolev [2] use majorities of processors to implement shared objects in static message passing systems. Extension for limited reconfiguration of quorum systems have also been explored [7, 16]. These systems have limited ability to support long-lived data when the longevity of processors is confined. Virtually synchronous services [5], and group communication services (GCS) in general [1], can also be used to implement consistent data services, e.g., by implementing a global totally ordered broadcast. While the universe of processors in a GCS can evolve, in most implementations, forming a new view takes a substantial time [13], and client operations are delayed during view formation. R AMBO (Reconfigurable Atomic Memory for Basic Objects), introduced by Lynch and Shvartsman [16], is the first to support multiple reader, multiple writer access to the atomic data combined with a reconfiguration protocol to replace the underlying set of data owners, where this is accomplished without any interruption to the ongoing operations. To achieve survivability, data (represented as an abstract object) are replicated at several locations. To maintain consistency in the presence of small and
Evaluating a Dependable Sharable Atomic Data Service on a Planetary-Scale Network
583
transient changes, R AMBO uses configurations of nodes, each of which consists of a set of members plus sets of quorum sets (with specific intersection properties [10]). In order to accommodate larger and more permanent changes, the algorithm supports reconfiguration, by which the set of members and the sets of quorums are modified. Redundant configurations can be removed from the system without interfering with the ongoing read and write operations. The algorithm ensures atomicity and consistency of data despite occurrence of arbitrary patterns of asynchrony, node failure, and message loss. However, without (active) reconfiguration and in the presence of dynamic system behaviors and arbitrary delays read and write operations may not terminate or may experience indefinite delays. Note that consensus algorithms can be used directly to implement an atomic data service by allowing participants to agree on a global total ordering of all operations [14]. In contrast, R AMBO uses consensus to agree only on the sequence of installed configurations, where the non-termination of consensus does not affect the termination of read and write operations. PlanetLab. PlanetLab is a distributed overlay network for deployment and assessment of distributed planetary-scale network services [4, 20]. As of March 2009, PlanetLab is composed of 977 machines spanning 484 locations worldwide provided by academic and industry institutions. Its resources are divided into slices where each can be viewed as a network of virtual machines. Up to 32 nodes can be assigned to a slice, whilst a fraction of that node’s resources (CPU, local disk space, network bandwidth) is allowed to be consumed by a slice. The allocated resources are controlled on a per-slice, per-node basis. Slices expire after one month of their first creation (removing all the slice associated data), but can be renewed an unlimited number of times on a monthly basis. Malicious and buggy services can affect the communication infrastructure and other’s slices performance; therefore, strict terms and conditions for providing security and stability in the PlanetLab are enforced. Access to PlanetLab nodes is feasible through SSH, providing encrypted and secure communication. Nodes may be installed or rebooted at any time turning the disk into a temporary form of storage, providing no guarantee regarding their reliability.
3 The R AM B O Algorithm Following is only a brief foray of the cocktail of R A M BO extensions used in our implementation. The complete details of these specifications can be omitted as they are not integral to this work and we direct the interested reader to [16, 18]. We begin with the failure model assumed in the R A M BO framework. Failure model. Assumed failure model is asynchronous dynamic distributed system of communicating nodes, where each node has a unique identifier. Nodes may experience stop-failures and arbitrary delays between processor steps, and a non-failed processor performs steps according to the input program. Messages may be lost, arbitrarily delayed, and delivered out of order, but are not duplicated or corrupted. We assume existence of abstract point-to-point (as opposed to physical) communication channels that allow each node to send a direct message to any other node in the system. Read and Write protocol. As aforementioned, data survivability in the R AMBO framework is ensured via replication, where data is replicated and maintained at a
584
C. Georgiou, N. Hadjiprocopiou, and P.M. Musial
number of networked nodes. The caveat here is to ensure consistency while supporting atomic read and write operations. Atomicity of operation access is provided by use of quorum systems. The R A M BO algorithm uses configurations that consist of a set of data owners, and a set of quorum sets imposed on these data owners. We now describe how these configurations are used to implement atomic read and write operations. Both read and write operations are implemented in phases. First phase is called a query phase and is identical for both operations. During query phase a node contacts and awaits responses from some complete quorum set. Responses contain replica information that is timestamped (using a Lamport clock). When enough replies are collected, the initiating node chooses the value of a replica that is associated with the highest timestamp. Now the node is ready to enter the second phase called a propagation phase. In case of the read operation, a node will propagate the replica information with the highest timestamp to some quorum set. Again, when enough responses have been received, then the operation terminates with a read acknowledgment. In case of the write operation, a node will increment the highest timestamp and associate value being written with the new timestamp. The new replica information is then propagated to some complete quorum set, then the writer awaits appropriate responses from that set that once received are followed by a write acknowledgment. All configurations that have been installed but not yet removed from the system that have been discovered during an ongoing phase are used to complete that phase. Reconfiguration protocol. Dynamic system behavior and failures may result in configurations that are unresponsive or slow. This means that read and write operations may be blocked or delayed. To avoid reaching this point, R AMBO algorithms implement re- configuration, which is a process of replacing old configurations with new ones, where new configuration consists of healthy nodes. Reconfiguration is a three-phase [6] process, and uses an optimized variant of Paxos [15]. Each phase requires a coordinated effort lead by a leader node – an active node with the highest identifier. The three phases are: a prepare phase, during which a ballot is made ready, a propose phase, during which the new configuration is proposed, and a propagate phase, during which the results are distributed. The prepare phase accesses some quorum set of the current configuration, thus learning about any earlier ballots. When the leader concludes the prepare phase, it chooses a configuration to propose: if no configurations have been proposed to replace the current configuration, the leader can propose its own preferred configuration; otherwise, the leader must choose the previously proposed configuration with the largest ballot. The propose phase then begins, accessing some quorum set of the current configuration. This serves two purposes: it requires that the nodes in the current configuration vote on the new configuration, and it collects the most recent replica information. Finally, the propagate phase accesses some quorum set from the current configuration; this ensures that enough nodes are aware of the new configuration to ensure that any concurrent recon- figuration requests obtain the desired result, and at the same time current configuration is being marked as being obsolete. It has been shown in [18] that reconfiguration has very little effect on operation latency. Putting everything together. In our experiments we use an implementation of R A M BO framework that is a cocktail of Long-lived R AMBO [8], Domain-R A M BO [9],
Evaluating a Dependable Sharable Atomic Data Service on a Planetary-Scale Network
585
Pax-R AMBO [6], and R AMBO w/restricted gossip pattern [12]. Where collectively these improvements attempt to constrain R AMBO’s all-to-all gossip, reduce size of messages, remove trailing configurations, and remove the overhead associated with maintaining a multi-cell atomically consistent memory system. Techniques that allow us to claim that our concoction of R AMBO extensions implements an atomic, reconfigurable memory service in dynamic systems can be found in [18], hence we forgo the details of correctness proofs in this document. From this point on whenever we refer to a R AMBO algorithm, we mean an algorithm that implements the R A M BO framework and supports the improvements stated above. R AMBO node specification consists of two kinds of components. The first is the Joiner component that implements a simple join protocol. Specifically, the new node broadcasts a join request to nodes that it believes to be active participants of the R AMBO service and awaits at least one acknowledgment of this request. The second is the Reader-Writer component that implements read, write, and reconfiguration operation protocols (described above). Implementation. R A M BO algorithms used in this work are implemented in Java [18]. The individual memory locations of the implemented atomic memory system are represented as Java Objects, but in the experiments these memory locations are instantiated as Java Integers. Hence, a read and a write operation to a memory location is equivalent to reading an integer value and writing an integer value, respectively. R AMBO algorithms are specified as a composition of non-deterministic automata. Automata, as state machines, can be executed using theoretical models, where there is no enforcement of when certain events (transitions) occur in any given state. Of course, in the implementation of R AMBO progress is important, hence fair scheduling techniques are used to execute (enabled) transitions. Communication between R AMBO nodes is implemented using Java Sockets and TCP/IP. Messages in R A M BO fluxuate in size over the execution of the algorithm, there is no limit on the message size, and each state message contains many individual bits of information that describe the state of the local replica. The characteristics of messages in R AMBO make use of TCP/IP and Java Sockets to be a reasonable candidate, since messages can be marshalled as Java Objects and an entire object is then included as data of the message, and the process is reversed on the receiving end. Unfortunately, TCP/IP does not allow message broadcasts, hence the periodic all-to-all gossip is implemented as a sequence of direct messages. User interacts with the R AMBO system either through a command prompt or a graphical user interface. Through these interfaces a user can initiate read, write, and reconfiguration requests – configuration information must be provided manually to R AMBO. For the purpose of the experiments user interface was augmented to automate invocation of operations along with means to collect operation latency information.
4 Experiments In this section we describe and analyze each of the experiments conducted by running our RAMBO implementation on PlanetLab. We begin with a description of the experimental environment and practical issues that had to be taken into consideration. We conclude the section with presentation of six scenarios that were designed to test performance and robustness of RAMBO implementation under various system demands.
586
C. Georgiou, N. Hadjiprocopiou, and P.M. Musial
Preparation and limitations. PlanetLab as a planetary research network is exposed to node failures, message loss, varying processing and communication demands. Deployment of R A M BO implementation on PlanetLab required preparations and precomputations in order to reach acceptable performance. Precomputations involve parameterization of the implementation in order to best utilize the required resources – specifically bandwidth and memory. The PlanetLab environment is unstable which is attributed to the fluctuation in the utilization of its resources by other slices, hardware, software, and network failures.During our experiments we observed node failures as well as node hangups. In particular, on average 10% of the nodes would fail or hangup during execution. However, since R AMBO tolerates failures and delays up to the point of quorum systems being disabled, experiments were able to terminate despite the observed adversities. (The presented results incorporate these node failures and hangups.) Memory allocation was also an issue. Limitations imposed by PlanetLab on the amount of memory used by R AMBO system dictated which extensions should be used. For instance, use of restricted gossip pattern reduces communication complexity, but also reduces the amount of memory needed to buffer incoming messages that cannot be processed immediately. Of course, such limitations can be averted to a point, and eventually these will prohibit R AMBO system from being able to expand. Communication delays. R A M BO uses point-to-point messaging to share replica information among its participants and during replica access operations. Hence, the duration of any operation is dependent on the average network message latency. We have measured the ping latency on PlanetLab to be 139 milliseconds. However, the actual message delay between individual R A M BO nodes is larger since TCP and sockets are used. Furthermore, R AMBO’s messages vary in size and require marshaling and unmarshaling on send and receive. Data points. Each presented scenario was run five times and took a period of three to four hours (for all 5 runs). We observed that deviation of the results collected for each scenario and each run was very small, and decided that five runs for each scenario suffices. Therefore, each data point found on the graphs that follow represent an average for each of the five runs. Performance of the R A M BO system is expressed in terms of throughput – number of operations per second. Specifically, we test the system for each of the supported operation types: read and write, reconfigure, and join. However, we test these in isolation, meaning that for each scenario only one operation type is being invoked by the selected service participants. At each node we measure the average operation latency, where each operation is performed 400 times per each run. The averages are used to compute the system average throughput. 4.1 Scenario 1: Single Reader/Writer In this scenario 18 nodes join the R A M BO system and do not depart voluntarily. During the experiment the number of nodes participating in the configuration is increased from
Fig. 1. Single reader/writer scenario
Evaluating a Dependable Sharable Atomic Data Service on a Planetary-Scale Network
587
one to the maximum possible, and majority quorum system is used. A single node is used to issue read requests, then separately write requests. The memory system consists of two cells. The reads are performed on the first cell and the writes on the second cell. Fig. 1 depicts average system throughput for both read and write operations. Since redundancy introduces communication overhead we expected to observe decrease in throughput as configuration size increases. Reason being that the termination of each operation depends on ability to communicate with some majority of the configuration members. Hence, larger configurations consist of larger majorities and require more message exchanges. This expectation is validated by the experimental data. However, it is interesting to observe that the rate of throughput degradation decelerates after configuration size 10. We conjecture that in this scenario the operation throughput reflects the average communication throughput between the node initiating operations and the configuration members. In fact we expect that the operation throughput will stabilize until the point when the initiating node will become a communication bottleneck. However, since only 18 PlanetLab machines were available to us, this conjecture is unsupported by experimental data. 4.2 Scenario 2: Multiple Readers/ Writers This experiment tests R AMBO’s sensitivity to different system loads as well as operation concurrency. This is accomplished by Fig. 2. Multiple readers/writers scenario gradu- ally increasing the number of nodes initiating read and write requests. This time, we used two configurations, one with configuration of size one (consists of one node), and then with configuration of size eighteen (denoted as C1 and C18 respectively). As in the previous experiment, R A M BO is used to implement two-cell memory system. Each node initiates read and write requests as was described in the previous scenario (reads in the first object and writes on the second). Hence, as the number of readers (resp. writers) increases so does the read and write operation concurrency. Fig. 2 depicts the average system throughput for C1 and C18. The communication load experienced by the replica owners increases with addition of readers and writers. However, we do not expect this fact to be of significance since the number of nodes participating in the experiment is modest; therefore, the only member of configuration C1 will not be a bottleneck. Moreover, we expect that system throughput when C18 is used will be less than that of C1, since the node performing an operation must wait for responses from some majority (at least nine nodes). This speculation is supported by the experimental data. It was expected that while using C1 the system throughput would increase with the number of nodes performing operations, however, this pattern is expected to stop as the only configuration member of C1 eventually becomes overwhelmed by the communication burden. In comparison, system throughput remains constant when C18 is used. The behavior in Fig. 4.2 can be explained by the following two observations: (a) replica owners experience light communication load since there are few reader/writers, and (b)
588
C. Georgiou, N. Hadjiprocopiou, and P.M. Musial
since at least nine nodes need to be contacted per each communication round the system throughput is dependent on the average communication throughput of PlanetLab. We do not expect this to hold as the number of reader/writers is drastically increased. 4.3 Scenario 3: Random Operations with Multiple Readers/Writers In the previous scenarios read and write operations are conducted separately and are performed on fixed cells, meaning that a node repeatedly invokes reads on memory cell one, and later invokes write operations on cell two. In the first scenario there is no concurrency. In the second scenario, concurrency is limited to overlapping read (resp. write) operations that are invoked in parallel at different nodes. In this experiment we test a more realistic setting by allowing each node to initiate read and write request at random to each memory cell. Note that each node can initiate only one operation at the time (either a read or a write). This approach allows read and write operations to overlap in time and possibly on the same cell. Additionally, experiment is performed using C1 and C18 in order to compare the observed system behaviors to that of Scenario 2. Fig. 3 depicts the average system throughput, performing read /write randomly and concurrently. One would expect concurrency to increase the average execution time, as an operation request would possibly “delay” some other operation request (especially with over-lapping read and write requests). However, our experiments suggest that R AMBO’s performance is not affected by operation concurrency, where the results plotted in Fig. 3 do not deviate from the Fig. 3. Full concurrency scenario ones presented in Fig. 2, except for the run with eight client nodes and configuration C1. However, this discrepancy can be explained by the fact that experiments were conducted at different times and other applications could have contributed to the additional communication and processing burden on the PlanetLab nodes. The observed behavior is supported by the design of R AMBO, where read and write operations are “treated equally”: (a) write and read requests have equal prior- ity, (b) both operations require two communication rounds. Hence there is no essential difference if two read (or write) requests overlap as opposed to having a read request overlap with a write request. Finally, experimental data supports our intuition about system throughput when different configuration sizes are used. However, this is not the case for the conditional theoretical analysis of [17] as explained in the Introduction; it was shown that each read/write operation is expected to complete by 8δ (δ being the maximum message delay) regardless of the configuration size and number of readers – and under the assumption of a steady state. Since system throughput is computed using average operation latencies, the above assumption would imply that system throughput should increase with the number of readers and writers regardless of the configuration size. We don’t want to minimize the importance of results in [17], but rather emphasize that experimental results on global scale encompass many variables that are difficult to consider in theoretical analysis.
Evaluating a Dependable Sharable Atomic Data Service on a Planetary-Scale Network
589
4.4 Scenario 4: Multiple Objects This experiment tests whether the number of data objects (memory cells) constituting the memory system implemented by R AMBO influence its performance. The operation requests, per node, are invoked to random objects in the memory system. In addition, a node decides to perform a read or a write operation based on a random “coin flip.” As in previous scenarios, configurations C1 and C18 are utilized. The number of objects in the memory was increased from two to eight. Fig. 4 depicts the collected average system throughput for each set of experiments.
Fig. 4. Increasing number of memory cell and readers/writers scenario, C1 (left) and C18 (right)
In this experiment we expect the system throughput to degrade with the number of objects in the domain. Reason being that maintenance of each object introduces processing overhead. This expectation is supported by the experimental data. The overhead cost is made evident in the experiment involving C1, where with the number of objects system throughput decreased. However, the throughput variations in the experiment involving C18 is surprising, as one would expect lesser throughput gap between domain of size 2 and 8. One possible explanation for this behavior is the influence of periodic gossip on communication latency. Each gossip message exchanged between replicas includes information about the entire domain and with bigger messages operation latency may be negatively impacted. 4.5 Scenario 5: Reconfiguration Reconfiguration is different from read and write operations in respect that any number of concurrent read and write operations can be performed at any given time where there these are independent. Reconfiguration requires consensus and configurations are installed in a specific sequence. Therefore, reconfiguration results are presented in terms of frequency rather than throughput. Fig. 5. Reconfiguration scenario Recon- figuration duration is computed at the node that proposes the next configuration and it is defined as an interval from the proposal of the new configuration until the correspond- ing reconfigurationrequest acknowledgment is received.
590
C. Georgiou, N. Hadjiprocopiou, and P.M. Musial
The experiment was conducted with participation of 20 nodes that periodically gossiped in the background. Each proposed configuration has the same size as the existing one, and consists of a disjoint set of nodes. For example, in the case of configuration of size 10, a node not belonging to the existing configuration proposes a new configuration consisting of the other 10 nodes – participating in the system (including itself). Fig. 5 depicts the average reconfiguration frequency for different configuration sizes. Phases involved in reconfiguration require communication with some majority of configuration being replaced and the configuration being installed. Therefore, we expect the reconfiguration throughput to decrease as the size of configuration increases. The experimental data demonstrate that the reconfiguration frequency is indeed influenced by the size of involved configurations. As explained in Section 3, the reconfiguration protocol requires three phases during which majority quorums are contacted. As the size of configurations is increased so is the size of the contained within quorums. Since progress of each reconfiguration phase depends on members of the current and the future configuration being updated (via message exchange), the resulting communication burden causes an increase in the reconfiguration duration for the larger sized configurations. As it is the case with read and write operations, the increase in the observed reconfiguration frequency for the larger size configurations was expected. Again, this is not the case for the conditional theoretical analysis of reconfiguration latency in [17]. 4.6 Scenario 6: Joining This scenario seeks to determine whether the increasing configuration size affects the average join time of the system. The join throughput is the rate at which nodes join the R AMBO system, where the duration of the join request is measured from the time a join request is sent to the set of seeds until the join-acknowledgment is received. Furthermore, join time was assessed Fig. 6. Join scenario with the participation of twenty nodes. Initially, 10 nodes joined the system, and the remaining 10 joined R AMBO one at a time. Fig. 6 depicts the join throughput while in- creasing the size of configuration (each plot point is averaged over 5 runs). As in the previous scenarios the through put of join operations is expected to decrease with the size of configuration. This is consistent with the collected experimental data. According to [6], during the join request, a node attempting to join the service submits join requests to the local Reader-Writer component and awaits an acknowledgment from some active R A M BO node. Thus, the augment in the size of configuration increases the number of communication complexity attributed to the periodic gossip, and thereby increases communication latency of the system and hence the join throughput decreases.
Evaluating a Dependable Sharable Atomic Data Service on a Planetary-Scale Network
591
5 Conclusions Our experiments with R AMBO implementation demonstrate its behavior in a realistic dynamic environment. The implementation deals well with the somewhat extreme conditions of PlanetLab; this is unsurprising as it was designed to cope with dynamic behaviors, delays, and failures. However, our experiments demonstrate its sensitivity to communication delays. This observation in itself is intuitive, but was not made evident by the prior theoretical analyses. In summary, our results demonstrate that read and write operation throughput is unaffected by concurrency, throughput decreases with the number of participants and when large size configurations are used, R A M BO is sensitive to the load demands where its performance scales well with these demands (for the tested scenarios), and estimation of average network delays is necessary in order to best throttle periodic gossip. Deploying R A M BO implementation on PlanetLab provided us with a better understanding of how R A M BO will behave in deployments outside of the controlled lab environment. Overall, this case-study demonstrates the feasibility of developing efficient and dependable reconfigurable sharable data services with provable consistency guarantees on unreliable distributed systems.
References 1. Special issue on group communication services. Communications of the ACM 39(4) (1996) 2. Attiya, H., Bar-Noy, A., Dolev, D.: Sharing memory robustly in message-passing systems. Journal of the ACM (JACM) 42(1), 124–142 (1995) 3. Awerbuch, B., Vitanyi, P.: Atomic shared register access by asynchronous hardware. In: Proc. of 27th IEEE Symposium on Foundations of Computer Science, pp. 233–243 (1986) 4. Bavier, A., Muir, S., Peterson, L., Spalink, T., Wawrzoniak, M., Bowman, M., Chun, B., Roscoe, T., Culler, D.: Operating system support for planetary-scale network services. In: Symposium on Networked Systems Design and Implementation, San Francisco, CA (2004) 5. Birman, K., Joseph, T.: Exploiting virtual synchrony in distributed systems. In: Proc. of the 11th ACM Symposium on Operating Systems Principles (December 1987) 6. Chockler, G., Gilbert, S., Gramoli, V., Musial, P., Shvartsman, A.: Reconfigurable distributed storage for dynamic networks. Journal of Parallel and Distributed Computing 69(1), 100–116 (2009) 7. Englert, B., Shvartsman, A.: Graceful quorum reconfiguration in a robust emulation of shared memory. In: Proc. of International Conference on Distributed Computer Systems, pp. 454–463 (2000) 8. Georgiou, C., Musial, P., Shvartsman, A.: Long-Lived RAMBO: Trading Knowledge for Communication. Theoretical Computer Science 383(1), 59–85 (2007) 9. Georgiou, C., Musial, P., Shvartsman, A.: Developing a Consistent Domain-Oriented Distributed Object Service. IEEE Transactions of Parallel and Distributed Systems (2009) 10. Gifford, D.: Weighted voting for replicated data. In: Proc. of 7th ACM Symp. on Oper. Sys. Princ., pp. 150–162 (1979) 11. Gilbert, S., Lynch, N., Shvartsman, A.: RAMBO II: rapidly reconfigurable atomic memory for dynamic networks. In: Proceedings of International Conference on Dependable Systems and Networks, 2003, pp. 259–268 (2003)
592
C. Georgiou, N. Hadjiprocopiou, and P.M. Musial
12. Gramoli, V., Musiał, P., Shvartsman, A.: Operation liveness in a dynamic distributed atomic data service with efficient gossip management. In: Proc. 18th International Conference on Parallel and Distributed Computing Systems (August 2005) 13. Khazan, R., Yuditskaya, S.: A wide area network simulation of single-round group membership algorithms. In: Proc. 4th IEEE International Symposium on Network Computing and Applications, July 2005, pp. 149–158 (2005) 14. Lamport, L.: The Part-Time Parliament. ACM Transactions on Computer Systems 16(2), 133–169 (1998) 15. Lampson, B.: The ABCD’s of Paxos. In: Proceedings of the 20’th annual ACM Symposium on Principles of Distributed Computing, p. 13. ACM Press, New York (2001) 16. Lynch, N., Shvartsman, A.: Robust emulation of shared memory using dynamic quorumacknowledged broadcasts. In: Symposium on Fault-Tolerant Computing, pp. 272–281 (1997) 17. Lynch, N., Shvartsman, A.: RAMBO: A reconfigurable atomic memory service for dynamic networks. In: Proceedings of the 16th International Symposium, pp. 173–190 (2002) 18. Musial, P.: From High Level Specification to Executable Code: Specification, Refinement, and Implementation of a Survivable and Consistent Data Service for Dynamic Networks. Ph.D thesis, University of Connecticut (2007) 19. Musial, P., Shvartsman, A.: Implementing a reconfigurable atomic memory service for dynamic networks. In: Proceedings of 18’th International Parallel and Distributed Symposium—FTPDS WS (2004) 20. Peterson, L.L., Bavier, A.C., Fiuczynski, M.E., Muir, S.: Experiences building planetlab. In: OSDI, pp. 351–366 (2006) 21. Thomas, R.: A majority consensus approach to concurrency control for multiple copy databases. ACM Trans. on Database Sys. 4(2), 180–209 (1979) 22. Upfal, E., Wigderson, A.: How to share memory in a distributed system. Journal of the ACM (JACM) 34(1), 116–127 (1987)
A GPU-Based Simulation of Tsunami Propagation and Inundation Wen-Yew Liang1, Tung-Ju Hsieh1, Muhammad T. Satria1, Yang-Lang Chang2, Jyh-Perng Fang2, Chih-Chia Chen2, and Chin-Chuan Han3 1
Department of Computer Science and Information Engineering 2 Department of Electrical Engineering, National Taipei University of Technology, Taiwan {wyliang,tjhsieh,t6598056,ylchang,jpfang,t6318103}@ntut.edu.tw 3 Department of Computer Science and Information Engineering, National United University, Taiwan
[email protected]
Abstract. Tsunami simulation consists of fluid dynamics, numerical computations, and visualization techniques. Nonlinear shallow water equations are often used to model the tsunami propagation. By adding the friction slope to the conservation of momentum, it also can model the tsunami inundation. To solve these equations, we use the second order finite difference MacCormack method. Since it is a finite difference method, it brings the possibility to be parallelized. We use the parallelism provided by GPU to speed up the computations. By loading data as textures in GPU memory, the computation processes can be written as shader programs and the operations will be done by GPU in parallel. The results show that with the help of GPU, the simulation can get a significant improvement in the execution time for each of the computation steps. Keywords: scientific applications, tsunami simulation, shallow water equations, MacCormack method, GPU-based implementations.
1 Introduction The destructive tsunami that happened in South East Asia at the end of 2004 has been motivating many researchers in various research fields to work in modeling and visualizing the tsunami. The aim is to figure out how tsunami becomes destructive and give some references to minimize the victims and losses in the future. The interesting parts are the tsunami propagation and its inundation. Basically, tsunami propagation simulations consist of fluid dynamics, numerical computations, and visualization. The shallow water equations are often used to model the wave propagations of tsunamis. The equations are derived from equations of conservation of mass and momentum. The inundation part can be described by adding friction slope into the conservation of momentum [1]. For numerical computation, many approaches are used to solve the shallow water equations. Hagen [2] used LaxFriedrich method to solve the shallow water equations. An alternate direction implicit method (ADI) was used by Kass [3] as another approach. Then, Layton [4] used a A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 593–603, 2009. © Springer-Verlag Berlin Heidelberg 2009
594
W.-Y. Liang et al.
semi-Langrangian method. In this paper, we prefer to use a second-order finite difference MacCormack method [5] which is well suited for nonlinear equations such as shallow water equations. It is a variation of the two-step Lax-Wendroff method. In the first predictor step, the forward difference is applied and followed by the backward difference for the corrector step. In practices, the MacCormack method is much simpler than the Lax-Wendroff method and provides the best results for nonlinear equations [6]. Finite difference method brings the possibility to parallelize the computations in a cluster machine. However, output data need to be collected in order to visualize the simulation. In a cluster, if data collection and interactive visualization are implemented during the computation, the efficiency could be significantly decreased [7]. Nowadays, Graphics Processing Unit (GPU) has become a programmable hardware. A GPU is a stream processor. It supports parallel computations by applying a single program segment, called a kernel, over a stream of data. A stream is a set of records requiring similar computations, while a kernel is a series of operations applied to each element of the stream. Data parallelism exists since a number of records in the stream can be processed simultaneously by multiple threads of the kernel. For a GPU, a stream is viewed as a set of vertices and fragments. The kernels are called the vertex and fragment shaders applied on these vertices and fragments. Programmability of GPU is achieved by writing programs for the shaders. The OpenGL Shading Language (GLSL) developed by OpenGL ARB is a language to develop shaders [8]. In this paper, we utilize the parallelism provided by GPU to speed up the numerical computations. By designing the algorithms in shaders, we are able to put the computations into a GPU. Other benefits are that data collection and the interactive visualization may be done easily. In the next section, related works is discussed first. Then, our simulation model and its algorithm are introduced in Section 3. Section 4 explains how the algorithm is implemented to run on a CPU and on both CPU and GPU at the same time, respectively. The performance results are reported in Section 5. Finally, a conclusion and the future works are given in Section 6.
2 Related Works In [2], Hagen used a numerical Lax-Friedrichs scheme to solve the shallow water equations. However, Lax-Friedrichs scheme is a very robust scheme, which unfortunately gives excessive smearing of nonsmooth parts of the solution. To solve this problem, they introduced a high resolution scheme based upon a semi-discrete formulation. Kass [3] presented a method for animating water based on a simple, rapid, and stable solution of a set of partial differential equations. The equations are derived from an approximation to the Navier-Stokes equations which give rise to a version of wave equation on a height-field. They used an alternating direction implicit method to solve those equations. An implicit semi-Langrangian method was used by Layton [4]. It integrates along particle trajectories and is stable when a large number of time steps is used. For advection equation, it is equivalent to the characteristics method but retains its simplicity and practical utility in more complicated applications.
A GPU-Based Simulation of Tsunami Propagation and Inundation
595
Karsten [9] used a simplified version of the Navier-Stokes equations and a numerical Jacobi iteration to solve height equations. Jacobi iteration method is a matrix based method and is also parallelizable. Since an element of the matrix is not dependent on the other element in the same step, computation of each element can be done in a GPU by a fragment shader with a texture. The tsunami propagation simulation presented by Kuo [10] used a semiLangrangian method. They combined the shallow water equations and rendering techniques to visualize the movement of tsunami waves. However, they did not consider the friction slope. The friction slope is the rate at which energy is lost due to channel resistance. It will affect the propagation flow in open channels. In this paper, we visualize the tsunami inundation by introducing the friction slope in the conservation of momentum, as described by Tan [1].
3 Simulation Model In this section, we describe how the simulation model is constructed, how the numerical method is applied, and how the algorithm is designed. 3.1 Shallow Water Equations The shallow water equations are derived from the Navier-Stokes equations and are applied for situations where the horizontal length scale is much greater than the vertical length scale [12]. Since it is a common situation, shallow water equations are widely applicable. In two-dimensional space, the nonlinear shallow water equations take the following form [1] ht + (hu)x + (hv)y = 0
(1)
(uh)t + (u2h + ½ gh2)x + (uhv)y = –gh(Sox – Sfx)
(2)
(vh)t + (uhv)x + (v2h + ½ gh2)y = –gh(Soy – Sfy)
(3)
in which h is the water depth, u and v are the water velocity in x and y directions respectively, g is the acceleration due to gravity, and t is the time. In addition, So is the bed slope and Sf is the friction slope. Each of them has x and y components with respect to x and y directions. The friction slopes Sfx and Sfy are assumed to be given by the following Manning equation. Sfx = (η2u √(u2 + v2))/h4/3
(4)
Sfy = (η2v √(u2 + v2))/h4/3
(5)
In these two equations, η is the empirical Manning coefficient of roughness. In this paper, η is equal to 0.05, as a representation of light brush surface over floodplain [11]. The equation (1), (2), and (3) are then simplified as follows.
596
W.-Y. Liang et al.
∂h/∂t + ∂(hu)/∂x + ∂(hv)/∂y = 0
(6)
∂u/∂t + u ∂u/∂x + v ∂u/∂y + g ∂h/∂x = –g(Sox – Sfx)
(7)
∂v/∂t + u ∂v/∂x + v ∂v/∂y + g ∂h/∂y = –g(Soy – Sfy)
(8)
3.2 Applying MacCormack Method The MacCormack method is a two-step explicit method. It is very elegant and easy to understand and program [13]. The application of the MacCormack method to the shallow water equations proceeds in two steps. A predictor step implements forward differences, and followed then by backward differences for the corrector step. In the predictor step, the provisional values of h, u, and v at time level t+1 (denoted by t+1) are calculated as below. hi, jt+1 = hi, jt – ∆t/∆x (ui+1, jt hi+1, jt – ui, jt hi, jt) – ∆t/∆y (vi, j+1t hi, j+1t – vi, jt hi, jt) ui, jt+1 = ui, jt – ui, jt ∆t/∆x (ui+1, jt – ui, jt) – vi, jt ∆t/∆y (ui, j+1t – ui, jt) – g ∆t/∆x (hi+1, jt – hi, jt) – g ∆t (Sox – Sfx) vi, jt+1 = vi, jt – ui, jt ∆t/∆x (vi+1, jt – vi, jt) – vi, jt ∆t/∆y (vi, j+1t – vi, jt) – g ∆t/∆y (hi, j+1t – hi, jt) – g ∆t (Soy – Sfy)
(9) (10)
(11)
In the corrector step, the predicted values are computed by the following equations. hi, jt+1 = (hi, jt + hi, jt+1)/2 – ∆t/2∆x (ui, jt+1 hi, jt+1 – ui-1, jt+1 hi-1, jt+1) – ∆t/2∆y (vi, jt+1 hi, jt+1 – vi, j-1t+1 hi, j-1t+1) ui, j t+1 = (ui, jt + ui, jt+1)/2 – ui, jt+1 ∆t/2∆x (ui, jt+1 – ui-1, jt+1) – vi, jt+1 ∆t/2∆y (ui, jt+1 – ui, j-1t+1) – g ∆t/2∆x (hi, jt+1 – hi-1, jt+1) – g ∆t/2 (Sox – Sfx) vi, jt+1 = (vi, jt + vi, jt+1)/2 – ui, jt+1 ∆t/2∆x (vi, jt+1 – vi-1, jt+1) – vi, jt+1 ∆t/2∆y (vi, jt+1 – vi, j-1t+1) – g ∆t/2∆y (hi, jt+1 – hi, j-1t+1) – g ∆t/2 (Soy – Sfy)
(12)
(13)
(14)
3.3 Boundary Condition We apply Neumann boundary condition to the system for the water depth and velocity in the corresponding axis. For the velocity perpendicular to the axis, we simply use the copy boundary condition. It propagates the interior nodes of the computational domain to the outer nodes. The wet-dry condition is applied by giving a tolerance value for the water depth, h. If h is lower than tolerance, then the values of h, u, and v are set to be 0.
A GPU-Based Simulation of Tsunami Propagation and Inundation
597
3.4 Numerical Filter In order to get better stability, a Hansen numerical filtering method [14] is applied to the model. It acts as an artificial dissipation. At every time step, each node updates the values of h, u, and v by the following equation. Fi, j = c Fi, j + (1 – c) (0.25) (Fi-1, j + Fi+1, j + Fi, j-1 + Fi, j+1)
(15)
where F represents the values of h, u, and v, and c is equal to 0.99. 3.5 Algorithm The algorithm is illustrated as a flow chart in Fig.1. It starts from the initial data (step 1) that consists of height maps of the bottom topography and sample water level data. In step 2, the initial water depth h is generated by an interpolation of the water level data. The initial velocity u is equal to zero, while initial velocity v will be calculated with the following equation. v = √(gh)
(16)
The provisional values of h, u, and v will be calculated in the predictor step (step 3) and followed by calculating the boundaries (step 4). Filtering (step 5) is applied in order to get better stability after the computation of the predictor step. Then, the corrector step (step 6) is invoked and followed by calculating the boundaries and performing the same filtering again. After that, the output data will be stored (step 7). These processes will be done repeatedly for all time steps. Finally, we can visualize the propagation and inundation of tsunami by rendering a surface based on the output data (step 8).
Fig. 1. The original flow chart for the simulation
4 Implementation In this section, we explain both pure CPU and GPU-Based implementations.
598
W.-Y. Liang et al.
4.1 CPU Implementation In the pure CPU implementation, the initial data containing water depth and velocity data are stored in 2D-arrays of size im × jm, as shown in Fig.2. In each time step, we compute the predictor, corrector, and filtering, and update data in these arrays. The following code listing shows a portion of the predictor step function. It expresses equation (9) in line 11-12. Line 9 and 10 indicate that the computation is covered by looping.
Fig. 2. Illustration of the computation grid for the simulation region The example code of the predictor step
1. ... 2. dtdx = deltatime/dx; 3. dtdy = deltatime/dy; 4. for (j = 0; j 4n − 8 for n ≥ 5, there exists an edge (u, v) in C such that (u, uh ) and (v, v h ) are both fault-free or (u, uc ) and (v, v c ) are both fault-free. W.l.o.g., we assume that (u, uh ) and (v, v h ) are both fault-free. We can write C as v, P1 [v, u], u, v. By Lemma 2, uh is adjacent to v h . If (uh , v h ) is a faulty edge, then by Lemma 5, there is a Hamiltonian cycle uh , P2 [uh , v h ], v h , uh in AQ1n−1 −(F1 −(uh , v h )) containing (uh , v h ). Therefore, u, uh , P2 [uh , v h ], v h , v, P1 [v, u], u is a faultfree Hamiltonian cycle. However, if (uh , v h ) is fault-free, then a fault-free Hamiltonian cycle can be constructed similarly. Case 1.1.1.2: There exists exactly one 2-node u for AQ1n−1 . In this case, |F1 | = 2n − 5. Moreover, |Fc | ≤ 2. We have the following scenarios. Case 1.1.1.2.1: (u, uh ) or (u, uc ) is fault-free. Since u is the 2-node for AQ1n−1 , there is a fault-free edge (u, v) in AQ1n−1 . By Lemma 4, there is an edge (a, b) ∈ C such that (u, a) and (b, w) are fault-free crossing edges, where w ∈ / {u, v}. We can write C as a, b, P1 [b, a], a. By Lemma 3, there is a Hamiltonian path v, P2 [v, w], w in AQ1n−1 − {u}. Therefore, u, v, P2 [v, w], w, b, P1 [b, a], a, u is a fault-free Hamiltonian cycle. Case 1.1.1.2.2: (u, uh ) and (u, uc ) are both faulty. In this case, |F0 | = |F1 | = 2n−5. By Lemma 3, there is a Hamiltonian cycle C in AQ1n−1 − F1 . Case 1.1.1.2.2.1: Every node is incident to at least three fault-free edges in AQ0n . The proof is similar to that used in Case 1.1.1.1. Case 1.1.1.2.2.2: There exists exactly one 2-node for AQ0n−1 . The proof is is similar to that used in Case 1.1.1.2.1. Case 1.1.2: |F1 | = 2n − 4. In this case, |F0 | = 2n − 4. We consider the following three subcases. Case 1.1.2.1: Every node is incident to as least three fault-free edges in AQ1n−1 . There are the following scenarios.
678
S.-Y. Hsieh and Y.-R. Cian
Case 1.1.2.1.1: C h does not contain any faulty edge. Since there is no crossing edge, we can find an edge (u, v) on C such that (u, uh ) and (v, v h ) are both fault-free. We can write C as u, P3 [u, v], v, u and C h as v h , P3h [v h , uh ], uh , v h . Therefore, u, P3 [u, v], v, v h , P3h [v h , uh ], uh , u is a fault-free Hamiltonian cycle. Case 1.1.2.1.2: C h contains at least one faulty edge. We can find a faulty edge (uh , v h ) in C h . By Lemma 5, there is a fault-free Hamiltonian cycle C = uh , P3 [uh , v h ], v h , uh in AQ1n−1 − (F1 − (uh , v h )) containing (uh , v h ). Since there is no faulty crossing edge, (u, uh ) and (v, v h ) are both fault-free. Note that (u, v) is an edge in C. We can write C as v, P4 [v, u], u, v. Therefore, uh , P3 [uh , v h ], v h , v, P4 [v, u], u, uh is a faultfree Hamiltonian cycle. Case 1.1.2.2: There exists exactly one 2-node u for AQ1n . Since there is no faulty crossing edge, we can find an edge (uh , v) in C such that (u, uh ) and (v, v h ) are both faultfree. We can write C as uh , P1 [uh , v], v, uh . Since u is the 2-node for AQ1n , we can find a fault-free edge (u, w) ∈ E(AQ1n−1 ), where w = v h . By Lemma 3, there is a Hamiltoh h nian path v , P2 [v , w], w in AQ1n−1 − F1 − {u}. Therefore, u, uh , P1 [uh , v], v, v h , P2 [v h , w], w, u is a fault-free Hamiltonian cycle. Case 1.1.2.3: There exists exactly one 1-node u for AQ1n . Note that all the faulty edges in F1 are incident to u. We can find a fault-free edge (u, v) in AQ1n−1 . Since there is no faulty crossing edge, then by Lemma 5, there is an edge (a, b) in C such that (u, a) and (b, w) are both fault-free crossing edges, where w ∈ / {u, v}. We can write C as a, P1 [a, b], b, a. By Lemma 3, there is a Hamiltonian path w, P2 [w, v], v in AQ1n−1 − {u}. Therefore, u, a, P1 [a, b], b, w, P2 [w, v], v, u is a fault-free Hamiltonian cycle. Case 1.2: There exists exactly one 1-node u for AQ0n−1 . In this case, |F0 | ≥ 2n − 4. Since u is a 1-node for AQ0n−1 , there is a fault-free edge (u, v) in AQ0n−1 . Case 1.2.1: |F1 | ≤ 2n − 6. Since u is the 1-node for AQ0n−1 and every node is ideal for AQn , (u, uh ) or (u, uc ) is fault-free. W.l.o.g., we assume that (u, uh ) is fault-free. Since Enh − 2 = 2n−1 − 2 > 2n − 4 ≥ |Fc | + |F1 |, we can find a fault-free edge (w, wh ), where w ∈ V (AQ0n−1 ) and w ∈ / {u, v}. By Lemma 3, there is a Hamiltonian path v, P1 [v, w], w in AQ0n−1 − F0 − {u}, and there is a Hamiltonian path wh , P2 [wh , uh ], uh in AQ1n−1 − F1 . Therefore, u, v, P1 [v, w], w, wh , P2 [wh , uh ], uh , u is a fault-free Hamiltonian cycle. Case 1.2.2: 2n − 5 ≤ |F (AQ1n−1 )| ≤ 2n − 4. In this case, there is at most one faulty crossing edge. There are the following scenarios.
Fault-Tolerant Hamiltonicity of Augmented Cubes
679
Case 1.2.2.1: Every node is ideal for AQ1n−1 . By the induction hypothesis, there exists a Hamiltonian cycle C in AQ1n−1 − F1 . By Lemma 4, there is an edge (a, b) in C such that (u, a) and (b, w) are fault-free edges, where w ∈ V (AQ0n−1 ) and w ∈ / {u, v}. We can write C as a, P1 [a, b], b, a. By Lemma 3, there is a Hamiltonian path w, P2 [w, v], v in AQ0n−1 − F0 − {u}. Therefore, u, a, P1 [a, b], b, w, P2 [w, v], v, u is a fault-free Hamiltonian cycle. Case 1.2.2.2: There exists exactly one 1-node x for AQ1n−1 . In this case, all faulty edges are adjacent to u and x. There is a fault-free edge (x, y) in AQ1n−1 . We consider the following two subcases. Case 1.2.2.2.1: (u, x) ∈ E(AQn ). Note that (u, x) must be fault-free. We can find an edge (a, ah ), where a ∈ V (AQ0n−1 ), such that a ∈ / {u, v} and ah ∈ / {x, y}. By Lemma 3, there is a Hamiltonian path v, P1 [v, a], a in AQ0n−1 − {u}. Similarly, there is a Hamiltonian path ah , P2 [ah , y], y in AQ1n−1 − {x}. Therefore, u, v, P1 [v, a], a, ah , P2 [ah , y], y, x, u is a fault-free Hamiltonian cycle. Case 1.2.2.2.2: (u, x) ∈ / E(AQn ). Since uh = y or uc = y, h w.l.o.g., we can assume that u = y. Moreover, we can assume that xh = v. By Lemma 3, there is a Hamiltonian path v, P1 [v, xh ], xh in AQ0n−1 − {u}, and there is a Hamiltonian path y, P2 [y, uh ], uh in AQ1n−1 − {x}. Therefore, u, v, P1 [v, xh ], xh , x, y, P2 [y, uh ], uh , u is a fault-free Hamiltonian cycle. Case 1.3: There exists one node u ∈ V (AQ0n−1 ) incident to exactly two fault-free edges (u, uh ) and (u, uc ). In this case, |F0 | ≥ 2n − 3 and |F1 | ≤ 2n − 5. There are the following scenarios. Case 1.3.1: Each node is incident to as least three fault-free edges in AQ1n−1 . By Lemma 2, uh is adjacent to uc . If (uh , uc ) is faulty, then by Lemma 5, there is a Hamiltonian cycle C in AQ1n−1 − (F1 − (uh , uc )) containing (uh , uc ). Since (|Enh | − 2)/2 = 2n−2 − 1 > 2n − 5 ≥ |Fc | + |F1 |, we can find an edge (x, y)in C such that (x, xh ) and (y, y h ) are both fault-free and {x, y} {uh , uc } = ∅. We can write C as uh , P1 [uh , x], x, y, P2 [y, uc ], uc , uh . By Lemma 3, there is a Hamiltonian path xh , P3 [xh , y h ], y h in AQ0n−1 − F0 − {u}. Therefore, u, uh , P1 [uh , x], x, xh , P3 [xh , y h ], y h , y, P2 [y, uc ], uc , u is a fault-free Hamiltonian cycle. However, if (uh , uc ) is fault-free, a faultfree Hamiltonian cycle can be constructed similarly. Case 1.3.2: There exists exactly one 2-node v for AQ1n−1 . In this case, all faulty edges are incident to u and v. Let (v, w) ∈ F1 with (v, w) = (uh , uc ). By Lemma 5, we can find a Hamiltonian cycle C in AQ1n−1 − (F1 − (v, w)) containing (uh , uc ). Case 1.3.2.1: (v, w) ∈ / C. The proof is similar to that used in Case 1.3.1.
680
S.-Y. Hsieh and Y.-R. Cian
Case 1.3.2.2: (v, w) ∈ C. We can write C as uh , P1 [uh , v], v, w, P2 [w, uc ], uc , uh . Note that u ∈ / {v h , wh } or u ∈ / {v c , wc }. h h W.l.o.g., we assume that u ∈ / {v , w }. By Lemma 3, there is a Hamiltonian path v h , P3 [v h , wh ], wh in AQ0n−1 − {u}. Therefore, u, uh , P1 [uh , v], v, v h , P3 [v h , wh ], wh , w, P2 [w, uc ], uc , u is a fault-free Hamiltonian cycle. Case 2: |F0 | ≥ 4n − 11. We consider the following four subcases. Case 2.1: |F0 | = 4n − 11. In this case, |Fc | + |F1 | ≤ 3. We consider the following three subcases. Case 2.1.1: Every node is ideal for AQ0n−1 . In this case, every node in AQ0n−1 is incident to at most 2n − 5 faulty edges in AQ0n−1 . Since |F0 | = 4n − 11 > 2n − 5 for n ≥ 4, we can find two faulty edges (u, v) and (x, y) in AQ0n−1 such that {u, v} {x, y} = ∅. Moreover, since |Fc | ≤ 3, one pair of edges in {{(u, uh), (v, v h )}, {(u, uc), (v, v c )}, {(x, xh ), (y, y h )}, {(y, y c), (y, y c )}} are fault-free. W.l.o.g., we assume that (u, uh ) and (v, v h ) are both fault-free. By the induction hypothesis, there is a Hamiltonian cycle C in AQ0n−1 − (F0 − (u, v)). We consider the following two subcases. Case 2.1.1.1: (u, v) ∈ / C. Since |Fc | ≤ 3, we can find an edge (a, b) in C such that (a, ah ) and (b, bh ) are both fault-free. We can write C as a, b, P1 [b, a], a. By Lemma 3, there is a Hamiltonian path ah , P2 [ah , bh ], bh in AQ1n−1 −F1 . Therefore, a, ah , P2 [ah , bh ], bh , b, P1 [b, a], a is a fault-free Hamiltonian cycle. Case 2.1.1.2: (u, v) ∈ C. We can write C as u, v, P1 [v, u], u. By Lemma 3, there is a Hamiltonian path uh , P2 [uh , v h ], v h in AQ1n−1 − F1 . Therefore, u, uh , P2 [uh , v h ], v h , v, P1 [v, u], u is a fault-free Hamiltonian cycle. Case 2.1.2: There exists exactly one 1-node u for AQ0n−1 . We can find a fault-free edge (u, v) in AQ0n−1 . Since u is ideal for AQn , (u, uh ) or (u, uc ) is fault-free. W.l.o.g., we assume that (u, uh ) is fault-free. Moreover, since |Fc | ≤ 3, we can find an edge (u, w) ∈ F0 such that (w, wh ) is fault-free. By the induction hypothesis, there is a Hamiltonian cycle u, v, P1 [v, w], w, u in AQ0n−1 − (F0 − (u, w)). By Lemma 3, there is a Hamiltonian path wh , P2 [wh , uh ], uh in AQ1n−1 − F1 . Therefore, u, v, P1 [v, w], w, wh , P2 [wh , uh ], uh , u is a fault-free Hamiltonian cycle. Case 2.1.3: There exists one node u ∈ V (AQ0n−1 ) incident to exactly two fault-free edges (u, uh ) and (u, uc ). The proof of this case is similar to that used in Case 1.3.1. Case 2.2: |F0 | = 4n − 10. The are the following scenarios. Case 2.2.1: Every vertex is ideal in AQ0n−1 . In this case, |Fc |+|F1 | ≤ 2. We consider the following two subcases. Case 2.2.1.1: There are two faulty edges (a, b) and (c, d) in AQ0n−1 such that a, b, c and d are all distinct and (a, ah ), (b, bh ), (c, ch ), (d, dh ) are all fault-free or (a, ac ), (b, bc ), (c, cc ), (d, dc ) are all
Fault-Tolerant Hamiltonicity of Augmented Cubes
681
fault-free. W.l.o.g., we assume that (a, ah ), (b, bh ), (c, ch ), and (d, dh ) are all fault-free. By the induction hypothesis, there is a Hamiltonian cycle C in AQ0n−1 − (F0 − {(a, b), (c, d)}). We can constructed a fault-free Hamiltonian cycle similar to that used in above cases. Case 2.2.1.2: We can not find the two faulty edges satisfying the condition of Case 2.2.1.1. In this case, all the faulty edges in F0 are incident to two nodes, denoted by u and v, in AQ0n−1 such that one pair of edges in {{(u, uh), (u, uc )}, {(v, v h ), (v, v c )}, {(u, uh ), (v, v c )}, {(u, uc), (v, v h )}} are both faulty. We consider the following two subcases. We can constructed a fault-free Hamiltonian cycle similar to that used in above cases. Case 2.2.2: There exists exactly one 1-node u for AQ0n−1 . Since every node is ideal for AQn , (u, uh ) or (u, uc ) is fault-free. W.l.o.g., we assume that (u, uh ) is fault-free. By Lemma 3, there is a Hamiltonian cycle C in AQ0n−1 − F0 − {u}. Moreover, we can find a node v in C such that (u, v) is fault-free. Since |Fc | ≤ 2, we can find an edge (v, w) in C such that (w, wh ) or (w, wc ) is fault-free and uh ∈ / {wh , wc }. We can write C as v, P1 [v, w], w, v. By Lemma 3, there is a Hamiltonian path wh , P2 [wh , uh ], uh in AQ1n−1 − F1 . Therefore, u, v, P1 [v, w], w, wh , P2 [wh , uh ], uh , u is a fault-free Hamiltonian cycle. Case 2.2.3: There exists one node u ∈ V (AQ0n−1 ) incident to exactly two fault-free edges (u, uh ) and (u, uc ). The proof is similar to that used in Case 1.3.1. Case 2.3: |F0 | = 4n − 9. In this case, |Fc | + |F1 | = 1. We can constructed a fault-free Hamiltonian cycle similar to that used in above cases. Case 2.4: |F (AQ0n−1 )| = 4n − 8. In this case, all the faulty edge are in AQ0n−1 . We can constructed a fault-free Hamiltonian cycle similar to that used in above cases.
5
Concluding Remarks
In this paper, we have focused on finding a fault-free Hamiltonian cycle in AQn with 4n − 8 faulty edges, where each node is incident to at least two v2
2n-4 faulty edges
. . .
v1
v3
. . .
v4 faulty edge
Fig. 2. A worst case scenario
2n-4 faulty edges
682
S.-Y. Hsieh and Y.-R. Cian
fault-free edges. There is a worst-case scenario: let v1 , v2 , v3 , and v4 be a 2dimensional augmented cube which is a subgraph of AQn (n ≥ 2) induced by the above four nodes. Each of {v1 , v3 } is incident to 2n − 3 faulty edges and (v1 , v2 ), (v1 , v4 ), (v2 , v3 ), and (v3 , v4 ) are fault-free (see Figure 2). Clearly, the above worst case contributes totally 4n − 7 faulty edges; moreover, it is impossible to generate a fault-free Hamiltonian cycle covering nodes v1 , v2 , v3 and v4 . Therefore, the number of tolerable faulty edges is optimal with respect to this worst case.
References 1. Akers, S.B., Krishnamurthy, B.: A group-theoretic model for symmetric interconnection networks. IEEE Transactions on Computers 38(4), 555–566 (1989) 2. Bermond, J.C.: Interconnection networks. Discrete Applied Mathematics, 37–38 (1992) 3. Bhuyan, L., Agrawal, D.P.: Generalized hypercubes and hyperbus structure for a computer network. IEEE Transactions on Computers C-33, 323–333 (1984) 4. Choudum, S.A., Sunitha, V.: Augmented cubes. Networks 40(2), 71–84 (2002) 5. Cull, P., Larson, S.M.: The M¨ obius cubes. IEEE Transactions on Computers 44(5), 647–659 (1995) 6. Efe, K.: The crossed cube architecture for parallel computation. IEEE Transactions on Parallel and Distributed Sytems 3(5), 513–524 (1992) 7. Fu, J.S.: Fault-tolerant cycle embedding in the hypercube. Parallel computing 29(6), 821–832 (2003) 8. Fu, J.S.: Conditional fault-tolerant Hamiltonicity of star graphs. Parallel Computing 33(7-8), 488–496 (2007) 9. Fu, J.S.: Fault-free Hamiltonian cycles in twisted cubes with conditional link faults. Theoretical Computer Science (in press) 10. Hilbers, P.A.J., Koopman, M.R.J., Snepscheut, J.L.A.: The twisted cube. In: Treleaven, P.C., Nijman, A.J., de Bakker, J.W. (eds.) PARLE 1987. LNCS, vol. 258, pp. 152–159. Springer, Heidelberg (1987) 11. Hsieh, S.Y., Ho, C.W., Chen, G.H.: Fault-free Hamiltonian cycles in faulty arrangement graphs. IEEE Transactions on Parallel and Distributed Systems 10(3), 223–237 (1999) 12. Hsieh, S.Y., Chen, G.H., Ho, C.W.: Longest fault-free paths in star graphs with vertex faults. Theoretical Computer Science 262(1-2), 215–227 (2001) 13. Hsieh, S.Y., Chen, G.H., Ho, C.W.: Longest fault-free paths in star graphs with edge faults. IEEE Transactions on Computers 50(9), 960–971 (2001) 14. Hsieh, S.Y.: Embedding longest fault-free paths onto star graphs with more vertex faults. Theortical Computer Science 337(1-3), 370–378 (2005) 15. Hsieh, S.Y.: Fault-Tolerant cycle embedding in the hypercube with more both faulty vertices and faulty edges. Parallel Computing 32(1), 84–91 (2006) 16. Hsieh, S.Y., Shiu, J.Y.: Cycle embedding of augmented cubes. Applied Mathematics and Computation 191(2), 314–319 (2007) 17. Hsieh, S.Y., Lee, C.W.: Conditional Edge-Fault Hamiltonicity of Matching Composition Networks. IEEE Transactions on Parallel and Distributed Systems 20(4), 581–592 (2009) 18. Hsu, D.F.: Interconnection networks and algorithms. Networks 23(4) (1993)
Fault-Tolerant Hamiltonicity of Augmented Cubes
683
19. Hsu, H.C., Chiang, L.C., Tan, J.J.M., Tan, H.L.H.: Fault hamiltonicity of augmented cubes. Parallel Computing 31(1), 131–145 (2005) 20. Hung, H.S., Chen, G.H., Fu, J.S.: Fault-free Hamiltonian cycles in crossed cubes with conditional link faults. Information Sciences 177(24), 5664–5674 (2007) 21. Leighton, F.T.: Introduction to parallel algorithms and architecture: arrays (trees) (hypercubes). Morgan Kaufmann, San Francisco (1992) 22. Park, J.H., Kim, H.C., Lim, H.S.: Fault-Hamiltonicity of hypercube-like interconnection networks. In: Proceedings of the 19th IEEE International Parallel and Distributed Processing Symposium, 2005 (IPDPS 2005), vol. 1, p. 60.1 (2005) 23. Singhvi, N., Ghose, K.: The Mcube: a symmetrical cube based network with twisted links. In: Proceedings of the 9th International Symposium of Parallel Processing, Honolulu, pp. 11–16 (1995) 24. Tsai, C.H.: Linear array and ring embeddings in conditional faulty hypercubes. Theoretical Computer Science 314, 431–443 (2004) 25. Tseng, Y.C., Chang, S.H., Sheu, J.P.: Fault-tolerant ring embedding in a star graph with both link and node failures. IEEE Transactions on Parallel and Distributed Systems 8(12), 1185–1195 (1997) 26. Wang, N.C., Chu, C.P., Chen, T.S.: A dual-Hamiltonian-path-based multicasting strategy for wormhole-routed star graph interconnection networks. Journal of Parallel and Distributed Computing 62(12), 1747–1762 (2002) 27. Wang, N.C., Yen, C.P., Chu, C.P.: Multicast communication in wormhole-routed symmetric networks with Hamiltonian cycle model. Journal of Systems Architecture 51(3), 165–183 (2005) 28. Yang, P.J., Tien, S.B., Raghavendra, C.S.: Embedding of rings and meshes onto faulty hypercubes using free dimensions. IEEE Transactions on Computers 43(5), 608–613 (1994) 29. Yang, X.F., Evans, D.J., Megson, G.M.: The locally twisted cubes. International Journal of Computer Mathematics 82(4), 401–413 (2005)
The Design and Implementation of Z Language Editor∗ Xiaolei Gao Dongguan University of Technology, Daxue Road No.1 Dongguan, Guangdong, China, 523808
[email protected]
Abstract. This paper introduces the analysis, design and realization of the visual editor which supports Z language. It makes a detail of key technologies, including the input and output of special characters, the input and output of schema, the superscript and subscript and the optimized display of the text; the editor not only supports the processing of standard Z language but also provides input and output of a variety of graphics, simplifying editing and typesetting of Z language. Keywords: formal method, Z language, OLE, editor, visualization.
1 Introduction Since the emergence of "software crisis" in the 60's, in order to improve software development quality and efficiency, people brought forward variety methods of software development. These methods can be roughly divided into three categories: structured method, object-oriented method and formal method. Z language\ [1] is based on symbol and schema, easy to reasoning and deduction, but its graphical input and output are more difficult than computer processing, limiting its popularization and use\ [2]; so we designed a graphical editing environment to support standard Z are window-based, visualization, and WYSIWYG; In order to make Z language be accepted by a general user, our editor implemented the function to insert a variety of graphs in Z specification. At the same time it support editing, typesetting, printing of standard Z language, structured method and object-oriented method, and so on. This paper focuses on the design and implementation of Z language editor.
2 Basic Concept about Z Language Z is a popular specification language, it bases on predicate logic and set theory. The main expression is a set of schema (state schema and operation schema). It provide a mathematical model system in which can be reasoning. The language is very suitable for critical systems fields which can not repeat the test, such as aerospace, military, and banks. ∗
This work is supported in part by Natural Science Foundation of Guangdong in China (06301204).
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 684–692, 2009. © Springer-Verlag Berlin Heidelberg 2009
The Design and Implementation of Z Language Editor
685
Z language uses schemas and schema calculations to describe the objectives of software systems. The main components of Z specification is made of a series of schemas, axiom description and general formal, these components abstractly describe the structure and behavior characteristics for the various parts of the target software system. In Z language, schema is expressed as follows with a form of E-type
SchemaName Declare-Part Predicate-Part Fig. 1. Schema
Axiom description is expressed by the following form.
Declare-Part Predicate-Part Fig. 2. Axiom
General formal is expressed by the following form.
[Gen Formals] Declare-Part Predicate-Part Fig. 3. General formal
Because the graphical components and mathematical logic symbols above are not suitable for input and output to a computer, making the Z language’s use to be greatly hindered. Based on this we design and implement visualization, easy to input and output, editor of the Z language. In next part we will introduce the key technologies’ implementation about the editor.
3 The Analysis and Design of Z Editor According to characteristic of Z languagewe set up the use case model of Z language editor . shown in Fig. 4. By the use cases we have the system static class structure, shown in Fig. 5
686
X. Gao
Fig. 4. The graph is system’s use case 1
ZL Docum ent 1 1 0..*
1..*
0..*
ZL schem a
Text
G raph
1
1 1..*
1
1..* Char
1..*
Special Char 1
0..*
Fig. 5. The system static class structure graph
In order to facilitate the paging, print, display of schema and graphics, according to the static structure in Fig 5 we draw implement class shown in Fig. 6. The whole system is working focus on the document. A Z language document is made up of a number of pages and contains at least one page; A page is made up of 0 or more blocks; There are three types of block, they are graph, zl schema, paragraph and text
The Design and Implementation of Z Language Editor
687
Fig. 6. The system’s design class graph
lines, each type is generalized by the block; a paragraph contains at least one text; a schema is made up by one or zero schema name, one or more declarations and zero or more predicates, schema name, declarations and predicates are generalized by paragraph. The final system is shown in Fig. 7.
Fig. 7. The graph of Z editor’s running
688
X. Gao
4 The Design and Implement of Classes In this part we depict the design and implement of classes in Z language editor. 4.1 CSozDoc (Z Language Documents) Class We use CSozDoc to implement ZL Documents class in Fig.6. class CSozDoc : public COleDocument { private: CMyFile* ActPage; //the page in the Document }; class CMyFile : public CObject { private: int PageTotal; // Total pages in file CRect PageSize; // page size public: CObArray m_Pages; // Pointer of point to class Page void SetNewPage(); void InsertPage(int i, Page* InsertPage); void MyFileOut(); virtual: void Serialize(CArchive& ar); }; PageTotal records the total number of pages of documents, PageSize is used to record the size of documents, Pages are used to save pointer which points to page object; operation SetNewPage() is to generate a new page, InsertPage(int i, Page* InsertPage) is to insert a page in the designated location, DeletePage(int i) is to delete the designated page, Mouse(CDC * pDC, CPoint point) is to locate cursor position, MyFileOut() is to display documents; Serialize(CArchive & ar) be use to storage document. Because the implementation of Page class , Block class , Paragraph class and Schema class as to CSozDoc class’s basically, we do not repeated it but list. 4.2 CMyPage (Page) Class We use CMyPage to implement Page class in Fig.6. class CMyPage : public CObject { int cPageNumber; int BlockTotal; CRect cPageRect; void SetNewSchema(CDC* pDC); void MyPageOut(CDC* pDC); void MyDraw(CDC* pDC,CRect cOutRange) void SetNewTextBlock(); };
The Design and Implementation of Z Language Editor
689
BlockTotal page contains a few blocks; Blocks are used to store pointer which point to Block object, such as the class graph, Class Schema, Class Paragraph class, so Blocks can also be used to store the pointer which point to the four types of class instance. 4.3 CMyBlock (Block) Class We use CMyBlock to implement Block class in Fig.6. class CMyBlock :public CObject { void ResizePoint(int p); MyType BlockType; CFont GenFont,SuperFont,LowerFont; }; BlockType have three types of block, they are graph type, Schema and Paragraph type; BlockSize is the size of block , used to limite the display area of block content. 4.4 CMyParagraph (Paragraph) Class We use CMyParagraph to implement Paragraph class in Fig.6. class CMyParagraph : public CMyBlock { public: CString RemoveAtTail(CString st); CString InsertAtHead(CString st,char ch); void VK_Down(CDC* pDC); void VK_Up(CDC* pDC); void VK_Right(CDC* pDC); void VK_Left(CDC* pDC); void DeleteChar(CDC* pDC,char nChar); BOOL NoVisioChar(char nChar); void AddChar(CDC* pDC,UINT nChar); int Symbol(char nChar); void FormatTextLine(CDC* pDC); virtual void Serialize(CArchive& ar); CString m_MyTextLine;//Text class int StringWiden(CDC* pDC,CString st); int LineTotal; }; A paragraph is composed of a number of text lines, LineTotal record the number of text lines; Textlines are used to store pointers which point to TextLine object. When the width of the string of the line is greater than the block width, the line should be split in order that it will not exceed the designated area when be shown; When the width of the string of the line is smaller than the block width, and after the line there exists a line, line merger should be carried out in order to show the correct, complete paragraphs. CMyParagraph class is the foundation to construct the whole Z language documents, also is the member of Schema class and Paragraph class; and Paragraph class is the parent class of Name class, Declare class and Predict class, therefore, CMyParagraph is the basis and key of the entire class structure.
690
X. Gao
4.5 CMySchema(Z Language Schema) Class Schema is very important in Z language. So we use CMySchema, CMySchemaName, CMySchemaDeclare and CMySchemaPredict to implement ZL schema class, Schema Declaration class, and Schema Predication class in Fig.6. correspondingly. class CMySchemaName : public CMyParagraph { int NameTag; void InPutChar(CDC* pDC,UINT nChar,UINT nRepCnt, UINT nFlags,CView* pView); }; class CMySchemaDeclare : public CMyParagraph { int DeclTag; void InPutChar(CDC* pDC, UINT nChar, UINT nRepCnt, UINT nFlags, CView* pView); void RespondChar2(CDC * pDC); void SetSizePoint(CDC* pDC); }; class CMySchemaPredict : public CMyParagraph { int PredTag; void InPutChar(CDC* pDC, UINT nChar,UINT nRepCnt, UINT nFlags, CView* pView); void RespondChar2(CDC * pDC); }; class CMySchema : public CMyBlock { CPoint SchemaPoint[8]; //put point of schema frame CMySchemaName m_SchemaName; CMySchemaDeclare m_SchemaDeclares; CMySchemaPredict m_SchemaPredictions; BOOL DeletePred(CDC* pDC,int index); BOOL DeleteDecl(CDC* pDC,int index); void DeleteLine(CDC* pDC,int index); void ResizePointDecl(int p,int k); void ResizePointPred(int p,int k); void ReSizePoint(int p); void MySchemaOut(CDC* pDC); void SetName(CDC* pDC); void SetPrediction(); void SetDeclare(CDC* pDC); void MyDraw(CDC* pDC); }; Name class, Declare class and Predict class inherit class Paragraph class, they inherit the attributes and methods of parent class, the only difference between they and the father Paragraph class is the starting point of the rectangular is different, shown in Fig. 8.
The Design and Implementation of Z Language Editor
691
Schema is made up of the schema name, the declaration part the predication part and schema box, as shown in Fig. 8. Pointer of schema name points to instance of Name class, the declaration part is made up of a number of pointer which point instance of Declare class, the predication part is made up of a number of pointer which point instance of Predict class. Their are stored in the pointer array SchemaName, SchemaDeclares and SchemaPredictions; schema box coordinates with eight points, they record in the integer type array SchemaPoint[8].
Fig. 8. Schema box coordinates with eight points
4.6 Graph (Graphs) Class We use CMyGraphBlock to implement Graph class in Fig.6. class CMyGraph_Block : public CMyBlock { CSozCntrItem* graph;//OLE }; We use OLE technology provided by Windows and MFC to implement graphs. As long as users have any drawing program which can be used as a OLE server, they can be given to any graphics. Users can develop their own graphics program even if they do not know our editor's source code. As long as the program supports the OLE technology, it can be use by Z language editor. Fig. 7 demonstrate flow chart.
5 The Key Technologies 5.1 Special Symbols Z language has many special symbols, such as → ⇒ ⇔ ∀, it causes a lot of difficulties to the user. there are two plans to implement the input and output of special symbols. One is to use the bitmap to draw symbols, and the other is to use the TrueType fonts. Because bitmaps’ output is not independency on equipment, it is difficult to implement the WYSIWYG, so we have chosen the way of TrueType fonts. Special symbols have standard fonts Zed, it is TrueType fonts, but its characters code is same as letters code, so the storage is also the same. In order to distinguish Zed between letters, when input the special symbols add a label "\5" in front and end of it , for example, the symbol ≥ encoding is the "80", the storage form of correspondence is "\5 80 \5". When editor output, once read characters "\5", change the output font to Zed font, so the corresponding output is Zed TrueType fonts. Its relationship of storage and display is shown in Fig. 9.
692
X. Gao
an+1 ≥ bx
String storage
caret Display area
a
\a
n
subscript
+
1
\a
\5
80
Z symbol ≥
\5
b index
\b
x
\b
superscript
Fig. 9. Relation graph storage and display
In order to solve the input of the special symbols, we adopted a toolbox-style input way as shown in Fig. 7. As long as you click on the symbol you want in the toolbox with the mouse, the symbol can be displayed correctly. Its implementation is to use a MFC’s toolbar. The MFC’s toolbar can only show in a line, because Z language has a lot of special symbols, and a line can not include them all, so we modified MFC’s toolbar into Toolbar boxes to enable it to multi-line display. The implementation is shown in Fig. 7. 5.2 The Superscript and Subscript The display of Superscript and subscript is to use the graphical way, by changing the logic font size, re-position the location show generates special show effects. Superscript storage in the array beginning with \b and ends with \b; subscript’ storage start with \a and ends with \a. For example, the storage of bx is b \b x \b and an+1 is a \a n+1 \a, their storage and display is shown in Fig. 9 and Fig. 7.
6 Conclusions This article describes in more detail modeling, design and implementation of Z language editor, made a detailed analysis about some key technologies such as the realization of special symbols, Chinese characters processing, how to display superscript, subscript and the use of OLE technology to implement graph.
References 1. Spivey, J.M.: The Z Notation: a Reference Manual, 2nd edn. Prentice Hall, London (1990) 2. Toyn, I., Galloway, A.: Proving Properties of Stateflow Models Using ISO Standard Z and CADiZ. Springer, Heidelberg (2005) 3. Blaha, M., Rumbaugh, J.: Object-Oriented Modeling and Design with UML. Prentice Hall, Englewood Cliffs (2005) 4. Gamma, E., et al.: Design Patterns. Addison Wesley, Reading (1995) 5. Richter, J.: Programming Applications for Microsoft Windows. Microsoft Press, Washington (1999)
A Semantic-Aware Attribute-Based Access Control Model for Web Services Haibo Shen School of Computer, Hubei University of Technology, Wuhan 430068, China
[email protected]
Abstract. Web service is a new service-oriented computing paradigm which poses the unique security challenges due to its inherent heterogeneity, multidomain characteristic and highly dynamic nature. A key challenge in Web services security is the design of effective access control schemes. Attribute-based access control (ABAC) is more appropriate than some other access control mechanisms, but it do not fully exploit the semantic power and reasoning capabilities of emerging web applications. So a semantic-aware attribute-based access control model (SABAC) is presented to address these issues by combining the ABAC with the Semantic Web technologies in this paper. SABAC grants access to services based on attributes of the related entities, and uses Shibboleth service to address the disclosure issue of the sensitive attributes. In addition, SABAC uses the Web Ontology Language (OWL) standard to represent the ontology of the resources and users and uses eXtensible Access Control Markup Language (XACML) as the policy language. It can provide administratively scalable alternative to identity-based authorization methods and provide semantic interoperability for the access control to Web services. Moreover, SABAC also separates ontology management from access management. Keywords: Attribute-Based Access Control, Web Services, Semantic Web Technologies, Ontology, XACML.
1 Introduction A Web service [1] is a Web-based loosely coupled application that can be published, located and invoked across the Internet. Web services technology enables organizations to exploit software as a service. In Web services environments, access control is required to cross the borders of security domains, to be implemented between heterogeneous systems. Interaction is between remotely located parties who may know little about each other. Moreover, compared to centralized systems and client-server environments, the Web services environment is much more dynamic and distributed, and security for such an open environment poses unique challenges. Among these challenges is to develop effective access control model, and semantic interoperability appears also as the main challenge to address concerning access control in web services environment. However, in the Web services environment, the traditional access control models, such as discretionary access control (DAC) [2], mandatory access control (MAC) [2], A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 693–703, 2009. © Springer-Verlag Berlin Heidelberg 2009
694
H.B. Shen
role-based access control (RBAC) [3], are inadequate [4]. In order to make the access control mechanism more flexible, the attribute-based access control (ABAC) [5,6] has been introduced. With ABAC, permissions are authorized based on the attributes of users, with which information other than user identifications can be taken into consideration, and the number of mappings from users to permissions can be greatly reduced for that a lot of users share the common attributes. However, although ABAC systems allow the specifications of access control rules with reference to generic attributes or properties of the requestor and the resources, they do not fully exploit the semantic power and reasoning capabilities of emerging web applications. Semantic Web technologies [7], especially Ontology, can be used to improve security in service-oriented, open heterogeneous environments and what semantic interoperability challenge must be met. So, this paper proposes a semantic-aware attribute-based access control model (SABAC) for Web services. In SABAC, with the ontology representation of attributes, authorization decision can be handled with ontology inference and parties can facilitate the understanding of various attributes by sharing the formal definition in ontology. The access control policy in SABAC specifies what attributes should be based on in order to gain access to a certain service, and XACML (eXtensible Access Control Markup Language) [8] is used to describe the access control policies, thereby allowing a better interoperability. In addition, Shibboleth [9] is used to provide user’s attributes, which can protect the user’s privacy. The remainder of this paper is organized as follows: The second section brief discusses main related technologies. The third section presents SABAC model for Web services. The section 4 presents provides a summary of existing research works in access controls for Web services. In the section 5 the conclusion is given and the future work is pointed out.
2
Background
2.1 Attribute-Based Access Control In traditional access control models, such as DAC, MAC, and RBAC, permission or roles are assigned to users with respect to their identifications, while ABAC makes an authorization decision based on attribute values required to allow access to a resource according to rules created through the security administrator. Attributes are the set of properties that may be associated with a given entity instead of the identifications. An entity m a y be a subject, resource or environment that is considered related to the interaction between a user and an application. Therefore, attributes may be subject attributes (subject’s identity, role, age, zip code, IP address, memberships, citizenships, etc.), may be resource attributes (resource’s identity, location, size, value, etc.), or may be environmental attributes (time of day, date, system state, etc.). With ABAC, the mapping of user’s identifications to roles can be greatly reduced, and rules for authorization can be simplified in a large-scale distributed environment. In the same time, basing authorization on attributes of services requester provides flexibility and scalability that is essential in the context of large distributed open systems, like web services environment. As an example, suppose that an online bookstore offers discounts to students at accredited universities. In this case, a user has to submit a student ID to receive a student discount. The online bookstore is therefore not interested in the identity of the user, it only needs a proof that the user is a student.
A Semantic-Aware Attribute-Based Access Control Model for Web Services
695
2.2 XACML The XACML specification is an OASIS standard that supports the integration of subject and object attributes in access policies, a feature that is essential for ABAC policies. The standard defines a powerful policy language that supports complex, finegrained rules. Rules are aggregated to policies that control the access to a resource. Along with the policy language the XACML standard defines an authorization infrastructure that is generic enough to implement the ABAC authorization model. Fulfilling the needs of distributed architectures, the XACML architecture logically separates the access control components responsible for policy definition, policy enforcement and policy evaluation. Specifically, the XACML architecture specifies the implementation of a PEP (Policy Enforcement Point), a PAP (Policy Administration Point), a PDP (Policy Decision Point), a PIP (Policy Information Point), and a Context Handler. Each of these actors is devoted to one specific task of the access control process: The PEP receives access requests and forwards them to the PDP which is responsible for the evaluation of attributes and the access decision. The PIP supplies the PDP with subject and object attributes that are relevant for the access decision. The access policy is provided by the PAP that stores and maintains the access rules. The XACML architecture also employs a Context Handler to collect and broker data flows. In addition, XACML also provides conflict resolution through its combining algorithms. This paper uses XACML to represent attribute-based access control policies and extends the XACML architecture for the authorization decision. For a detailed review of the XACML policy elements the reader is referred to [8]. 2.3 Shibboleth Apart from flexible access control, privacy increasingly moves to the center of attention in distributed IT infrastructures. Respective studies show that users become more and more concerned about the disclosure of private attributes. In the ABAC model, however, the disclosure of personal attributes is essential for the access decision. Consequently, privacy plays a special role in distributed architectures that employ an ABAC system. This paper uses Shibboleth to provide user’s attributes in order to protect user’s privacy. Shibboleth is an attribute authorization service developed by the Internet2 community for cross-organization identity federation. Shibboleth creates a distributed authorization infrastructure for Web resources, and simplifies the access control policies and makes them more scalable. Shibboleth provides the user attributes to the requested resources by using the Security Assertion Markup Language (SAML) [10] attribute statements. SAML can be used to uniformly express authentication and authorization assertions between different security domains. Shibboleth allows pseudonymous interaction between users, thus protecting individual privacy while still providing basic security for resource providers [11]. The Shibboleth service maps a user name and attributes onto a unique identifying handle. To protect the user’s privacy, the service can restrict the information about the holder of the handle depending on who is asking for the information. For example, it does not release the user’s name except to those requestors who have been authorized. A user could be issued a set of pseudonym identities, and he/she could be authenticated at different sites with different identities. The information that binds the set of pseudonym identities to the handle should be maintained securely and can be used when security violations occur.
696
H.B. Shen
2.4 Ontology and Semantic-Aware Access Control Due to the openness of the environment and the richness and variety of security requirements and attributes that may need to be considered, it is important to provide parties with a means to understand each other with respect to the properties they enjoy (or request the counterpart to enjoy). Therefore, common languages, dictionaries, and ontologies must be developed. In interoperable e-business architectures based on the semantic web vision, ontology-based domain models are used as controlled vocabularies for resources description, allowing users to obtain the right resources at the right time. OWL (Web Ontology Language) [12] was developed as an ontology language for constructing ontologies that provide high-level descriptions of Web content. These ontologies are created by building hierarchies of classes describing concepts in a domain and relating the classes to each other using properties (attributes). OWL can also represent data as instances of OWL classes—referred to as individuals—and it provides mechanisms for reasoning with the data and manipulating it. OWL also provides a powerful axiom language for precisely defining how to interpret concepts in an ontology. This paper uses OWL to represent the metadata about the resources and user attributes. The processing and analysis of ontology, i.e. drawing conclusions and gaining new information through combination, takes place in the logical layer. Implicit information in the data can be made explicit by using so-called reasoners or inference engines. Simple inferences are already possible with OWL, for instance through inheritance. But there is a limitation in OWL reasoning, more complex custom inference rules require the usage of a special rule language. A promising approach is the Semantic Web Rule Language (SWRL) [13]. SWRL allows users to write rules that can be expressed in terms of OWL concepts and that can reason about OWL individuals. The main advantage of using SWRL is its ability to provide support for complex relationships between properties, therefore extending the expressiveness of what we can define in OWL (OWL-DL). For example, it is impossible to assert that persons who study and live in the same city are “home students” in OWL, whereas this can be done easily using SWRL rules: Studies(x,y)^lives(x,z)^location(y,u)^location(z,u)→homeStudent(x) The ontology examples can be found in OWL [12], and also the SWRL rule examples can be found in SWRL [13]. The most evident advantage of integrating access control architectures with semantic web technologies (called the semantic-aware access control [14]) is the opportunity of applying the fine-grained categorization primitives of semantic web languages to provide a more detailed description of the entities involved. By doing this, rules applying to a given concept can be extended to related concepts according to well defined principles such as subsumption, union, intersection. Context information (for instance users, roles, resources, and credentials) can be expressively represented with concepts and instances of an OWL ontology whose consistency can be automatically checked with existing tools.
3 SABAC Model This section describes the architecture of the SABAC model. SABAC model composes of two parts: an ontology management system and an access control system.
A Semantic-Aware Attribute-Based Access Control Model for Web Services
697
Both of them are implemented separately but are connected through a semantic knowledge base. The ontology management system provides the extended user and resource attributes for the semantic knowledge base, while the access control system directly uses the related attributes from the semantic knowledge base for access control policy evaluation. This paper separates ontology management from access management so that administrators can focus on writing a policy or planning for appropriate actions in order to deal with anticipated threats or illegitimate accesses without worrying about how to capture or interpret domain knowledge. 3.1 Access Control System Web service paradigm is based upon the interactions between Web service providers and Web service requestors. The remote user in a security domain accesses Web services, exposed by other domains. The application that performs the access is referred to as a requestor. The requestor, which is usually a Web portal, authenticates the user before access to its resources is allowed, and is in charge of constructing SOAP (Simple Object Access Protocol) [15] requests. The user selects an option displayed on a page on his browser, for the execution of a method of a Web service, defined in another security domain. On behalf of the user, the requestor invokes the selected service. The invocation is sent in a SOAP message to the Web service provider. The Web service provider resides on a Web or Application server that is network accessible. Access control system consists of a set of entities and functional components that allow authorization decisions to be made and enforced based on attributes and policies. A general overview of the main components of the system is depicted in Figure 1.
1.Soap request
Requester (User) 14.Access response
2.Access request
SOAP Handler
3.Request Authorization decision XACML PDP
10.Return policy
XACML Policy
12.Return Authorization decision 4.Request user attributes
8.Request context 11.Response context
9.Request policy
13.Allowed access
PEP
Context Handler
Web Services Attribute Authority
Shibboleth
5.Return user attributes 6.User and resource attributes 7Extended user and resource attributes
Fig. 1. Access control system in SABAC model
Semantic Knowledge Base
698
H.B. Shen
There are eight main components: SOAP Handler: This module is in charge of accepting SOAP messages and verify digital signature of the message submitted within the request. If this control is successfully completed a message conveying the actual access request is extracted by the SOAP body, and forwarded to the Policy Enforcement Point (PEP). Policy Enforcement Point: A PEP interacts with SOAP Handler, sends an authorization request to Policy Decision Point (PDP) and enforces the decisions of the PDP (e.g. by allowing or denying access to resources). Policy Decision Point: The PDP makes the access decision based on the obtained attributes from the message, Semantic Knowledge Base and the permissions respectively rules stored in the XACML policies to decide if a certain action is in accordance with these rules and can be granted or must be denied. XACML Policy: This component allows for the definition of policy rules and feeds the rules to the PDP. Shibboleth: This component provides user attributes needed for authorization decision from the attribute authority. Attribute Authority: This component defines and provides user attributes. Semantic Knowledge Base: This component provides the ontology information which is additional metadata corresponding to the resource and user attributes. Context handler: This component should implement two functions below: (1) It manages a repository for all attributes definitions and their corresponding implementations in SABAC model. When the PDP encounters an attribute type in an attribute condition, it calls the context handler to evaluate that attribute type. When a complex attribute type is evaluated, the context handler will iteratively ask itself for evaluation inputs. (2) It converts decision requests in the native request format to the XACML canonical form and converts authorization decisions in the XACML canonical form to the native request format. The data flow in the access control system can be described in detail as follow: 1. The requester sends the SOAP request to the web service provider. 2. At the web server there is a SOAP handler that intercepts incoming requests to the service. After finishing its work, it forwards the request to PEP. 3. PEP sends an authorization request to the context handler. 4. The context handler then contacts the Shibboleth service to request the user attributes 5. The Shibboleth service retrieves the user attributes from the attribute authority and returns them to the context handler. 6. The context handler contacts the semantic knowledge base to obtain additional metadata corresponding to the resource and user attributes. 7. The semantic knowledge base returns the result (the extended user and resource attributes) to the context handler. 8. The context handler then sends the request context (which already contains user and resource attributes and the extended attribute information) to XACML PDP for authorization decision. 9. PDP contracts the XACML policy to retrieve the corresponding access control policy of the resource. 10. The XACML policy returns the access control policy.
A Semantic-Aware Attribute-Based Access Control Model for Web Services
699
11. Based on the access control rules specified in the XACML policy and the extended attribute information obtained from the semantic knowledge base, PDP makes the authorization decision. Then, PDP returns the authorization decision (as the response context) to the context handler. 12. The context handler then forwards the authorization decision (permit/deny) to PEP. 13. PEP then establishes a connection to the requested resource if the access control decision is permit. 14. Otherwise, the user’s request would be denied. In the end, PEP returns the error message to the user. 3.2 Ontology Management System Figure 2 shows the components and data flow of the ontology management system. The data flow is as follows: 1. The ontology management system uses the Protégé-OWL ontology editor in the Protégé-OWL ontology development toolkit [16] to create user ontology and resource ontology, and uses the Protégé-OWL ontology SWRLTab in the Protégé-OWL ontology development toolkit to create SWRL rules. SWRLTab includes an editor that supports interactive creating, editing, reading, and writing of SWRL rules. 2. By using the inference engine (foe example, Racerpro) to realize the ontology reasoning, its aim is to make sure the established ontologies (reduced ontologies) will have better structural levels, and ensure that there isn’t any contradictories in the definitions and concepts which are generated from the ontologies. Protégé-OWL Ontology Development toolkit Ontologies SWRL rules
Inference Engine
Reduced ontologies SWRLJessTab Jess facts and Jess rules Jess Rule Engine extened attributes information Semantic Knowledge Base Fig. 2. Ontology management system in SABAC model
700
H.B. Shen
3. Considering present reasoning system can’t process OWL knowledge and SWRL rules directly, the system uses SWRLJessTab in SWRLTab to transform OWL knowledge and SWRL rules into Jess facts and Jess rules, so that we can use Jess rule engine [17] to carry out the knowledge reasoning and obtain the extended attributes information for the semantic knowledge base.
4 Related Work Access control for Web services is already becoming the hot topic in the field of Web services security. A major requirement of an access control model for web services is the handling of the dynamic nature of the transactions. Web services interact across disparate computing platforms, in different geographical locations and with different regulatory compliance requirements. In this section we describe some access control models that have been proposed or implemented for web services. Several correlated specifications are proposed toward providing a comprehensive standards framework for secure Web services applications. SAML defines an XML framework for exchanging authentication and authorization information for securing Web services, and relies on third-party authorities for provision of “assertions” containing such information. XACML is an XML framework for specifying access control policies for Web-based resources and with significant extensions can potentially be applied to secure Web services. The XACML specification supports identity-based access control and incorporates some contextual information, such as location and time, into access decisions, without any formal context-aware access control model. The model proposed by Damiani [18] is probably the most significant work in relation to access control in web services. This model exploits the XML structure of SOAP calls. This provides a simple yet efficient way to enforce access control policies directly to XML structure. However, these works are not directly relevant to web services. The RBAC (Role Based Access Control) model is widely accepted recently. Bhatti [19] proposes X-GTRBAC model, Xu presents a service-oriented role-based access control model CSRBAC for web services [20]. Liu proposes an attribute and role based access control model ARBAC for web services [21]. However, the role is static, in that as soon as it is assigned, it is potentially out-of-date. Inherent to RBAC is the need for continual human administration; administration that becomes incredibly costly and difficult when fine-grained access and/or many changes in status is required in lists that may be distributed. Several studies have subsequently been done to extend the RBAC model in order to address some of the weaknesses [22]. In order to make the access control mechanism for Web services more flexible, the attribute-based access control (ABAC) has been introduced. In recent years, there has been a shift to looking at attributes as a basis for access control in a web services environment, the related papers are [23,24,25,26]. Attributes describe the characteristics of the requester, and may be a combination of identity and role. Attributes may be subject attributes, resource attributes or environment attributes. However, the lack of semantic interoperability will hinder the adoption of ABAC in large-scale open systems. It has been recognized that there is still a need for the usage of semantics and/or ontologies to ensure correct access control decisions with the ABAC model, and
A Semantic-Aware Attribute-Based Access Control Model for Web Services
701
some research to that end has been done, for example, [27,28,29,30] are the related papers. But they don’t use off-the shelf standard XACML as policy language. This paper combines ABAC with semantic-aware access control, allows the administrator to focus on either access management or ontology management separately.
5 Conclusion This paper presented a SABAC model to address the access control issue of Web services by combining ABAC mechanism with the Semantic Web technologies. SABAC model extends the ABAC model to gain many advantages from its semanticaware capability. This paper proposes the use of semantics in conjunction with the XACML standard for better interoperability and reduced administration overhead and uses Shibboleth to protect user’s privacy. In our future work, we further add contextawareness to SABAC so that access control policies can be properly written and enforced based on the context by extending XACML. Acknowledgments. This work is supported by National Natural Science Foundation of China under grant No. 60873024.
References 1. World Wide Web Consortium. Web service, http://www.w3.org/2002/ws 2. Sandhu, R.S.: Access Control: The Neglected Frontier. In: Pieprzyk, J.P., Seberry, J. (eds.) ACISP 1996. LNCS, vol. 1172, pp. 219–227. Springer, Heidelberg (1996) 3. Ferraiolo, D.F., Sandhu, R.S., Gavrila, S.: Proposed NIST Standard for Role-based Access Control. ACM Transactions on Information and System Security (TISSEC) 4(3), 224–274 (2001) 4. Damiani, E., de Capitani di Vimercati, S., Samarati, P.: New Paradigms for Access Control in Open Environments. In: Proceedings of the 5th IEEE International Symposium on Signal Processing and Information Technology, pp. 540–545 (2005) 5. Mohammad, A., Al-Kahtani, S.R.: A Model of Attribute-Based User-Role Assignment. In: Proceedings of the 18th Annual Computer Security Application Conference, pp. 353–362 (2002) 6. Priebe, T., Fernandez, E.B., Mehlau, J.I., Pernul, G.: A Patterns System for Access Control. In: Proceedings of the 18th Annual IFIPWG 11.3 Working Conference on Data and Application Security, pp. 25–28 (2004) 7. Berners-Lee, T., Hander, J., Lassila, O.: The Semantic Web. Scientific American 284, 34– 43 (2001) 8. Godik, S., Moses, T.: eXtensible Access Control Markup Language (XACML) Version 3.0. OASIS Standard (2008), http://www.oasis-open.org/committees/download.php/28318/ xacml-3.0-core-wd06.zip 9. Carmody, S.: Shibboleth Overview and Requirements. Shibboleth Working Group Document (2001), http://shibboleth.internet2.edu/docs/ draft-internet2-shibboleth-requirements-01.html 10. OASIS Standard. Security Assertion Markup Language (SAML) V2.0 (2005), http://docs.oasis-open.org/security/saml/v2.0/
702
H.B. Shen
11. Welch, V., Barton, T., Keahey, K., Siebenlist, F.: Attributes, Anonymity, and Access: Shibboleth and Globus Integration to Facilitate Grid Collaboration. In: Proceedings of the 4th Annual PKI R&D Workshop, pp. 19–21 (2005) 12. McGuinness, D.L., van Harmelen, F.: OWL Web Ontology Language Overview (2004), http://www.w3.org/TR/owl-features/ 13. Horrocks, I., Patel-Schneider, P.F., Boley, H.: SWRL: A Semantic Web Rule Language Combining OWL and ReleML (2004), http://www.w3.org/Submission/SWRL/ 14. Damiani, E., de Capitani di Vimercati, S., Fugazza, C., Samarati, P.: Extending context descriptions in semantics-aware access control. In: Bagchi, A., Atluri, V. (eds.) ICISS 2006. LNCS, vol. 4332, pp. 162–176. Springer, Heidelberg (2006) 15. Simple Object Access Protocol (SOAP) V1.1 (May 2000), http://www.w3.org/TR/2000/NOTE-SOAP-20000508 16. Protégé Editor and API, http://protege.stanford.edu/plugins/owl 17. Jess Rule Engine, http://herzberg.ca.sandia.gov/jess 18. Damiani, E., di Vimercati, S.D.C., Paraboschi, S.: Fine Grained Access Control for SOAP e-services. In: Proceedings of the 10th International Conference on World Wide Web, pp. 504–513 (2001) 19. Bhatti, R., Bertino, E., Ghafoor, A.: A Trust-based Context-Aware Access Control Model for Web Services. In: Proceedings of the IEEE International Conference on Web Services (ICWS 2004), pp. 184–191 (2004) 20. Xu, F., Xie, J., Huang, H., Li, X.: Context-Aware Role-Based Access Control Model for Web Services. In: Jin, H., Pan, Y., Xiao, N., Sun, J. (eds.) GCC 2004. LNCS, vol. 3252, pp. 430–436. Springer, Heidelberg (2004) 21. Liu, M., Guo, H.Q., Su, J.D.: An Attribute and Role-Based Access Control Model for Web Services. In: Proceedings of the 4th International Conference on Machine Learning and Cybernetics, pp. 1302–1306 (2005) 22. Demchenko, Y., Gommans, L.C.: Extending Role Based Access Control Model for Distributed Multidomain Applications. In: Proceedings of the IFIP TC-11 22nd International Information Security Conference, pp. 301–312 (2007) 23. Yuan, E., Tong, J.: Attributed Based Access Control (ABAC) for Web Services. In: Proceedings of the IEEE Conference on Web Services (ICWS 2005), pp. 561–569 (2005) 24. Shen, H.B., Hong, F.: An Attribute–Based Access Control Model for Web Services. In: Proceedings of the 7th International Conference on Parallel and Distributed Computing, Applications and Technologies, pp. 74–79 (2006) 25. Coetzee, M., Eloff, J.H.P.: A Trust and Context Aware Access Control Model for Web Service Conversations. In: Lambrinoudakis, C., Pernul, G., Tjoa, A.M. (eds.) TrustBus. LNCS, vol. 4657, pp. 115–124. Springer, Heidelberg (2007) 26. Damiani, E., de Capitani di Vimercati, S., Samarati, P.: New Paradigms for Access Control in Open Environments. In: Proceedings of the 5th IEEE International Symposium on Signal Processing and Information Technology, pp. 540–545 (2005) 27. Priebe, T., Dobmeier, W., Kamprath, N.: Supporting Attribute-based Access Control with Ontologies. In: The First International Conference on Availability, Reliability and Security (ARES 2006), pp. 465–472 (2006) 28. Warner, J., Atluri, V., Mukkamala, R., Vaidya, J.: Using semantics for automatic enforcement of access control policies among dynamic coalitions. In: Proceedings of the 12th ACM symposium on Access control models and technologies, pp. 235–244 (2007)
A Semantic-Aware Attribute-Based Access Control Model for Web Services
703
29. Shields, B., Molloy, O., Lyons, G., Duggan, J.: Using Semantic Rules to Determine Access Control for Web Services. In: Proceedings of the 15th international conference on World Wide Web, pp. 913–914 (2006) 30. Coetzee, M., Eloff, J.H.P.: A Logic-based Access Control Approach for Web Services. In: Proceedings of the ISSA 2004 Enabling Tomorrow Conference, Information Security South Africa, pp. 1–11 (2004)
A P2P Service Management Model for Emergency Response Using Virtual Service Pool Feng Yang, Hui Wen, Wei Cheng, Kangkang Zhang, and Peiguang Lin School of Computer & Information Engineering, Shandong University of Finance 250014 Jinan, China {Creyf,wenh,chengw,zhangkk,llpwgh}@sdfi.edu.cn
Abstract. Emergency response is a time critical work that needs teams cooperate with various specialties from different organizations. It also needs to integrate existing information system to collect and assemble necessary knowledge and resources for critical emerging tasks and use it for collaborative problem solving. The model presented in this paper is the main result of an on-going national science foundation project of china, called Emergency-Driven Virtual Organization (EDVO), which aims at building and developing an innovative software infrastructure (software, models, services, etc.) for supporting collaborative work of events handling in emergency response systems. The model is to describe all kinds of resources in unified semantics and make knowledge sharing among various systems possible. With this basis, related resources and services can be flexibly and dynamically organized as a virtual organization to handle different kinds of emergent events. Keywords: Ontology; Virtualization Pool; Virtual Organization; P2P.
1 Introduction Emergency service and emergency event handling is a modernization symbol of a city. With the acceleration of economics developing and constant expansion of city area in China, in recent years, government has begun to build Emergency Response Systems (just like 911 Dispatch Center in US, and 112 Dispatch Center in Europe) in lots of cities to deal with various possible emergencies [1]. When handling an event in a city, people should focus on the task of integrating, conforming and scheduling heterogeneous, distributed resources from multi-domains, as well as sharing knowledge among different organizations. The Emergency Response Systems cannot be realized if there is no good internal information systems in departments of government or the systems cannot be integrated effectively [2]. As the development of E-Government, we can see that, data integration, resources sharing and collaborative work are choke points which restrict the sustainable development of Emergency Response Systems in E-Government, also they are the most important aspects of the construction of present Emergency Response Systems. In conventional service modes, every department of government do its business in its own way, enterprises have to contact with several departments to transact an examination and approval affair, it’s so inconvenient to the public (as shown in Figure. 1). A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 704–714, 2009. © Springer-Verlag Berlin Heidelberg 2009
A P2P Service Management Model for Emergency Response
Information system A
services of hospital A
Information system B
services of hospital B
Information system C
services of hospital C
705
Emergency response system
Information system D
services of hospital D
Fig. 1. Traditional Service Model, in which the user has to query, search and visit the services respectively. In this model, the business process of emergency medicine systems requires the novel events handling mechanism to merging the “information islands”.
The fashion of organizing the cross-organization resources and services is key problems in emergency response systems compared with Grid and Web services. The complexity of events handling requires configuring resources unpredictably, demands services dynamically from heterogeneous systems and re-organizes temporarily the scalable systems, which will been cancel when the events have been handled. In order to meet the situation of present Emergency Response Systems and the construction of service distribution, we put forward building a service Model, EDVO (Emergency Driven Virtual Organization) based on ontology and peer-to-peer (P2P) structure, it can realize the sharing and integration of government affairs’ services and data resources which is shown to the public in a unified appearance and can realize virtual coordinating, distributed management.
2 Related Researches At present research on knowledge sharing based on ontology [3] is still at an elementary stage. The Knowledge Sharing Effort (i.e. KSE) [4] which was initiated by DARPA and Stanford University join in researching artificial intelligence and knowledge sharing. John Davie, Alistair Duke and other researchers constructed a knowledge sharing system for a virtual community based on the system Ontoshare[5], which uses RDF as the ontology description language. The TOVE Ontology Project [6] is yet another project on knowledge sharing using ontology which was initiated by the Enterprise Integration Laboratory of Toronto University. The aim of the TOVE project was to establish a suite of integrated ontologies for commerce and public enterprise modeling. Alexander Maedche, Boris Motik and other researchers brought
706
F. Yang et al.
out some issues concerning the use of ontology in enterprise knowledge management in the “Ontologies for Enterprise Knowledge Management” [7]. The project also established rules and methods in managing ontological evolution. So, research into enterprise knowledge sharing has been mainly about how to establish a knowledge sharing mechanism inside an enterprise. More and more organizations are looking at virtual organizations to address critical resource, personnel and logistical issues. There are many definitions of virtual organizations[8, 9, 10]. In summary, a virtual organization is a form of cooperation involving companies, institutions and/or individuals delivering a product or service on the basis of a common business understanding. The units participate in the collaboration and present themselves as a unified organization. In fact, VO is a solution other than a concrete technology. It is supported by a serial of technologies such as the Internet and the World Wide Web, Collaborative technologies, knowledge management, telecommunications, electronic mail, groupware, and video conferencing etc. In open Internet environment, it is inevitable that multiple ontology’s coexist. Centralized service discovery mechanism becomes the bottleneck of SOC (service oriented computing), which results in poor scalability of system. Aiming at solving these problems, the work [11] proposed a two layered P2P based model for semantic service discovery. The model is based on ontology community and integrates iVCE (Internet-based virtual computing environment) core concepts into a P2P model. Based on this model, a service discovery algorithm composed of two stages and three steps is proposed. It matches services across communities as well as within community. Within a community, algorithm locates registers holding service information with a high probability of satisfying a request firstly. Then it captures semantic matching between service advertisements and service requests by logical reasoning. Service discovery across communities occurs according to some policies. Based on the characteristics of evolution, autonomy and diversity of Internet resources, researchers recently proposed to realize the publication and query of Internet resource information through common DHT (distributed Hash table) information services. However, current research on resource information services is insufficient in generality, usability and adaptability. Aiming at the needs of iVCE (Internet-based virtual computing environment) for resource aggregation, the work [12] proposed a scalable distributed resource information service to construct the adaptive DHT, which supports to adapt to different system scale and stability transparently and it is an efficient multiple-attribute range query algorithm. We also proposed a new lookup algorithm [13] that adjusts itself to provide the best performance across a range of lookup delay and churn rates using a distributed hash table (DHT) with N nodes must choose a DHT protocol from the spectrum between O(1) lookup protocols and O(logN).
3 Emergency Driven Virtual Organization Model There is a hierarchical structure with three levels in EDVO, as shown in figure.2. The fundamental layer implements the services organization and discovery in form of P2P architecture, in which the services construct a service overlay by using DHT and contracture P2P, called Service overlay.
A P2P Service Management Model for Emergency Response
707
Business Process
Virtual Service Pool
Service Overlay
Service Quotation
Biding
Cloud Service
Business Activity
Service Resource
Fig. 2. The architecture of EDVO. Service overlay is constructed by P2P overlay, in which the service management provided O(logN) discovery delay with DHT. Attribution of services is descripting using ontology and service composition is achieved in virtual service pool. Business process on-demand is realized finally in top level supported by other layers.
The second layer shows the semantic information of services in fundamental layer, in which function similar services according to consumer’s functionality requirements are dynamically aggregated as a service pool, called virtual service pool. The pool will act as a virtual service so that consumers only discover and subscribe the service pool instead of a large number of candidate services. The top layer is business process one, which descript and execute real-time user process. Detail work on the business process layer is explored, which includes the definition of formal business rule, reference to resources in a rule of the rule system. 3.1 Business Process On-Demand Layer As shown in Figure.3, the EDVO model has an open architecture. The resources (various systems) of the virtual organization can be adjusted dynamically according to the emergent events. All the resources are described with unify semantics through an ontology which makes knowledge sharing among various systems possible. We can illustrate the work process of EDVO through a case study. For example, the emergency response system is prepared to treat an evacuating problem of people after a large scale meeting (such as the opening ceremony of the Olympic Games). Its work flow can be the following: 1. Make certain the main object (problem domain) of EDVO, for example, evacuating people after the opening ceremony of the Olympic Games;
708
F. Yang et al.
Public transportation Law forcing system Emergency response system
Service Management Model based on P2P Overlay
Fire Fighting system
Medicine emergency center
Fig. 3. EDVO Model in emergency scenario. The event is spreading in short time caused by traffic jam and the process handling is shifting in according with services joining and quitting.
2. Make certain the constructing policies of EDVO in according with various information such as decision supporting information from other systems, related application systems and commands from ITS (Intelligent Transportation System) center etc; 3. Select resources for EDVO based on the policies. These resources include seats of call taking and dispatch units and resources from other related systems; 4. EDVO enters the running phase; 5. Destroy the VO after the event being smoothly dispatched. The above process is the normal workflow of EDVO which can be illustrated through figure.4. In the figure we select a scenario that some people need medical services. But this workflow may not running normally all along. There are two type of abnormal situations may come up frequently: 1)if the event call keep increasing and current resources are not sufficient, EDVO can seek for more resources and include them into the VO; 2)if the event is much serious, EDVO may not be able to handle with current types of resources and services. In this situation, the event goes beyond the constructing policies of current VO. The EDVO then reconsiders the constructing policies and rebuilds the VO. Let’s restudy the scenario showed in figure 3. In situation 1, the solution is easier. We need only add a couple of messages between EDVO service and hospital service to “Seek For More Hospital Resources” (because of the length limit of the paper, we don’t provide figure for this situation since it is easy); In situation 2, for example, if a serious casualty event occurs and available ambulances are not enough. According to the emergency response plan, public transportation can be adopted as supplement to ambulance. Then the policies of VO are updated (public transportation can be included) and the VO is rebuilt (resources and services are included). Part of the flow is shown in figure.5.
A P2P Service Management Model for Emergency Response 0HGLFLQH HYHQW
('92VHUYLFH OD\HU DVN)RU+HOS
709
VHULYFHRI KRVSLWDO
&ROOHFWLRQ,QI2I+RVSLWDOV5HVRXUFH UHSO\ &KRLFH+RVSLWDO %RRN0HGLFDO5HVRXUFH 5HSO\2I%RRNLQJ
5HVSRQVH2I$VN)RU+HOS 1RWLILFDWLRQ)RU$PEXODQFH 1RWLILFDWLRQ2I'HOLYHU3DWLHQW &RQILUPDWLRQ2I5HFHLYH3DWLHQW 8SGDWH3DWLHQW&RQGLWLRQ 'LDJQRVLV
8SGDWH3DWLHQW&RQGLWLRQ 5HFRUG 5HFRUG 8SGDWH3DWLHQW&RQGLWLRQ 5HFRUG 7DNH&DUH2I3DWLHQW 3DWLHQW/HDYH+RVSLWDO )LQDO8SGDWH3DWLHQW&RQGLWLRQ )LQDO5HFRUG
Fig. 4. Business process of top layer in EDVO. In this system, the EDVO is deployed in the form of middleware. Services fitting demands would be not discovered or increased delay if lacking of service descript and management based on semantic.
3.2 Virtual Service Pool Plenty of services will be involved to deal with a emergency event as shown in figure.2. It is important to discovery and subscript service and resource as much short as possible. In current web service, consumers must pay too much time on manually selection and cannot easily benefit from the wide QoS spectrum brought by the proliferating services. The service pool was introduced as a “virtual service” grouping function identical services together and dispatching consumer requests to the proper service in terms of QoS requirements [14]. The work [14] described a novel construction method of virtual service pool. In this paper, we introduced this work to implement virtual service pool of EDVO. As similar with this work, virtual service pool of EDVO is to simplify consumers’ work to discover and subscribe their desired service while satisfying their desired QoS., which is not necessary to list so many candidate providers to the consumers they must browse, select and execute directly. These candidate providers can be clustered as a “virtual provider” that alleviates consumers from the time consuming and tedious
710
F. Yang et al.
0HGLFLQH HYHQW
6HUYLFHRI +RVSLWDO
('92VHUYLFH OD\HU DVN)RU+HOS
6HUYLFHRISXEOLF WUDQVSRWDWLRQ
&KHFN$QG5HEXLOG3ROLFLHV $FTXLUH1HZ7\SH2I5HVRXUFHV &RQILUPDWLRQ &ROOHFWLRQ,QI2I+RVSLWDOV5HVRXUFH &ROOHFWLRQ,QI2I3XEOLF7UDQV5HVRXUFH 5HSO\ 5HSO\ &KRLFH+RVSLWDO &KRLFH3XEOLF7UDQSRWDWLRQ %RRN0HGLFDO5HVRXUFH %RRN3XEOLF7UDQVSRWDWLRQ5HVRXUFH 5HSO\2I%RRNLQJ 5HSO\2I%RRNLQJ
5HVSRQVH2I$VN)RU+HOS 1RWLILFDWLRQ)RU9HKLFOH 1RWLILFDWLRQ2I'HOLYHU3DWLHQW 1RWLILFDWLRQ2I'HOLYHU3DWLHQW &RQILUPDWLRQ2I5HFHLYH3DWLHQW &RQILUPDWLRQ2I5HFHLYH3DWLHQW
Fig. 5. Part of the workfow of EDOV service layer in abnormal situation. In this architecture, virtual service pools is introduced to implement the service aggregation and matching, which is service of hospital.
selection work: they do not have to view, select and bind to every provider manually, instead, there will be only one service provider serving in a multi-tenancy way. Using the experience of this work for reference, we represent the construction method to virtual service pool. 1. Service aggregation: Here we get a set of similar services through computing functionality similarity, denoted as S=. 2. Service catalog: We use an important feature in web service specification is “domain key” to filter the services into the same domain (e.g., stock services), denoted as SP=, where m≤n. 3. Generate the pool WSDL. Then we sort the services in the pool by computing their cohesion value to the input/output that the consumer uses to search. 4. Semantic similarity function: Given two concepts, S1= and S2=, semantic similarity is defined between S1 and S2 .as shown in equations 1. ⎛ n sim ( s 1 , s 2 ) = Max ⎜⎜ ∑ ⎝ i =1
m
∑ sim ( s j =1
1i
⎞ , s 2 j ) ⎟⎟ / Min ( n , m ) ⎠
(1)
A P2P Service Management Model for Emergency Response
711
3.3 Service Overlay Based on P2P In order to meet semantic demand from virtual service pool, peers must been semantically organized into semantic overlay, the system purposefully forwards the query to destination semantic overlay according to its semantic information. But the P2P overlay in recent connect loosely with each other, the system can not quickly and accurately forward a query to other semantic similar overlay when one overlay fails to meet the needs of the query, thus it is difficult to further improve search efficiency. We proposed a semantic discovery method based on P2P in service overlay, which described detailed as in follow.
4 Semantic Service Discovery Model This section proposes a P2P service management infrastructure, Peer Service Management Infrastructure (PSMI), which is based on SOA and Web Service registries. The primary goal of PSMI is to provide an efficient global publication subscribing and discovery service in a Virtual Organization based on publish-subscribe model. Moreover, PSMI provides a web-based interface using Web Service Registry (WSR) that is a special rendezvous with Web Service function. We have structured the PSMI as three layers: Web Service Registry (WSR), three kinds of services and the Service Type based Classification of Index (SCI). 4.1 Classification of Index Based on Ontology In PSMI, rendezvous just maintain a single index of service advertisements published by their edge peers. SCI uses multiple indices of service advertisements distinguished by service type based on ontology. When a peer consumer initiates a request to discover a type of service, the corresponding index of this type is selected from all indices and then PSMI is used to look for peers or other rendezvous. Rather than searching all services registered in a single index, SCI rejects many irrelevant peers included in other indices. As a result, bandwidth of the uninvolved peers is saved, especially some slow peers that are excluded from the searching domain. We use protégé developed by Stanford University as ontology editing tools. The interface style of protégé is consistent with windows application style, and ontology structure is shown in tree hierarchy structure. So it is easy to use. Base on the logical relation shown in figure2., we complete the emergency plan ontology model by clicking relevant items to produce or edit class subclass property individuals and so on. At present, protégé supports XML, RDF, OWL and other ontology languages, and this paper describes emergency plan ontology formally in owl, parts of the code are as follows: The definition of emergency events class by OWL based on ontology
< owl:Class rdf :ID =" Emergency_Events "> < rdfs: subClassOf rdf:resource ="http :/ / www. w3. org/ 2002/ 07/ owl # Thing"/ > < rdfs:subClassOf > The adding of emergency events property:
712
F. Yang et al.
The adding of subclass: < owl:Class rdf:about =" # Sbject"> < / owl :Class > …… Through studying the process of constructing the owl emergency ontology, we assume that our method of ontology construction can be divided into 3 separate levels: 1. The acquisition of real domain knowledge; 2. Knowledge conceptualization, extracting concepts from real knowledge system; 3. Knowledge formalization, converting the domain knowledge into computer instruction statement possible form. The hierarchical idea makes every step with independent and clear objective, at the same time, directs us to perfect ontology in application and improve ontology construction method in the future. 4.2 Semantic Discovery Algorithm Furthermore, in order to address the problem of “lookback” caused by excessive propagation of requests, a Time To Live (TTL) attribute (hop count) is made to specify the maximum number of times the request can be forwarded. And we have also defined other attributes for describing the services. Except for TTL has been described above, the Expiration attribute defines the expiration days of a peer service, which means this service is considered valid if expiration is not equal to zero. An expiration of “zero” means that advertisement of this service will be refreshed or be eliminated in the index. The next attribute for the service is the QoS. As an example, we have considered three levels: A, B, and C, corresponding to delay-sensitiveness, throughput-sensitiveness, and loss-sensitiveness, respectively. The third attribute refers to the security of a peer service because some services may require the use of a secure protocol and authentication. By combining these attributes, large number of peer services that do not correspond with consumer’s request and old dead peers (according to expiration) may be excluded from the selected index. As an Interface between PSMI and applications, Web Service Registry (WSR) is a special rendezvous that supports Web Service function. Any peer that needs service can access the WSR to get such index of service advertisements. It has the following advantages to use WSR: Web services usually live at pretty well known URLs and static IP address and ports. WSR is a portal to any peer, including the indices of services that are exchanged with one or more rendezvous. In three kinds of service that PSMI offers, discovery service may be used popularly. This is followed by description of the algorithm for discovery service.
A P2P Service Management Model for Emergency Response
713
When an service query is issued from Peer A, the query is sent to Peer A’s WSR and this algorithm will be run as follow: 1. WSR checks at first whether there is an index of this service type. If it has, it searches the index with attribute provided by query and forwards the query to matching edge peers. These edge peers will directly send their detailed advertisements to Peer A. 2. WSR revises some attributes of query, such as TTL. The Zero of TTL means the end of query. 3. If TTL is more than Zero, WSR chooses its neighbors that include the index of this type according to the algorithm of SRDI. 4. And it propagates the query to these WSR. When the query reaches the next WSR, this algorithm will be retrieved from 1. to 4.
5 Conclusions The Emergency-Driven Virtual Organization model is proposed to implement service virtualization, service semantic denotation, and process on-demand, which can solve the problems of “Information Island” and sharing cross-organization. It also will be built flexibly and dynamically according to different kinds of emergent events. This work was supported by the National Nature Science Foundation of China (60603070), and the Doctor Research Foundation of Shandong University of Finance.
References 1. Mecella, M., Angelaccio, M., Krek, et al.: WORKPAD: an Adaptive Peer-to-Peer Software Infrastructure for Supporting Collaborative Work of Human Operators in Emergency/Disaster Scenarios. In: Proc. of Intl. symposium on collaborative technologies and systems, CTS 2006, vol. 14-17, pp. 173–180 (2006) 2. Yi-qiang, Z., He-qing, G., Wei, G.: Workflow Model for Government Process. Journal of South China university (Natural Science Edition) 33(5), 48–52 (2005) 3. Gruber, T.: Towards Principles for the Design of Ontologies Used for Knowledge Sharing. International Journal of Human-Computer Studies 43(5/6), 907–928 (1995) 4. KSE, http://www-ksl.stanford.edu/knowledge-sharing/ 5. Davies, J., Duke, A., Sure, Y.: OntoShare-An Ontology-based Knowledge Sharing System for virtual Communities of Practice. J. UCS 10(3), 262–283 (2004) 6. TOVE, http://www.eil.utoronto.ca/enterprise-modelling/tove/ 7. Maedche, A., Motik, B., Stojanovic, L., et al.: Ontologies for enterprise knowledge management. IEEE Intelligent System 18(2), 26–33 (2003) 8. Norton, B., Smith, C.: Understanding the Virtual Organization, Barron’s, Hauppauge, New York (1997) 9. cvw.sourceforge.net. Collaborative Virtual Workspace Overview, MITRE Corporation, http://cvw.sourceforge.net/cvw/info/CVWOverview.php3 10. Norton, B., Smith, C.: Understanding the Virtual Organization, Barron’s, Hauppauge, New York (1997) 11. Zhi-Zhong, L., Huai-Min, W., Bin, Z.: A Two Layered P2P Model for Semantic Service Discovery. Journal of Software 18(8), 1922–1932 (2007)
714
F. Yang et al.
12. Yi-Ming, Z., Dong-Sheng, L., Xi-Cheng, L.: Scalable Distributed Resource Information Service for Internet-Based Virtual Computing Environment. Journal of Software 18(8), 1933–1942 (2007) 13. Feng, Y., Feng-Xia, L., Hong-Liang, Y., et al.: A Hybrid Peer-to-Peer Lookup Service Algorithm on Distributed Hash Table. Journal of Software 18(3), 714–721 (2007) 14. Huang, G., Zhou, L., Liu, X.Z., Mei, H., Cheung, S.C.: Performance aware service pool in dependable service oriented architecture. Journal of Computer Science and Technology 21(4), 565–573 (2006)
A Web 2.0 and Open Source Approach for Management and Sharing of Multimedia Data-Case of the Tzu Chi Foundation Jian-Hung Chen1 and Hsiu-Hsun Yang2 1
National Chi Nan University, Assistant Professor. 470 Dah Shieh Road, Puli, Nantou, 545 Taiwan, R.O.C.
[email protected] 2 Tzu-Chi Foundation, Section Director, Media Resource Center
Abstract. The Tzu-Chi Foundation is one of the largest philanthropy foundations in Taiwan, with millions of members spread around the world. The search and sharing of vast member-generated information which could be in audio, video, photographs and various text formats, has long been a complex issue. Recently this foundation conducted an experimental project tempting to tackle this issue with web 2.0 approaches. A web-based prototype integrated from open source web album and wiki platform was developed and trial ran. This paper will discuss the experience and implication of this experimental project in the online community and managerial context. Keywords: Web 2.0, Open Source, Wiki, Web Service.
1 Introduction The Tzu-Chi Foundation a non-profit organization founded in 1966 by Dharma Master Cheng Yen. The Foundation is a volunteer-based organization dedicated in the field of charity, medicine, education, environmental protection, as well as the promotion of humanistic values and community volunteerism. Starting with few disciples, the foundation developed into a multi-million member charity foundation within 40 years. The tremendous growth in the scale of this organization brought huge challenges to its organization structure, as well as its information technology (IT) infrastructures and information system architectures. Moreover, Tzu Chi volunteers living abroad began setting up overseas chapters since 1985. Today, Tzu Chi is an international organization with over 5 million supporters and over 30,000 certified commissioners around the world. As of August 2005, over fifty-seven countries in five continents have received Tzu Chi’s aid [1]. The Tzu Chi foundation constantly holds international relief and charity activities all over the world. Various formats of data are recorded from these activities or events, including photographs, video clips, event logs, etc. Currently these data are collected and managed by some centralized but isolated systems which are managed
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 715–720, 2009. © Springer-Verlag Berlin Heidelberg 2009
716
J.-H. Chen and H.-H. Yang
by different department in the foundation. For example, video data are managed by the Media Resource Center, and most pictures are uploaded to a platform developed by the Culture and Develop Department. The current information systems were mainly designed by the requirements of the headquarters. Under the current mechanism, different formats of recorded data of events have to be uploaded to several different systems, and accesses to the uploaded data are controlled by the different departments of headquarter. Complaints about the complexity of data management process prevailed, but the integration of the dispersed information systems are beyond the current capacity of the IT department. To tackle with this problem, the authors of this study started an experimental project on the management and sharing of member-generated multimedia data. Basing on the web 2.0 community concepts and the user-centered design, the development team selected the initial requirements of the Media Resource Center as a target. A first prototype was rapidly developed in one month by only one part-time volunteer, through the integration of two open-source platforms, MediaWiki and Gallery2. The prototype was tested and trial ran within the foundation. Results and experiences of the project are described and discussed in the following sections.
2 A Framework of Information Systems After several interviews to the Media Resource Center and some senior volunteers, the development team identified three necessary layers: the presentation layer, the linkage layer, and the data layer. The Data Layer represents the various information systems or
Wiki, Websites, and Searching Access Control & Interface Mechanism Multimedia Object Management Systems
Presentation Layer
Linkage Layer
Data Layer
Fig. 1. The layered framework of information systems
A Web 2.0 and Open Source Approach
717
databases that actually store and manage multimedia objects. The Linkage Layer represents the access control mechanism and bridging interfaces for various platforms to enable proper information flows across different systems. The Presentation Layer stands for possible interfaces the internal and external end users would encounter. Recently this foundation conducted an experimental project tempting to tackle this issue with web 2.0 approaches. A web-based prototype integrated from open source web album and wiki platform was developed and trial ran. This paper will discuss the experience and implication of this experimental project in the online community and managerial context. 2.1 The Integration of Open Source Platforms The development team chose an open source online album, the Gallery2 [2] platform, as the managing system for user contributed multimedia objects. The Gallery2 platform can handle most common image, audio, video, and text format file objects. The users can upload and manage their own multimedia objects through their own accounts. The system administrator can logically move verified objects into virtual albums which are open for either public or group/object base access. The management authority can be hieratically granted to certain users at certain directory level. For the sharing of large-sized videos, an interface module was developed to access publicly uploaded video in external web 2.0 video websites such as Google Video or YouTube. The users can upload their work to YouTube or the like and manage the links and adding metadata in the Gallery2 user interface. For those data that should not be open to the public, users still can upload and manage the files into the Gallery2 system directly. For the presentation layer, the online album is not appropriate for story-oriented contents. The development team found that the wiki-based application could satisfy the requirements for collective authoring and linking of knowledge and story-based information. The Mediawiki [3], which is adopted by the famous Wikipedia [4] website, was chosen by the develop team as the platform to integrate. However, the original Wiki’s user account and access control mechanism is too open for organizational requirement. The project wrote an interface which connected the access control mechanism with an outside LDAP (Lightweight Directory Access Protocol). The interface enabled the possibility to integrate the platform with many existing legacy systems in the Tzu Chi Foundation. The system architecture is illustrated in Figure 2 below. To integrate the presentation layer and the data layer, the project subsequently developed an object linkage interfacing module in the Mediawiki platform. The interfacing module (in Mediawiki term, an “extension”) provide an user interface in the wiki editing page that enables the user a tree-view based directory browsing interface with video/photo thumbnails to insert image/video into wiki pages. The integration architecture is illustrated in Figure 3.
718
J.-H. Chen and H.-H. Yang
Customized Access Control Interface Module
Customized Object Bridging Interface Module External Web 2.0 Websites (Google Video, YouTube)
Apache Web Server Gallery2 Album
MySQL Database
Mediawiki Wiki
LDAP Server
Other Information Systems or Databases
Fig. 2. The access control architecture
Presentation Layer Gallery2 User Interface
Mediawiki User Interface
Linkage Layer Gallery2 APIs Shot Scripts Extension
Mediawiki APIs Object Linkage Interface
Ext. Video Interface
Data Layer Shot Scripts (User contributed annotations)
External Web 2.0 Websites (Google Video, YouTube)
Fig. 3. The layered framework of integration
A Web 2.0 and Open Source Approach
719
2.2 The Web 2.0 Approach to Video Annotations and Re-Composition The tagging and searching for video data has long been a difficult issue. In the television industry, there exists a practice to annotate video data called shot scripts. For user contributed multimedia data, the web 2.0 concepts could be a solution to the tagging/indexing problem. The development team wrote an extension module for the Gallery2 platform, which enabled user to add annotations to any period of video while viewing/listening the video on the browser. The module uses the Windows Media Player Object combined with Javascript to achieve the playback and browser-side user interactions. The annotations made by all users can be searched through the full-text search interface of the Gallery2 system, and then to directly link to that annotated clip within few mouse clicks. Although the annotations (shot scripts) made by various users could be biased by every individual’s subjective perceptions and interpretations, the “given enough eyes, all bugs are shallow” law [5] entails that these biases could somewhat get balanced from user feedbacks in later time. A newer version of web 2.0 user annotation website is currently under development. Under the new architecture, a user can search user-annotated clips scattered over different video files, re-compose selected clips into an integrated virtual video clip on the fly, and playback on the client side browser over a HTTP video streaming mechanism. The system architecture is illustrated in figure 4.
User uploaded Video Clips
FLV MetaTag Parser User Annotations
Virtual Video-File Generator PHP CGI emulated as a virtual video clip
Apache Web Server Emulated Video Streaming over HTTP
Fig. 4. System architecture for online video editing and video streaming over HTTP
720
J.-H. Chen and H.-H. Yang
3 Results and Conclusion With the help of the open source platform, the first prototype system was established and put online by a part time volunteer in a month. After the trial run of 3 months by roughly 20 Tzu Chi members and volunteers, more than 20 thousand wiki pages and another roughly 20 thousand multimedia objects were generated/uploaded into the integrated platform. The functionality and stability of the system were recognized and highly appreciated by the users. The project described in this paper represents an experimental information development methodology which could be extremely efficient and flexible to satisfy dispersed interests among internal and external users. Through the integration of scalabilityproven open source platforms, an organization could promptly build up necessary information infrastructures that satisfy large portions of emergent requirements. Furthermore, the project also revealed that the integration of web 2.0 either conceptually or physically of web 2.0 websites could be an important direction of future information system development methodology, more research on this category are important and greatly encouraged.
References 1. http://www.tzuchi.org/global/about/index.html (accessed January 29, 2009) 2. http://gallery.menalto.com/ (accessed January 29, 2009) 3. http://www.mediawiki.org/wiki/MediaWiki (accessed January 29, 2009) 4. http://www.wikipedia.org/ (accessed January 29, 2009) 5. Raymond, E.S.: The Cathedral & the Bazaar. O’Reilly, Sebastopol (1999)
Adaptive Link Cost Reduction by Generic Topology Construction in Ad-Hoc Networks Reu-Ching Chen1 and Cheng-Min Lin1,2 1 2
Department of Program Management, Nan-Kai University of Science and Technology Department of Computer & communication Engineering, Nan-Kai University of Science and Technology No. 568, Jhongjheng Rd., Caotun Township, Nantou, Country 542, Taiwan (R.O.C.)
[email protected]
Abstract. Many works have been done on improving the performance of the ad-hoc networks, in which a stringent issue is concentrated on proper topology establishment with least link connections due to the cost considerations. In this paper, a generic method based on network topology design, called “the spider network topology” is proposed to achieve link cost reduction between distinct nodes communications in the modern ad-hoc networks. In our approach, the link cost reduction using the spider topology is compared with the complete graph topology [1] for ad-hoc networks (link is thought as the system resource for cost estimation in the following sections). Our contribution is concentrated on less total link cost as compared with the complete graph construction under the constraint that average connection links between distinct nodes is less than some constant. The spider network topology technique adopted in this paper is superior than other network topology in some conditions, especially when there are no clear relationship between node pairs for link constructions. The spider network behaves the advantage both in easy implementation and less congestion occurring. This characteristic will benefit on the system performance improving, especially in reliability guarantees. The new architecture presented here can be widely applied in topology design for the modern ad-hoc networks due to the efficient link constructions. Keywords: ad-hoc network, system resource, link, congestion, nodes.
1 Introduction In modern ad-hoc networks, much work has focused primarily on source-destination bandwidth requirements for different models and transmission schemes under the emphasis of delay guarantee. In such network, the cost for network bandwidth requirement is achieved as a tradeoff with transmission delay. Consequently, in this paper, the bandwidth requirement of the ad-hoc networks supporting delay sensitive traffic is studied. Traditional organization on real-time communication has the characteristics of infrastructure-based networks, in which a fixed infrastructure exists to facilitate their communications [4]. In modern wireless networks, a widespread availability of wireless communication has stimulated the research of self-organizing networks [2]. In A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 721–728, 2009. © Springer-Verlag Berlin Heidelberg 2009
722
R.-C. Chen and C.-M. Lin
which, ad-hoc networks are the most important applications. Ad-hoc wireless networks comprise a set of mobile nodes that communications are achieved between any pair of nodes. There is peer-to-peer interaction among nodes. Peer-to-peer communication has the benefits of fast transmission and simple implementation. Nevertheless, in wireless network environments, resource is precious and scarce, therefore it will be un-realistic when the total number of the nodes became large. In this paper, an economic scheme for ad-hoc network topology is deployed. Communication path is established from the source node to the destination node through links between nodes. The links constitute a wireless network, where the system performance is impacted by various pattern of the network topology. In [3] an algorithm is used for topology construction with minimum delay between source-destination nodes by the twopartite graph theory, in which the routing node is restricted to be no more than one. in [6] the bandwidth allocation is performed for optimal delay with various input traffic rates. In this paper, both of delay and bandwidth are considered to achieve optimal system cost. Topology creation in the ad-hoc networks includes two types: one is the static adhoc network, in which the position of the node is fixed; another one is the mobile adhoc network, in which the network topology is changed frequently according to the mobile position. Dynamically adjust the topology to satisfy both of the QoS (quality of service) and least cost become a challenging task. In our study, the cost caused from the bandwidth requirement and delay are summarized as the total system cost for optimal estimation. More or less links providing are not adequate to system design. Too much link providing is not economic (due to cost considerations); on the contrary, too less link providing causes system performance degraded (delay, throughput and blocking rate considerations). To achieve the QoS requirements and the same time avoid large amounts of resource exhausting, we develop the spider topology for node connections in ad-hoc network. To reduce the number of links of node pair connections, the nodes should be allocated properly according to their relations, e.g., frequent connecting nodes should be arranged in the region with nearest distance between pair nodes. In this paper only the link cost reduction is considered under the spider topology. The optimal policy for the node allocations is not presented with the limit space of the scope. The rest of this paper is organized as follows, section 2 describes the system model, section 3 depicted the cost reduction methods and section 4 is our conclusions.
2 System Model Descriptions Without loss of generality, we define the spider network has the symmetric characteristic as follows: i.e., for an (N, K) spider network, we mean the total number of layer is equal N and the total number of nodes in each layer is a constant and equal to K. It is noted from the symmetry property, the total number of edges (edge and link are used interchangeably in the following) in each layer is equal K and also the total number of edges between layers is K. For instance, Fig. 1 shows a three-layer spider network (i.e., N = 3) with eight nodes (i.e., K=8) located in each layer. It is noted, each layer in Fig. 1 contains eight nodes and the total number of link between adjacent layers is equal K. Consequently, if K is large enough, then a spider network
Adaptive Link Cost Reduction by Generic Topology Construction
723
containing the same number of nodes and edges can be deployed in our scheme. Therefore, the nodes spreading in ad-hoc networks are located in some layers of the spider network and the total number of nodes in each layer is a constant. For node-pair communications, assume each link between the adjacent nodes exhausts one unit of bandwidth for packet transmissions, then, the communication between the node-pair is accomplished by selecting a path from the source node to the destination node. For the aid of minimum delay requirement, the shortest path is prior selected for communications between source and the destination nodes.
Fig. 1. Spider network for N=3 and K=8
Without loss of generality, we assume one unit of bandwidth and one unit of delay is exhausted in one link for simplicity. This is reasonable since the distance between any adjacent nodes is small and can be assumed to be a constant. Eventually, reducing the total number of link will benefit on the system cost, however has a negative impact on the system delay. Form above, in convenience point of view, we consider an ad-hoc network with (N, K) spider topology consisting of NK mobile nodes, where N and K represent the total number of the layers and the total number of the nodes in a layer respectively. The traffic can be directly transmitted between any two nodes, or it can be relayed throughout intermediate nodes for communications.
3 Link and Delay Considerations Assume N layers are constructed and each layer contains K nodes. For example, Fig.1 indicates a (3, 8) spider network topology containing three layer and eight edges. Hence, in graph terminology, each node located at the first layer and the outmost layer has degree equal to three, and the each node located in the layers between the first and the outmost layer has degree equal to four.
724
R.-C. Chen and C.-M. Lin
In convenience, let the node numbered x at the layer y be denoted by n (x, y), in which 1 ≤ x ≤ K and 1 ≤ y ≤ N , then we have the following theorem. Theorem 1: For the ad-hoc network connected using the spider topology. Let the total number of nodes is v and the two distinct nodes located in layer i and j be labeled as p i and p j separately; also let the links needed for connecting nodes p i and
p j equal to q, then q is bounded by j − i ≤ q ≤ v under the constraint that no node can be reached twice in developing the path from
p i to p j .
Before proof, the definition of Hamiltonian cycle [1] is rewritten at here for employing. Definition: A cycle of a graph G containing every vertex of G is called a Hamiltonian cycle of G. Proof: the lower bound is trivial, the upper bound is proved from the fact that there is always existing a Hamiltonian cycle [1] in the spider network for distinct nodes. 3.1 Link Consideration For an N-layer with K nodes in each layer, there are (NK-1)NK/2 for complete graph network and only 2NK links are needed in the spider network. Obviously, the spider network organization is one order less than the complete graph network. I.e., the link cost using the spider toplology is much less than the complete graph topology. For example, in Fig.1, N and K equal to three and eight separately, then the total number of links equal to 48 for spider network and equal to 276 for complete graph network. Hence, the complete graph organization exhausts a significant amount of the system resources when N and K become large. In real applications, too much links exhausted is not acceptable. In system resource considerations, the reduction number in deploying the spider network is the main advantage as compared with the complete network graph. 3.2 Delay Considerations 3.2.1 Non-uniform Case (Transition Probability between Layers Is Not Fixed) We assume the traffic in uniform for each node pair communications and let the delay equal to d units for one link in convenience. Therefore, the average delay for each node pair communication in the same layer can be presented by dK/2 since the traffic in the same layer is assumed ergordic for simplicity in our study. Since more nodes deployed in one layer will provide less delay for communications between nodes, this fact indicates the relation between d and K can be expressed as
d = α/K where
α
(1)
is the proportional factor and is assumed to be constant in this paper.
Without loss of generality, we can assume that a connection is established for N times. Let the threshold for transition times between layers be equal to T, then
Adaptive Link Cost Reduction by Generic Topology Construction
725
1 ≤ N ≤ T . Let p1 denotes the probability that a connection path is established successfully in the same layer at the first time. In the same manner, let p 2 denote a connection path that is established successfully in the same layer at the second time. Therefore, p i indicates the i’th time a connection path is established successfully in the same layer. Let D denotes the average delay for one connection of a pair node, then the average delay for a connection can be obtained by the following formula: K K K + p 2 (1 − p1 )(1 + ) + p 3 (1 − p1 )(1 − p 2 )(2 + ) 2 2 2 K K + p 4 (1 − p1 )(1 − p 2 )(1 − p 3 )(3 + ) + ...p i (1 − p1 )(1 − p 2 )...(1 − p i −1 )(i − 1 + ) + ...] 2 2
D = d[p1
(2)
3.2.2 Uniform Case (Transition Probability between Layers Is Fixed) For fixed transition probability, we have p1 = p 2 = ... = p i ... = p , then Equation (2) can be expressed as follows:
K K K + p(1 − p)(1 + ) + (1 − p)(1 − p)p(2 + ) 2 2 2 K K + (1 − p) 3 p(3 + ) + ... + (1 − p) X p(X + )] 2 2 D = d[p
(3)
Hence, form the above equation, Equation (3) will be reduced to Equation (4) as follows when the magnitude of X is larger enough. i.e.,
D = d[
K 1− p + ] 2 p
(4)
Equation (4) depicts the average delay is a function of p. High value of p corresponds to small value of delay as desired since large value of p indicates high probability of communication occurred in the same layer. By inserting Equation (1) into Equation (4) we have
D = d[
K 1− p α α(1 − p) + ]= + 2 p 2 Kp
(5)
for fixed value of α , Equation (5) indicates the delay for communications between two nodes is inversely proportional to the total number of nodes in one layer, this is reasonable since the delay is a decreasing function of K from Equation (1). Therefore, more number of nodes deployed in one layer will benefit the delay between node communications, however the system cost is increased due to the increasing total number in one layer. In another aspect, the communication between nodes is proportional to the transition probability p of layers.
726
R.-C. Chen and C.-M. Lin
3.3 System Total Cost Estimations In this paper, we assume one unit charge cost is exhausted per unit delay for convenience. We also assume one unit fee cost is exhausted for one link construction. For simplicity, let both of the unit cost for delay and link are taken to equal C. Therefore from Equation (4) and Section 3.1, the total cost T can be indicated as following, i.e.,
α α(1 − p) T = C[ + + 2NK] 2 Kp
(6)
Let the variables in the right hand side of Equation (6) as constant except K and take the first derivative of Equation (6) due to K , we obtain the following relations for the optimal total cost, i.e.,
K=
α (1 − p) 2 Np
(7)
4 Numerical Results The total system cost for different values of transition probability are shown in Fig. 2 for p equal to 0.1. It is noted that higher value of p corresponds to lower value of total system cost. This is desired since p indicates the probability that the node will stay in the same layer. Fig. 3 shows the optimal total system cost exists for fixed value of layer number. Obviously, low transition probability corresponds to high total system cost as expected. Fig. 4 and Fig. 5 show the total system cost for proportional factor α equal to 1 and 10 respectively. Hence higher value of proportional factor corresponds to higher value of total system cost since delay is proportional to the proportional factor as indicated in Equation (1).
Fig. 2. Total system cost as function of nodes and layers for p=0.1
Adaptive Link Cost Reduction by Generic Topology Construction
Fig. 3. Total system cost as function of nodes for N=10, p=0.3
Fig. 4. Total system cost for proportional factor=1, N=10, p=0.8
Fig. 5. Total system cost for proportional factor=10, N=10, p=0.8
727
728
R.-C. Chen and C.-M. Lin
5 Conclusions In this paper, a new construction called spider network is proposed for ad-hoc communications. Both of link cost and delay are compared with the complete graph topology. The total links needed for the node connections are improved by spider topology. Under applying the spider topology for node connections, the link cost is effectively reduced and the total connection links for distinct nodes is also constraint by the value of the order (the order of a graph equals the cardinality of the vertex set of the graph [1]). The average delay is a function of the layer transition probability and the total number in one layer. The future challenge will concentrate on searching more generic topology for node connections to achieve optimal performance. The contribution of our method is concentrated on link cost reduction and simple implementations. This scheme can be extensively applied to any resource managements especially in ad-hoc networks.
References [1] Chartrand, G., Lesniak, L.: Graphs and Diafraphs (1986) [2] Chakrabarti, S., Mishra, A.: QoS Issues in Ad-hoc Wireless Networks. IEEE Communications Magazine 39(2), 142–148 (2001) [3] Chen, R.-C., Lee, W.-T., Lin, J.-M.: Optimal Delay Estimation Using Complete Bipartite Graph Method for VoIP over WLAN Environments. Advanced Engineering Informatics 20(4), 433–441 (2006) [4] Carzaniga, A.: Design and Evaluation of a Wide-Area Event Notification Service. ACM Transactions on Computer System 19(3), 332–383 (2001) [5] Tuduce, C., Gross, T.: Organizating a Distributed Application in a Mobile Ad-hoc Network. In: Proceedings of the second IEEE International Symposium on Network Computing and Applications (2003) [6] Chen, R.-C., Lee, W.-T., Lin, J.-M.: Optimal Bandwidth Allocation in VoIP Latency Guarantee. Journal of Information Science and Engineering 20(5), 869–884 (2004) [7] Bowstron, A., Druschel, P.: Pastry: Scalable, Decentralized Object Location, and Routing for Large-Scale Peer-to-Peer System. In: Guerraoui, R. (ed.) Middleware 2001. LNCS, vol. 2218, pp. 329–350. Springer, Heidelberg (2001) [8] Sinha, P., Sivakumar, R., Bharghavan, V.: Enhancing Ad-hoc Routing with Dynamic Virtual Infrastructures. In: Proc. IEEE INFOCOM 2001, April 2001, vol. 3, pp. 1763–1772 (2001) [9] Chatterjee, M., Das, S.K., Turgut, D.: WCA: A weighted clustering algorithm for mobile ad-hoc networks. Cluster-Computing 5, 193–204 (2002)
An Efficient Data Dissemination Scheme for Sensor Networks Po-Jen Chuang and Bo-Yi Li Department of Electrical Engineering Tamkang University Tamsui, Taipei County Taiwan 25137, R.O.C.
[email protected]
Abstract. Disseminating data from sources to sinks is a very important application in sensor networks. This paper presents a new data dissemination scheme which uses the concept of the Fermat Point to construct a dissemination tree from one source (the root) to multiple sinks (the leaves). By sending data along the dissemination tree, the new scheme can conserve transmission energy, avoid collision and as a result reduce transmission delay. When sinks move, the proposed scheme can also adjust the dissemination tree topology to achieve high performance. Simulation runs are conducted to evaluate the performance of our new scheme and other related schemes including the Two-Tier Data Dissemination (TTDD) and the DElay-constrained minimum-Energy Dissemination (DEED). The collected result shows that our scheme can send data from a source to several sinks in more efficient way and as a result save more transmission energy and time than the other two schemes.
1 Introduction A sensor network usually contains hundreds or thousands of unattached tiny sensor nodes which are often deployed by such equipments as missiles or airplanes to areas under observation or investigation. After being deployed, sensor nodes start to collect the target environmental data (either acoustic, visual or seismic measurements), communicate with one another to form a self-organized network and then send the collected data to some static or mobile end users (the sink). Recent advances in micro electrical-mechanical systems (MEMS) which help reduce the cost and sizes of processors, memory and transceivers, have made producing cheap and micro sensors possible. With the progressively growing topology of a sensor network, the scope of its applications widens and diversifies. Today sensor networks are gaining more and more importance due to their increasing employment in a variety of fields (military, medical, environmental, industrial, etc.). The performance of a sensor network is nevertheless subject to its limited energy resource. Sensors, which are charged by batteries [1], are often deployed to nonaccessible or polluted areas and therefore hard to get recharged after deployment. Given that recharge is likely, the huge number of sensors also makes it inefficient. Solar energy has been proposed to prolong the lifetime of deployed sensors [2], but it A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 729–740, 2009. © Springer-Verlag Berlin Heidelberg 2009
730
P.-J. Chuang and B.-Y. Li
is possible only for certain environments and will add extra cost. Energy conservation has always been a basic and major issue in applications of sensor networks. The main goal of this paper is to find an efficient way to disseminate data in wideranged sensor networks so as to attain desirable data transmission at reduced energy cost. Fig. 1 shows an example of data dissemination in the sensor network. In data dissemination, each sensor node will survey its neighboring area for the target “phenomenon”. When the target phenomenon appears, one of the nodes surrounding it will become the source and periodically send the observed data to the remote sink(s) for data analysis. To save the limited power of the sensor nodes, a source should first locate an appropriate branch node (say b) and then send the data to b and from b to the multiple sinks hop by hop – in 9 hops as Fig. 1(b) shows. Fig. 1(a) gives a different transmission approach in which the source takes a total of 10 hops to send the data directly and respectively to sink1 and sink2. As energy conservation plays a dominating role in the performance of a sensor network, Fig. 1 reveals clearly that with multiple sinks in the topology, it will be more favorable to find an appropriate branch node (e.g., node b in Fig. 1(b)) to achieve more efficient data dissemination and transmission.
Fig. 1. The multi-hop transmission of a sensor network
Based on the concept of the Fermat Point [3], this paper introduces a new and efficient data dissemination scheme which will locate an appropriate branch node as the point to disseminate data separately to multiple sinks. The Fermat Point is as defined: For any triangle, we can find a point that holds the shortest distance to the three vertices and will fall within the triangle when its largest angle 120°. (When a triangle has an angle greater than 120°, the Fermat Point will be located at the vertex of the obtuse angle.) The following three steps will lead us to the Fermat Point of a triangle whose larg120°, also illustrated in Fig. 2: est angle 1. Construct three new triangles (in dotted lines) out of the three sides of a given triangle (in solid lines). 2. From each vertex of the given triangle, draw a line (in dashed lines) to the opposite new triangle's vertex. 3. These three (dashed) lines will intersect at the Fermat Point. In our new data dissemination scheme, when a new sink joins the network, it will first select a suitable node as its agent to send out requests to all the source nodes. Each source node then locates a suitable line segment in its dissemination tree, uses the line segment and the new agent to form a triangle, and find the Fermat Point of the
≦
≦
An Efficient Data Dissemination Scheme for Sensor Networks
731
Fig. 2. The forming of a Fermat Point
triangle. The node closest to the Fermat Point is then taken as the branch point from which data will be sent to the ordinary dissemination tree and the new agent. The operation of our new scheme requires only adding new agents to the dissemination tree. It involves very slight change in the original tree topology. In fact, utilizing the concept of the Fermat Point to locate suitable branch nodes for data dissemination -which ensures data to be transmitted by the shortest path to all sinks -- not only saves the limited energy resources but also prolongs the lifetime of a sensor network.
2 Backgrounds The following are our assumptions for the sensor network in this paper: 1. The sensor network consists of a massive amount of sensor nodes which are randomly distributed in the network. Sensor nodes, unable to move and charged with limited power, are capable of transmitting data to neighboring nodes. Longdistance transmissions will be conducted hop by hop. 2. Each node in the network is aware of its own location, which is essential for figuring out the Fermat Point. To reduce the attached cost, we may allow some nodes to have GPS while others to find their location by recursive triangulation [4]. Or we can spread some reference points in the network with overlapping regions of coverage transmit periodic beacon signals, and other nodes localize themselves according the beacon it received [5]. 3. When the target phenomenon occurs, one of the sensor nodes surrounding the phenomenon will become the source to send data periodically to each sink. We choose the hop-by-hop, instead of the long-distance, transmission as the data routing approach in this paper. Because sensor nodes are uniformly distributed, the hop count of a transmission is assumed proportional to the transmission distance and each hop will consume the same amount of energy. That is, the longer the distance, the more hops and energy consumption will be needed. Based on this, energy consumption for a transmission is also assumed proportional to the transmission distance. Such an assumption helps justify the key proposal of this paper: Using the Fermat Point to simplify the transmission route and to save the required transmission time and energy.
3 The Proposed New Scheme The operation of our new data dissemination scheme contains the following 4 steps: agent searching, line segment searching, new route replacement and agent replacement.
732
P.-J. Chuang and B.-Y. Li
• Agent Searching: When a new sink is added to the network, it will first find a node to be its agent and the agent will send requests to all sources asking (on behalf of the new sink) to join their dissemination trees. • Line Segment Searching: Each source will locate a line segment in its dissemination tree. • Route Replacement: Move the located line segment away from the dissemination tree. Use its two end points and the new agent’s site to compute the location of the Fermat Point. The node nearest to the obtained Fermat Point will be set as the branch node to send data respectively to the original dissemination tree and the new agent. • Agent Replacement: When a sink moves, to keep the original agent or to find a new agent (i.e., to extend the original route or to construct a new route) will be decided according to different situations. 3.1 Line Segment Searching • Fig. 3 illustrates how a dissemination tree evolves when the number of sinks grows. • Fig. 3(a): Source node s sends data to agent x only. • Fig. 3(b): When a new agent y sends a request to s, s will find a line segment (between itself and agent x, the only segment in the dissemination tree for this case), delete the segment, use the two end points of the segment and the site of agent y to compute the location of the Fermat Point (of s, x and y) and take the node closest to the Fermat Point as the branch node (b1). Then set a route from s to b1 and two routes from b1 respectively to the old agent x and to the new agent y. (Note that if the angle between x and y is greater than 120°, s itself will become the branch point.) • Fig. 3(c): Agent z (for a new sink) appears and sends a request to source s. • Fig. 3(d): After receiving the query from z, s repeats the same searching process to locate a suitable line segment (s to b1), the Fermat Point (of s, b1 and z) and the new branch node (b2). Now s will send data to b2 first and from b2 separately to b1 and z. Fig. 3 shows that there are two ways to decide a transmission path: 1. In such specific situations when there is only one agent or two in the network, we can take the following simpler algorithm (executed by the source only) to decide the transmission route.
Fig. 3. The dissemination tree
An Efficient Data Dissemination Scheme for Sensor Networks
733
The simple dissemination tree construction 1 2 3 4 5 6
procedure LSS (new_agent ) { if (The tree is not constructed yet) Directly make a connection to the new_agent else if (I have only one agent a1) // the line segment is from the source to a1 }
2. When a source receives a request from a third agent, it needs to employ a more sophisticated Line Segment Searching (LSS) Algorithm to find the suitable line segment in its dissemination tree. The algorithm will first be run in the source and then passed to the stream nodes. After the line segment (which has no fork) is decided, it will be deleted from the dissemination tree to construct a desired new transmission route as Fig. 3(b) and Fig. 3(d) illustrate. In the LSS Algorithm, MY_ID is the ID of the node executing the algorithm, d(A, B) is the distance between nodes A and B, Seg_Start indicates the start of the segment and the initial Seg_Start is the ID of the source. The Line Segment Searching (LSS) Algorithm 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
procedure LSS (Seg_Start, new_agent ) { if (I am a branch node) { find (k which is my downstream or upstream with the shortest d(k, new_agent)) if(k is my upstream) // the line segment is from Seg_Start to MY_ID else { if ( k has only one downstream node) //the line segment is from MY_ID to the end of the segment else { Seg_Start= MY_ID ask k to run LSS(Seg_Start, new_agent) } } } else ask my downstream to run LSS(Seg_Start, new_agent) }
For better understanding, an example of executing the LSS Algorithm to construct the dissemination tree is given in Fig. 4. • Fig. 4(a): A new agent a3 joins the network. All nodes (including the source) that are not branch nodes will execute line 14-15 of the algorithm until reaching b1. The LSS Algorithm is then passed to b1. Branch node b1, which has two
734
P.-J. Chuang and B.-Y. Li
Fig. 4. An example of constructing the dissemination tree using the LSS Algorithm
• •
• •
•
downstream nodes, will find a node with the minimum distance to a3 among the downstream and upstream nodes. In this case, as the nearest node is the downstream node to agent a2 and there is no fork along the way, the line segment from b1 to a2 is thus located (lines 6-8 of the algorithm). Fig. 4(b): The dissemination tree with 3 agents (a1–a3). Fig. 4(c): When another new agent, a4, joins the network, all non-branch nodes again will execute the LSS Algorithm until reaching b1. b1 then finds a node with the minimum distance to a4 among the downstream and upstream nodes, which turns out to be b2 in the case. As b2 has two downstream nodes, the algorithm will be passed to b2 (lines 9-12 of the algorithm). After executing lines 2-3 and 6-8 of the algorithm, b2 will choose the line segment from itself to a2 and combine the route. Fig. 4(d): The new dissemination tree is now with 4 agents (a1–a4). Note that this time the formed triangle has a largest angle greater than 120°, so the branch node is located at the vertex of the obtuse angle, which is a2. Fig. 4(e): One more new agent a5 joins the network. The LSS Algorithm is passed from the source to b2. b2 then looks for a node with the minimum distance to the new agent among its downstream and upstream nodes. It chooses the upstream node and the line segment is decided from the source to b1 (lines 4-5 of the algorithm). Fig. 4(f): The new dissemination tree with a total of 5 agents (a1–a5). For the newly formed triangle (a case similar to Fig. 4(d)), the new branch node b4 is located at a5.
An Efficient Data Dissemination Scheme for Sensor Networks
735
3.2 Agent Searching and Replacement Fig. 5 explains how our data dissemination scheme selects an appropriate agent for a sink and what approach will be taken when a sink moves away from its original agent. Fig. 5 depicts a topology with several nodes, a sink and two sources (the two sources -- far away from the sink – are invisible in the figure). In our scheme, as mentioned, a sink will select a node as its agent immediately after joining the network. If the sink is static, it will simply take the nearest node as its agent. If dynamic, it needs to find, as its agent, a neighboring node which is able to keep possibly the longest communication with the sink along its moving direction. • Fig. 5(a) and Fig. 5(b): The new sink is dynamically moving up rightward and will thus select node b as its agent. (If static, it will take a instead of b.) Node b, the selected new agent, will file the request to the two remote sources and eventually receive data from nodes c and d separately. • Fig. 5(c): When the sink keeps moving away and is about to lose communication with its agent b, it needs to get a new agent. The moving sink now has to find a new agent which must be (1) a current neighboring node of the sink itself, (2) also a neighboring node of b and (3) able to communicate with the sink along its moving direction. The new agent satisfying the above conditions is decided to be node f. • Fig. 5(d): Node d now sends data to the original agent b; b then sends it to the new agent f. Node c, on the other side, will not send data to b but instead to f because it knows f is a neighbor of b. • Fig. 5(e): The sink again moves away from node f and finds a new agent g. Sending data from node d to g will now take one more hop. At this point, it is obviously more efficient to send data directly from e to the new agent g because they are neighbors. (As a result, the connection from e to g by way of e->c->f->g will be disused.)
Fig. 5. Agent searching and replacement
736
P.-J. Chuang and B.-Y. Li
Note that when a sink keeps moving for a long time and is far away from its original location, it will be inefficient (in both time and energy) to continue extending the old route. In such a situation, the sink should give up the old route, find a new agent and start an all-new route for transmission.
4 Performance Evaluation 4.1 The Simulation Model Simulation runs are conducted to evaluate and compare the performance of our data dissemination scheme (denoted in the following figures as FP -- Fermat Points) and two related schemes, Two-Tier Data Dissemination (TTDD which constructs the grid structure [6]) and DElay-constrained minimum-Energy Dissemination (DEED which uses a greedy algorithm to find a suitable point in its tree and generate a route according to the required delay constraint [7]). The simulation takes Network Simulator version 2 (NS2) [8] as its platform and the model of MICA2 [9] (a well-known sensor) as its environment. The network topology has 400 sensor nodes randomly distributed in an area of 2000*2000m2, each 200*200m2 having 4 nodes. The number of sinks varies from 1 to 8; the default speed is 10m/s. The topology contains two sources whose data generation rate is 1/3 data/s. For energy consumption, the transmitting power is 0.08W, the receiving power is 0.025W and the transceiver radio range is 250m at 433HMZ. Each control packet (for a query or topology construction) is 36 bytes long; each data packet is 64 bytes long. The simulation runs for 300 seconds. 4.2 Simulation Results Energy Consumption for Constructing the Network Topology: Fig. 6 gives the energy consumption each scheme takes to construct the network topology. Considered here are the transmitting and receiving energy, not the packet broadcasting energy in finding neighbors. As the result shows, among the three schemes, TTDD consumes the largest amount of energy because it needs considerable energy for control packets (its sinks need to flood queries in the grid and the queries need to be sent to the sources through the grid nodes). The result also shows that when the number of sinks is small, our scheme and DEED take nearly the same amount of energy in constructing the topology. When the number of sinks grows, our scheme starts to outperform DEED and the performance gap widens with increasing sink numbers. This proves that, despite both schemes send control packets in dissemination trees, the dissemination tree of ours -- which derives from the concept of the Fermat Point -- is apparently more energy efficient. Energy Consumption for Packet Transmission: Fig. 7 displays energy consumption for transmitting data packets vs. the number of sinks for the three schemes. As to be observed, our scheme saves more energy than the other two schemes in all situations (with fewer or more sinks). This is because by using the property of the Fermat Point to simplify the transmission routes, we are able to optimize our dissemination tree and meanwhile increase the scalability of our scheme when the number of sinks grows.
An Efficient Data Dissemination Scheme for Sensor Networks
737
Fig. 6. Energy consumption for control packets vs. the number of sinks
Fig. 7. Energy consumption for data packets vs. the number of sinks
Total Energy Consumption: Fig. 8 gives the total energy consumption vs. the number of sinks, the combined result of Fig. 6 and Fig. 7 which reassures our scheme is the most energy conserving of the three schemes. Note that the combined result appears closer to the result in Fig. 7 because compared with data packets (in Fig. 7) the control packets in Fig. 6 are smaller and less frequently employed. (Take our scheme
Fig. 8. Total energy consumption vs. the number of sinks
738
P.-J. Chuang and B.-Y. Li
as an example. Control packets are needed only when a new sink joins the network or when a sink moves far away from its original agent). Average Transmission Delay for Data Packets: As Fig. 9 depicts, TTDD generates the largest average delay in transmitting data packets. The remarkable delay comes from the fact that TTDD needs to send data through grid nodes to the sink and thus takes more transmission time. In average transmission delay, the performance of our scheme and DEED exhibits a trend similar to that for energy consumption. The result shows that although we do not adjust our dissemination tree according to different delay constraints as DEED, we are still capable of sending data to all sinks with less delay. This again proves that the simplified dissemination tree of our scheme is efficient enough -- it reduces not only energy consumption but also transmission delay.
Fig. 9. The average transmission delay vs. the numbers of sinks
Total Energy Consumption vs. the Moving Speed of Sinks: Fig. 10 exhibits how the moving speed of sinks can affect the energy consumption in a network with 8 sinks. It is clear that energy consumption for the control packets increases with the gathering moving speed of sinks. TTDD, whose sinks need to reconstruct routes when moving across grids, consumes more energy than our scheme and DEED -- both of which will simply find a new agent for a moving sink which is to be disconnected
Fig. 10. Total energy consumption vs. the moving speed of sinks
An Efficient Data Dissemination Scheme for Sensor Networks
739
from the original agent. Our scheme is even more energy conserving than DEED as it always locates an agent for a sink following the sink’s moving direction so that the sink can keep possibly the longest connection to that agent to save energy. This further explains why our scheme is also energy efficient even when the sink picks up its moving speed in Fig. 10. Average Transmission Delay vs. the Moving Speed of Sinks: As Fig. 11 illustrates, the moving speed of sinks casts no obvious impact on average data transmission delay, especially for DEED and our scheme. This is because, regardless of their moving speed, sinks which are widely spread to the network can easily receive data from the neighboring nodes.
Fig. 11. Average transmission delay vs. the moving speed of sinks
5 Conclusions This paper presents a new data dissemination scheme based on the concept of the Fermat Point for the wireless sensor networks. In our data dissemination scheme, when a new sink joins the network, it will first select an appropriate node as its agent to send requests to the sources. Each source will then locate a suitable line segment in its dissemination tree and use the two ends of the line segment and the site of the agent (of the new sink) to form a triangle and then to find the Fermat Point of the triangle. The node closest to the Fermat Point will be set as the branch point from which data are to be transmitted to the original dissemination tree and the new agent. By using the concept of the Fermat Point to locate suitable branch nodes for data dissemination, our scheme can ensure that data are transmitted by the shortest paths (to all sinks) at the cost of very slight topology change. It conserves not only the limited energy resources but also the lifetime of a sensor network. As the conducted experimental evaluation shows, due to its simple but efficient design, our new scheme constantly outperforms related schemes such as TTDD and DEED in terms of energy consumption and average transmission delay.
740
P.-J. Chuang and B.-Y. Li
Acknowledgment. This work is supported in part by the National Science Council, Taiwan, R. O. C., under Grant No. NSC 97-2221-E-032-018.
References 1. Pantazis, N.A., Vergados, D.D.: A survey on power control issues in wireless sensor networks. IEEE Communications Surveys & Tutorials 9(4), 86–107 (2007) 2. Corke, P., Valencia, P., Sikka, P., Wark, T., Overs, L.: Long-duration solar-powered wireless sensor networks. In: Proc. 4th Workshop on Embedded Networked Sensors (June 2007) 3. Fermat Points, http://en.wikipedia.org/wiki/Fermat_point 4. Albowicz, J., Chen, A., Zhang, L.: Recursive position estimation in sensor networks. In: Proc. 2001 IEEE Int’l Conf. on Network Protocols, November 2001, pp. 35–41 (2001) 5. Bulusu, N., Heidemann, J., Estrin, D.: GPS-less low cost outdoor localization for very small devices. Special Issue on Smart Spaces and Environments, IEEE Personal Communications 7(5), 28–34 (2000) 6. Ye, F., Luo, H., Cheng, J., Lu, S., Zhang, L.: A two-tier data dissemination model for largescale wireless sensor networks. In: Proc. 8th Annual ACM/IEEE Int’l Conf. on Mobile Computing and Networking, September 2002, pp. 148–159 (2002) 7. Kim, H.S., Abdelzaher, T.F., Kwon, W.H.: Dynamic delay-constrained minimum-energy dissemination in wireless sensor networks. ACM Trans. on Embedded Computing Systems 4(3), 679–706 (2005) 8. Network Simulator version 2, http://www.isi.edu/nsnam/ns/tutorial/ 9. MICA2 Mote Datasheet, http://www.xbow.com
Dynamically Maintaining Duplicate-Insensitive and Time-Decayed Sum Using Time-Decaying Bloom Filter∗ Yu Zhang, Hong Shen, Hui Tian, and Xianchao Zhang Department of Computer Science, University of Science and Technology of China School of Computer Science, University of Adelaide, Australia Institute of Computing Technology, Chinese Academy of Sciences, China School of Software Engineering, Dalian University of Technology, China
Abstract. The duplicate-insensitive and time-decayed sum of an arbitrary subset in a stream is an important aggregation for various analyses in many distributed stream scenarios. In general, precisely providing this sum in an unbounded and high-rate stream is infeasible. Therefore, we target at this problem and introduce a sketch, namely, time-decaying Bloom Filter (TDBF). The TDBF can detect duplicates in a stream and meanwhile dynamically maintain decayed-weight of all distinct elements in the stream according to a user-specified decay function. For a query for the current decayed sum of a subset in the stream, TDBF provides an effective estimation. In our theoretical analysis, a provably approximate guarantee has been given for the error of the estimation. In addition, the experimental results on synthetic stream validate our theoretical analysis. Keywords: stream, bloom filter, time-decay.
1 Introduction Recent years have seen an increasing interest in online monitoring of data streams where data elements arrive constantly at varying rates. This research has its foundations and applications in many domains, including data mining, networking, and multimedia applications. However, new challenges have emerged. Due to the property of unboundness of a data stream, a monitor may observe large quantities of data elements over time. Therefore, some important aggregations of data elements should be provided before they are deleted forever. Ideally, we may use a single compact sketch that is flexible enough to provide estimates for a variety of aggregations, rather than using different sketches for estimating different aggregations. The network monitoring setting leads to several desiderata. In most stream models, we observe that recent elements are always regarded as more significant than past ones. We should therefore handle this “time-sensitivity” by weighting newer elements more heavily than older ones. This can be formalized in a variety of ways: we may only consider elements that fall within a sliding window of recent time (say, the last ∗
This work is supported by Chinese Academy of Science "100 Talents" Project and National Science Foundation of China under its General Projects funding #60772034. Corresponding author: H. Shen.
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 741–750, 2009. © Springer-Verlag Berlin Heidelberg 2009
742
Y. Zhang et al.
hour), and ignore (assign zero weight to) any that are older; or, more generally, use some arbitrary function f that assigns a weight to each element as a function of its age [1, 2]. An aggregation should allow such decay functions to be applied, i.e. time decaying aggregation, and give us guarantees relative to the exact answer. In addition, it is possible that the same element appears multiple times in a distributed stream scenario and such duplicates (such as repeated occurrences) must not be considered while evaluating aggregations over the stream. Therefore, efficiently handling duplicates and ensure that the aggregation is duplicate-insensitive, i.e. re-insertion of the same element will not affect evaluation, in a distributed streaming environment is extremely important for evaluation of a time-decaying aggregation. It is useful to have duplicate elimination in a Data Stream Management System (DSMS) [3, 4] and many algorithms for eliminating duplicates in traditional query processing in DBMS have been developed [5]. However, some new properties of DSMS make the duplicate detection problem more challenging and to some degree different from the one in a traditional DBMS. First, the timely response property of data stream applications requires the system to respond in real-time. Second, the potentially unbounded property of data streams indicates that it is not possible to store the whole stream in a limited space. On the other hand, there are cases where efficiency is more important than accuracy. Therefore, to cope with high-rate streams, provide fast answers in an on-line fashion and reduce storage space, a quick duplicate elimination with an acceptable error rate is better than a precise one that is slow. Putting all these considerations together results in an extensive requirements list. Our goal is to seek a compact sketch, which can approximately detect duplicates and apply arbitrary time decay functions. Further, it should be able to be easily updated with new elements and query the sketch for the current decayed aggregation of an arbitrary subset of the stream to give guaranteed quality answers to a variety of analysis. Previous work has considered various summaries which satisfy certain subsets of these requirements, but no sketch that can satisfy all of them is known. In this paper, we show that it is possible to develop a sketch to fulfill all the above requirements based on Bloom filter. The sketch we will propose allows a variety of aggregation to be computed efficiently under arbitrary decay functions in a duplicate insensitive fashion. The rest of this paper is organized as follows, Section 2 gives the problem statement and some background knowledge on Bloom filters sketch. In Section 3, we describe our sketch and analyze its performances. In Section 4, we report the results of our experiments on synthetic stream. We review the related work in Section 5, followed by a conclusion in Section 6.
2 Preliminaries 2.1 Problem Statement We can define a data stream seen by a single monitor as a sequence of elements: SN =e1,..., ei,..., eN, where N is the size of the stream. Each element ei, 1≤i≤N, is a tuple (idi, wi, ti), where the entries are defined as follows:
Dynamically Maintaining Duplicate-Insensitive and Time-Decayed Sum
743
idi is a unique observation id for ei. wi is a weight associated with ei , e.g. a number reflecting the confidence in it. ti is the integer timestamp, tagged at the time ei was created or observed according to the practical application. Let f denote a decay function, and c denote the time at which a query is posed. Let S denote the set of ids of a subset of elements in SN. For example, given an arbitrary set of elements in SN, {(2, 8, 0), (3, 8, 1), (4, 5, 3), (7, 5, 6)}, S can be denoted by ids of each element, i.e. {2,3,4,7}}. We now describe the decayed sum of S. The decayed sum of S at time c is defined as V = ∑(id)∈S w−f(c − t) , that is the sum of the decayed weights of S in the stream. The same element may occur multiple times in the stream, with the same id (and timestamp when it was tagged at the time ei was created). Such repeated occurrences must not be considered while evaluating aggregates over the stream. Note that our model allows different elements of the stream to have different ids but the same weights. In such a case they will be considered separately in computing the aggregates. Other applications (such as decayed average) are extensions of the method of decayed sum. The decayed average of a stream at time c can be defined as follows A= ∑(id)∈S w−f(c − t)/ ∑(id)∈S f(c − t) Observe that the nominator of the decayed average is a decayed sum of the set S. The denominator of the decayed average can also be seen as a decayed sum of S. The initial weight of element in the stream is always equal to one. It follows that an approximate weighted average can be obtained from the corresponding approximate decayed sum.
△t) is a decay function if: (1) for every t, f(△t)≥ 0 and (2) f(△t) is non-increasing with △t, i.e. △t ≥△t =⇒ f(△t )≤f(△t ).
Definition 1. A function f(
1
2
1
2
The result of the decay function is applied on the weight of a data element. More precisely, the “decayed weight” of item (id,w,t) at time c≥ t is w−f(c−t). Let t =c−t, an example decay function is the sliding window model [15, 18, 28], where f( t) is defined as follows. For some window size W, if t≤ W, then f( t) = 1; otherwise, f( t)=0. Other popular decay functions include exponential decay f( t) = χ ∆t for a
△
△
constant χ (0≤ χ 1 − (1 − e ε time takes to answer a query for the decayed sum of S is O(|S|). Proof: Omitted due to space limit. Since we decay all m counters in TDBF when an epoch arrives after each T time units
elapsed, and for any id∈S the current decayed weight of id can be estimated from the hash array on demand, the expected time of each update and query follows directly from Theorem 1.
4 Preliminary Experiment Evaluation We have done preliminary experiment evaluation of out algorithm on synthetic data. The underlying idea of our experiments is to exploit the tradeoff between space and time on one hand, and the error rate on the other hand. The more hash functions used in TDBF, the larger the required space and the smaller the probability of producing errors. However, since the space usage of TDBF is a constant (multiple of the number of hash functions used), throughout the experiments we calculate the ratio between the number of hash functions and the size of the hash space used. This provides the flexibility of recognizing the tradeoff between the space usage and error rate as needed. We measure two parameters: error rate of the decayed weight and probability (we call it Decayed Sum Rate (DSR)) that the magnitude of error between the estimation of decayed sum V and the real decayed sum V ( V ≤ ε V). DSR can be computed using some random sets with the same size (set at 100 in our tests). Note that, we set the value of ε to 0,1 in our tests. We conduct experiments on streams of synthetic data to illustrate how the theoretical and practical error rates vary with the number of hash functions. We use a synthetic stream of length 1,000,000 elements for the decayed sum experiments. For simplicity, each element in the synthetic stream is organized as follows: the unique id for e is chosen from range [1..1000000] in the sequence, the weight is chosen randomly from range [1..100] and the timestamp is tagged at the time ei was observed. All elements are distinct, i.e., there are no duplicates in the stream. Since TDBF is a ^
^
Dynamically Maintaining Duplicate-Insensitive and Time-Decayed Sum
749
duplicate-insensitive sketch, the fraction of duplicates in the data stream has no impact to our results. Our experiment results have showed: 1) The error rate of the decayed sum for a single element is always lower than the theoretical error rate. The error rates decrease as the number of hash functions increases. 2) The practical DSR is always larger than the theoretical DSR. Both DSRs increase as the number of hash function increases.
5 Related Work A large body of work on data aggregation algorithms in the area of stream monitoring exists [9, 10, 1]. We only survey algorithms that achieve some of our goals: duplicate detection, and time decaying computations. The Bloom filter sketch [6] is a simple and space efficient technique for approximately maintaining membership of elements and hence is duplicate insensitive.Based onBloom filter, Metwally et.al.[11] studied the duplicate detection problem in a streaming environment. They considered approximate detection of duplicates over different window models: landmark window, sliding window and jumping window. The same problem is also studied by Deng et.al.[12], and a sketch based on Bloom filter was introduced to avoid the state that the Bloom filter becomes full by evicting some information from it. Cohen and Strauss [13] formalized the problem of maintaining time-decayed aggregates, and gave strong motivating examples in which other decay functions are needed. They demonstrated that any general time-decay function based SUM can be reduced to sliding window decay based SUM. The recent work of Cormode et.al. [12] also studied the duplicate-insensitive and time-decayed sum in a streaming environment. They presented a sketch allowing duplicate-insensitive, distributed computation of decayed sum over asynchronous data streams. The sketch can give provably approximate guarantees for the decayed sum. The size of the sketch and the time taken to update it are both polylogarithmic in the size of the relevant data. However, comparing with our sketch, all these prior works provide decayed sum only for distinct elements in the stream. When a query for decayed sum of an arbitrary subset of a stream is required, these previous sketches will not be able to provide a good estimate. Our work shares some idea with Cheng et.al. [14], which studied time-decaying counters based on time-decaying Bloom filter. However, their proposed scheme is not suitable for detecting duplicates and dynamically maintaining time-decayed weight of each weight in a stream as ours does.
6 Conclusion In this paper, we proposed an effective method for estimating time-decayed sum of an arbitrary subset in streams using time-decaying Bloom filter (TDBF), a variant of the well-known Bloom filter technique. TDBF has the following properties: it is duplicate insensitive, i.e. re-insertion of the same data will not affect the sketch, and hence the estimate of the decayed sum. Unlike previous sketches, it is also time-decaying, so
750
Y. Zhang et al.
that the weight of each element in the TDBF can decrease with time according to a user-specified decay function. The sketch can give a provably approximation guarantee on the estimate for a decayed sum. To our knowledge, this is the first sketch that combines all the above properties. Extending our work to handle expiring zero-weight element in TDBF is our future research task.
References 1. Cohen, E., Strauss, M.: Maintaining time-decaying stream aggregates. In: Proc. Principles of Database Systems (PODS), San Diego, California, June 2003, pp. 223–233 (2003) 2. Datar, M., Gionis, A., Indyk, P., Motwani, R.: Maintaining stream statistics over sliding windows. SIAM J. on Computing 31(6), 1794–1813 (2002) 3. Babcock, B., Babu, S., Datar, M., Windom, J.: Model and issues in data stream systems. In: Proc. Principles of Database Systems (PODS), Wisconsin, June 2002, pp. 1–16 (2002) 4. Golab, L., Ozsu, M.T.: Issues in data stream management. SIGMOD Record 32(2), 5–14 (2003) 5. Garcia-Molina, H., Ullman, J.D., Widom, J.: Database System Implementation. Prentice Hall, Englewood Cliffs (2000) 6. Bloom, B.H.: Space/time trade-offs in hash coding with allowable errors. Communications of the ACM 13(7), 422–426 (1970) 7. Fan, L., Cao, P., Almeida, J., Broder, A.Z.: Summary cache: A scalable wide-area Web cache sharing protocol. IEEE/ACM Trans. net2working 8(3), 281–293 (2000) 8. Cohen, S., Matias, Y.: Spectral bloom filters. In: Proc. ACM SIGMOD Conf., California, June 2003, pp. 241–252 (2003) 9. Muthukrishnan, S.: Data Streams: Algorithms and Applications. Foundations and Trends in Theoretical Computer Science. Now Publishers (August 2005) 10. Arasu, A., Manku, G.: Approximate counts and quantiles over sliding windows. In: Proc. Principles of Database Systems(PODS), Paris, France, June 2004, pp. 286–296 (2004) 11. Metwally, A., Agrawal, D., Abbadi, A.E.: Duplicate detection in click streams. In: Proc. 14th Int. Conf. World Wide Web, Chiba, Japan, May 2005, pp. 12–21 (2005) 12. Deng, F., Rafiei, D.: Approximately Detecting Duplicates for Streaming Data using Stable Bloom Filters. In: Proc. ACM SIGMOD Conf., New York, June 2006, pp. 25–36 (2006) 13. Cormode, G., Tirthapura, S., Xu, B.: Time-decaying sketches for sensor data aggregation. In: Proc. Principles of distributed computing (PODC), Portland, Oregon, May 2007, pp. 215–224 (2007) 14. Cheng, K., Xiang, L., Iwaihara, M.: Time-Decaying Bloom Filters for Data Streams with Skewed Distributions. In: Proc. 15th International Workshop on Research Issues in Data Engineering: Stream Data Mining and Applications (RIDE-SDMA) (2005)
Lead Scoring Client’s Web Service Yun Ling and Chongyi Ye College of Computer & Information Engineering, Zhejiang Gongshang University Hangzhou, China
[email protected],
[email protected]
Abstract. What lead scoring does it assign a point value to who prospects are, how they interact with your company and what their need is for your product, the assumption being that the higher their score, the further they are along in the buy process. In this paper we describe our experiences and findings in applying lead scoring Web service. In particular, we focus on how to deploy Web service. We apply Axis framework for constructing Simple Object Access Protocol (SOAP) processors such as clients, which introduce practical approaches for Web service. We develop client’s Web service to invoke the lead scoring Web service using Java, which is an open source. At the same time we develop website to display scoring results to the user. We show that Web service make conversation easy between applications and applications as well as Web browser and server’s conversation. Keywords: Web services, Axis, Tapestry, Spring, Maven.
1 Introduction Web services are invented to provide interoperability. Developers want all the benefits of Web services without understanding how they work. To maximize interoperability, they embrace describing wire-level messages using XML Schema Definition (XSD) [1] and defining Web service contract using Web Service Description Language (WSDL) [2]. The better approach is that carefully design WSDL first. Then it can generate Java code and .NET code easily. Interoperability is possible if developers follow the work of SOAPBuilders [3] and WS-I [4]. Web services are attracting a lot of attention. Microsoft's GXA addresses many of these open issues about WS-Referral [5], WS-Routing [5], WS-Security [5], etc. Java is an open source implementation of the core components necessary for Web services. The version of Axis [6] which we use is written in Java. It is essentially a SOAP [7] engine. It also includes extensive support for the WSDL and emitter tooling that generates Java classes from WSDL. In the context we have so far described, this paper describes our experiences and findings in deploying client of Web services. More specifically, we focus on managing applications through Spring [8] framework and managing whole project through Maven [9]. The rest of the paper is organized as follows: Section 2 provides a very brief tutorial introduction of Web service, as well as the key components it relies on. Section 3 presents Tapestry [10], Hibernate [11], and Spring frameworks to implement client’s applications. Section 4 presents Maven to manage the whole project. Finally, Section 5 concludes. A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 751–760, 2009. © Springer-Verlag Berlin Heidelberg 2009
752
Y. Ling and C. Ye
2 Web Service Web service is an application component that - communicates via open Internet protocols; - Processes Extensible Markup Language (XML) messages framed using SOAP; - describes its messages using XSD; - provides a full interface description through WSDL; - can be discovered via Universal Description, Discovery, and Integration (UDDI). Figure 1 displays basic Web service architecture. A Web service is accessible via open protocols. XML is a data representation format. SOAP is an XML-based protocol for messaging. XML Schema describes XML messages. WSDL describes how to invoke Web services. UDDI [12] is a Web services description repository.
UDDI
Registry of endpoints
WSDL
Endpoint description
XSD
Portable type system
SOAP
Framing,
XML 1.0 + Namespaces
protocol
binding
Serialized messages
Wire protocols Description languages Discovery mechanisms Fig. 1. Basic Web service architecture
2.1 Overview How do the layers above form a whole? We analyze it from the point of view of the service requestors and service providers. Figure 2 shows Web services are developed from the point of view of the service requestors. First, you must find service about your applications. Then it should find service description when it finds the needed service. Third, you must create a client’s application. Finally, implement you client’s application to invoke the Web services. Figure 3 shows Web services are developed from the point of view of the service providers. First, you must develop service’s kernel functions. Next, you must develop kernel functions’ service packaging. Then, you should provide a service description. Further more, you should deploy service. In the end, you should release the new service and its criterion.
Lead Scoring Client’s Web Service
753
First: Look for service through UDDI Second: Acquire service description file Third: Create XML-RPC or SOAP client Fourth:
Invoke remote service
Fig. 2. Develop Web service: service requestors’ angle
First:
Create kernel functions
Second:
Create a service packaging
Third:
Create a service description
Fourth: Fifth:
Deploy service Release service and criterion
Fig. 3. Develop Web service: service providers’ angle
2.2 Lead Scoring Service Description WSDL currently represents service description layer of the Web services protocol stack. In short, WSDL designates public interface for Web services. The public interface includes the sharing function information, XML message’s data type information, specific Transfer Protocol’s binding information and location of specific service’s address information. The WSDL of lead scoring creates lead scoring service description. It can generate Java classes through Axis.
754
Y. Ling and C. Ye
2.3 Axis Axis is the third generation of Apache SOAP which submits to W3C [13]. SOAP is a lightweight protocol for exchanging structured information in a decentralized, distributed environment. It is an XML based protocol that consists of three parts: an envelope that defines a framework for describing what is in a message and how to process it, a set of encoding rules for expressing instances of application-defined datatypes, and a convention for representing remote procedure calls and responses. Axis now delivers the following key features:
Lead Scoring Client’s Web Service
755
- Speed. Axis uses SAX parsing to achieve significantly greater speed than earlier versions of Apache SOAP; - Flexibility. The Axis architecture gives the developer complete freedom to insert extensions into the engine for custom header processing, system management, or anything else you can imagine; - Stability. Axis defines a set of published interfaces which change relatively slowly compared to the rest of Axis; - Component-oriented deployment. You can easily define reusable networks of Handlers to implement common patterns of processing for your applications, or to distribute to partners; - Transport framework. We have a clean and simple abstraction for designing transports and the core of the engine is completely transport-independent; - WSDL support. Axis supports the WSDL, which allows you to easily build stubs to access remote services, and also to automatically export machinereadable descriptions of your deployed services from Axis. We utilize WSDL2Java [14] tool to emit Java artefacts which used to access the Web service when obtaining the lead scoring WSDL file. The configuration of clientconfig.wsdd file is as follows:
3 Lead Scoring Client’s Application In this section we present the main design for lead scoring client’s application using Java. First, we give a very brief overview of the Tapestry framework. Then we explain how the Hibernate framework can complete data persistence. Finally, we introduce Spring framework to manage application. Figure 4 shows the system architecture. View layer displays scoring results to the users using Tapestry technology. Middle layer make use of Hibernate and Spring frameworks. SQL Server 2000 database stores data in the data service layer.
756
Y. Ling and C. Ye
Tapestry technology: implement view layer
Service layer:
implement logical layer
Spring container
Web layer: control logical layer and view layer
Hibernate’s DAO component: implement DAO layer
Hibernate’s persistent object: implement persistent layer
SQL Server 2000 database: store data Fig. 4. Overall system architecture
3.1 Tapestry Framework Apache Tapestry is an open-source framework for creating dynamic, robust, highly scalable web applications in Java. Tapestry complements and builds upon the standard Java Servlet API, and so it works in any servlet container or application server. Using Tapestry can obtain the following benefits: - Guarantee a minimum interference to HTML, that is, art and view layer programmers have a very clear division of labor. Tapestry can only add a jwcid attribute for the HTML page intervention. - Based on the components, making our view layer from one layer into building blocks. Page norm is a link among these building blocks. Java files play a role of processing logic. - As the view layers of logic are all inside the java files, making the logical operation meet the arbitrary level. - With the deepening of our project, there are more and more building blocks. It is said that we work more and more easily and effectively. Tapestry divides a web application into a set of pages, each constructed from components. Tapestry brings true object oriented development to Java web applications. The following is the LeadScore.page file, which must have the initial-value, or can’t parse the HTML page.
Lead Scoring Client’s Web Service
757
3.2 Hibernate Framework Hibernate is a Professional Open Source framework. It is a powerful, high performance object/relational persistence and query service. Persistent object (PO) operates the database by the object-oriented way. PO in Hibernate is very simple. In order to use hibernate for persistent operation, it usually has the following steps: - develop the persistent classes; - acquire configuration; - acquire SessionFactory; - acquire session, open transaction; - operate database by the object-oriented way; - close transaction, close session. We use the following configuration file to configure Hibernate. hibernate.dialect=org.hibernate.dialect.SQLServerDialect 3.3 Spring Framework Spring provides a lightweight solution for the development of enterprise applications. Spring is essentially a technology dedicated to enabling you to build applications using Plain Old Java Objects (POJOs). It enables you to develop components as POJOs containing only your business logic, while the framework takes care of the many value adds you need to build enterprise applications — even in areas that you may not have considered when initially authoring the application. Spring is portable between application servers and web containers. Acegi Security [15] is an open source project that provides comprehensive authentication services for enterprise applications based on The Spring Framework. Acegi Security is managed through Spring's inversion of control and lifecycle services, and actually enforces security using interception through servlet Filters and Java AOP frameworks. The key point is that defining the necessary filters in web.xml. acegiFilter org.acegisecurity. util.FilterToBeanProxy targetClass org.acegisecurity. util.FilterChainProxy acegiFilter /*
758
Y. Ling and C. Ye
org.acegisecurity. AccessDeniedException /AccessDenied.html
4 Maven Tool Maven is a software project management and comprehension tool. Maven's primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with - making the build process easy; - providing a uniform build system; - providing quality project information; - providing guidelines for best practices development; - allowing transparent migration to new features. Maven allows a project to build using its project object model (POM) and a set of plugins that are shared by all projects using Maven, providing a uniform build system. The following is the primary configuration code of pom.xml. org.springframework spring-aop 2.5 compile org.springframework spring-beans 2.5 compile org.hibernate hibernate 3.2.5.ga compile org.apache.tapestry tapestry-framework 4.1.3 compile
Lead Scoring Client’s Web Service
759
org.acegisecurity acegi-security 1.0.5 compile org.apache.axis axis 1.4 compile org.apache.maven.plugins maven-compiler-plugin 2.0.1 1.5 1.5 org.apache.maven.plugins maven-resources-plugin 2.2 org.codehaus.mojo axistools-maven-plugin 1.1 wsdl2java
5 Conclusion In summary, this paper presents our findings and valuable lessons from designing client’s Web service. In a growing open source ecosystem of scalable and management components, Java is emerging as the predominant technology for Web service.
760
Y. Ling and C. Ye
Open source frameworks have many important applications. This paper is a case study on Web service, presenting our design and describing the lessons we learned. We demonstrate how to deploy client’s Web service efficiently and effectively using those open source frameworks.
References 1. XML Schema, http://www.w3.org/TR/xmlschema-0, http://www.w3.org/TR/xmlschema-1, http://www.w3.org/TR/xmlschema-2 2. WSDL, http://www.w3.org/TR/wsdl 3. SOAPBuilders, http://www.soapbuilders.org 4. WS-I, http://www.ws-i.org 5. GXA, http://msdn.microsoft.com/en-us/library/aa479664.aspx 6. Axis, http://ws.apache.org/axis 7. SOAP, http://www.w3.org/TR/SOAP 8. Spring, http://www.springsource.org 9. Maven, http://maven.apache.org 10. Tapestry, http://tapestry.apache.org 11. Hibernate, http://www.hibernate.org 12. UDDI, http://www.uddi.org 13. W3C, http://www.w3.org 14. WSDL2Java, http://ws.apache.org/axis/java/user-guide.html 15. Acegi Security, http://www.acegisecurity.org
Minimizing the Limitations of GL Analyser of Fusion Based Email Classification Md. Rafiqul Islam and Wanlei Zhou School of Engineering and Information Technology Deakin University, Melbourne, Australia {rislam,wanlei}@deakin.edu.au
Abstract. In the last decade, the Internet email has become one of the primary method of communication used by everyone for the exchange of ideas and information. However, in recent years, along with the rapid growth of the Internet and email, there has been a dramatic growth in spam. Classifications algorithms have been successfully used to filter spam, but with a certain amount of false positive trade-offs. This problem is mainly caused by the dynamic nature of spam content, spam delivery strategies, as well as the diversification of the classification algorithms. This paper presents an approach of email classification to overcome the burden of analyzing technique of GL (grey list) analyser as further refinements of our previous multi-classifier based email classification [10]. In this approach, we introduce a “majority voting grey list (MVGL)” analyzing technique with two different variations which will analyze only the product of GL emails. Our empirical evidence proofs the improvements of this approach, in terms of complexity and cost, compared to existing GL analyser. This approach also overcomes the limitation of human interaction of existing analyzing technique. Keywords: Machine learning, multi-classifier, spam, SVM, TP, FP.
1 Introduction The Internet has rapidly become an integral part of everyday life and its usage is expected to continue growing [1]. The usage of Internet email has emerged as one of the primary tools of communication, intended for idea and information exchange throughout the world [2]. However, its rapid adoption has also left it susceptible for misuse and abuse. Along with the growth of the Internet and email, there has been a dramatic growth in spam in recent years [3]. The increasing volume of spam is rapidly becoming a serious problem [3][4][5][6]. Effectively dealing with unwanted email is important not only for cost savings but also to protect Internet users. Spam filtering is able to control the problem in a variety of ways. Identification and spam removal from the email delivery system allows endusers to regain a useful means of communication. However, the key challenge is that spam is difficult to define, as what is spam to one person are not necessarily spam to another, as well as its dynamic nature. In classification based spam filtering systems, researchers often encounter two common drawbacks during the design phase of the spam filtering process, which often affects the accurate approximation of a function. Firstly, it is necessary to build a A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 761–774, 2009. © Springer-Verlag Berlin Heidelberg 2009
762
Md.R. Islam and W. Zhou
perfect data set free from noise or imperfection since that can adversely affect the approximation performance [7]. Attaining better performance from a classifier usually depends on how good the input data is. However, the real life email corpus is not in this manner, because it is neither straightforward nor static. Secondly, most training models of the classifier have limitations on their operations [8]. Classifiers often produce uncorrelated training errors due to the dimension of feature space, from small dimensional to high dimensional complex feature space, which causes a dissimilar output space. Since the nature of spam email is dynamic and the content of email is textually misleading due to obfuscation, it remains a continuous challenge for spam filtering. A further research challenge in building a combination of the multi-classifier technique is to express the detailed analysis of the decision fusion of the output space [9]. For example, if N classifiers gives the predictions of an identical data set and produce a set of classification responses, then the decision fusion process must combine the decisions of all these different classifiers in such a way that the final decision improves the decisions taken by any of the individual classifiers. Hence, the decision fusion process has to take into account the individual strengths and weaknesses of the different classifiers and must build on this information to deliver a more robust final decision [9]. This paper presents an approach to overcome the limitation of GL analyser of decision fusion of the output space of multi-classifier based spam filtering [10]. Using this approach, the system not only reduces the burden of the analysing complexity but also overcome the limitations of human interaction of the analyser. The experimental results show the performance of this approach. The rest of the paper organizes as follows: Section 2 describes the overview of multi-classifier classification alongside GL analyser. Section 3 describes the minimizing technique using MVGL along with different variation. Section 4 presents the empirical evidence of the proposed approach and finally section 5 conclude the paper with the direction of future work.
2 Overview of Fusion Based Multi-classifier Classification This section presents an overview of the multi-classifier classification technique along with adaptive and analyzing methods, as shown in Fig. 1. In this technique, every single email is indexed in the test model and classified by the classifier/(s) with their corresponding index values. The technique needs to evaluate the email status after collecting the consensus from different classifiers. The adaptive section collects the outputs and differentiates the categories based on the labelling of the classifier/(s). If the labelling of all the classifiers does not converge, then the decision fusion component of the adaptive section will place it in a different list, called GL (grey list). The term ‘greylisting’ has been used by others in spam filtering [11] where an MTA (Mail Transfer Agent) will temporarily reject any emails from a sender if it is not recognized. In this technique, the term grey list (GL) carries a different meaning, it is the list of emails generated by the adaptive section which is neither TP (True Positive) nor TN (True Negative) and is considered as a part of both. Therefore the TP and TN are the emails where all classifiers converge with their consensus, but in terms of GL emails, no uniform consensus can made so the system needs to analyse them further to make a decision. Therefore, the analyser will make a final conclusion about the status (spam or legitimate) of GL emails. Two methods are used to analyse GL
Minimizing the Limitations of GL Analyser of Fusion Based Email Classification
763
Fig. 1. Block diagram of multi-classifier classification with GL analyser
emails. One is the user selection method and the other is the sender verification method [7]. The block diagram of the analyser is shown in Fig. 2. As shown in Fig. 2, initially the filtering system has the preference to set the analysing procedure; whether it will be scrutinized by using the user selection method or the sender verification method. The first selection is a straightforward approach to analyse the email. It is the concept of personalized spam detection [12]. One of the issues here is that this is neither a collaborative approach nor a globalization approach to detect spam because it violates the general definition of spam (unsolicited emails), while adopting a principle of “somebody’s spam could be the other users’ ham”. In this process when the GL email comes to the analyser, the analyser will first compare it out to the TP database as to whether the header/domain exists or not, as shown in the Fig. 2. If it exists then the email will be treated as positive and will not to be sent
764
Md.R. Islam and W. Zhou
Fig. 2. GL email analysing method
to the user for further identification. Alternatively the GL email will be dispatched to the user for user response in relation to the final status of this email. This user selection process is quite simple but more effective in terms of accuracy. The second option, sender verification, is more intricate compared with the first one. This process is based on what we call a challenge-response (C/R) method [13]. In this method, when the GL email comes to the analyser, the analyser will compare it to the TP database as to whether it exists or not. If it exists in the user mailbox then it will not be sent to the sender for feedback. In that case the email will be detected as legitimate. On the other hand, if it does not exist in the TP database, the analyser will automatically send a message to the sender for authentication. Until the sender responds with a correct answer within a certain time-frame, the email will remain as GL. If the sender responds with the correct answer, then the email is considered as TP and the user mailbox will be updated accordingly. Otherwise the message will be treated as TN and will be sent to the spam mailbox. If the time expires without any response from the sender, then it is also considered as TN. After receiving the response from any of the methods, the system will send the emails to the subsequent mailboxes based on the credentials of the system. 2.1 Limitations of Existing GL Analyser The GL analyser method of multi-classifier classification technique resulted in a significant performance improvement, in particular reduction of false positive alarms [7]. However, this method has some potential drawbacks which are outlines below:
Minimizing the Limitations of GL Analyser of Fusion Based Email Classification
♦ ♦ ♦
765
At the outset, the GL analyser came at the price of increased complexity, in particular sender verification method, resulting in increased processing time and memory overhead requirements. Secondly, the analyser also depends to some extent on human interaction to achieve the final decision about the GL emails, when analyser used ‘user selection’ method in particular. Thirdly, spammer can use falsified email addresses or have hijacked legitimate email addresses, when analyser use sender verification analysing process. Moreover, the sender may simply not respond to the verification due to lack of motivation, which may result in false positive situation.
3 Eliminating the Drawbacks of Existing GL Analysing Technique To overcome the shortcoming of GL analyser, we have introduced the majority voting grey-list (MVGL) analysing technique as a further refinement of multi-classifier classification. The concept of the majority voting (MV) method is the simplest of all combinatorial functions [14][15][16][17] . It selects the relevant class prediction by polling all the classifiers to see which class is the most acceptable. Whichever class gets the highest support is selected. This method is particularly successful when the classifiers involved output integer votes. The MV technique has attracted much attention in the case of the multi classifier classification system for its simplicity and high level of accuracy and robustness which can be archived in appropriate incidents [17]. The impressive performance of MV has been demonstrated in various applications in biometric recognition such as handwriting recognition [16] and pattern recognition [14]. The MV system has quite a number of variations in terms of application and methodology [9][20], although the underlying principle is the same. The philosophy of the variations of MV is based on two basic strategies: • The decision will be accepted if the majority of the classifiers agree, without considering the trustworthiness/ranking of the classifiers. • The decision will be accepted if the most competent classifiers agree, without giving the consensus of the majority classifiers. Both strategies are useful and can achieve fruitful performance but need to require careful integration within the decision making process. In our proposed approach we introduce both of the strategies to minimize the complexity of the analyser. It should be noted that the foremost difference in the use of MV in our system compared with other existing systems [17][18][19] is that the existing systems apply the MV method to the immediate output of the multi-classifiers. In our system the instant outputs pass to the adaptive section then, after grouping the emails by adaptive section, only the GL category passes to the MV method. There are different distinctions of using the MV techniques presented in [18] such as weighted MV, restricted MV, enhanced MV and ranked MV. But the performance of the various approaches of the MV techniques is directly related to their design emphasis. However, emphasis has been given here to assess how a consensus can be reached given the often conflicting opinions of classifiers in the multi classifier classification
766
Md.R. Islam and W. Zhou
environment. In our proposed approach, we have considered couple of variations; one is simple MVGL (SMVGL) and other is ranked MVGL (RMVGL) techniques. The following section outlines the details of SMVGL and RMVGL technique. 3.1 Simple MVGL In multi-classifier classification environment shown in Fig. 1, combining the prediction of N classifiers, the decision is assigned to a class label for which there is a consensus, or when the majority (that is more than half) of the classifiers agrees on a unique class label. Otherwise the output will go to the RMVGL technique. The following Fig. 3 shows the SMVGL technique for the N-classifier, of multi-classifier based spam filtering technique. Let Pred(i, n) denote the N number of classifiers prediction of i. Each classifiers prediction is represented by binary expressions 1 or -1, with 1 indicating the classifier is predicted as positive and -1 indicating that it is negative. If there are N classifiers C1; C2; . . . ; CN, C1 is the LS (least significant) and CN is the MS (most significant) then there are 2N -2 possible combinations of diverse classification that is correct/incorrect classifications which are treated as GL product for N classifiers as described before. From Fig. 3, it has been shown that the adaptive section categorized the classifiers output into three different categories TP (true positive), TN (true negative) and GL (grey list). The category GL comes to SMV technique for counting individual prediction to support a final decision. After getting the final decision the emails will be sent to the corresponding mailbox that is into the TP or TN. Mathematically we can represent the MV algorithm using the max function for legitimate outputs, presents in [10], as shown in equation (1). n
n
k
p
q
C i l C i s Max ¦ C j s C k l ³ (C1 , C 2 ,..., C n ) lx1 j1 i 1 i 1 k 1
LT
ST
(1)
gl
Where C1,C2.. are the classifiers, Cil and Cis are the legitimate and spam output of the ith classifiers respectively. The total numbers of GL emails are (from Fig. 3): m
p
q
GL ⇒ ∫ (C1 , C 2 ,......, C n ) ⇒ Max (∑ ∏ C j s∏ C k l ) l x =1 j =1 k =1 ⇒ Max (C1l C 2l .....Cm −1lC m s + C1lC 2l .....Cm −1sC m l + ........ l + C1 sC 2 s.....C m − 2 sC m −1lC m s + C1 sC 2 s....C m − 2 sC m −1sC m l )
(2) Let bit (i;k) denote the K bit binary representation of integer i. For determining K, there are two possible cases – Case 1: Odd number of classifiers (N) the value of K is (N+1)/2 Case 2: Even number of classifiers (N) the value of K is (N/2)+1
Minimizing the Limitations of GL Analyser of Fusion Based Email Classification
767
Fig. 3. SMVGL for N-classifier
If the K represents the positive label for a particular email then the analyser will be treated as legitimate and vice versa for spam. According to the Fig. 3, the SMVGL algorithm will count the individual classifier predictions for every email and the pronouncement will be accepted for legitimate emails if majority function fmax (Pred(i,n)) is positive, that is, for legitimate emails the majority function isFor case 1:
f max (i , l ) = (1| bit(i,n)>n/2) and
(3)
f max (i , l ) = (1| bit(i,n)>n/2+1)
(4)
For case 2: where n is the number of classifiers 3.2 Ranked MVGL It is an enhancement of SMVGL. In this approach the decision of the individual classifier along with the rank factor of the classifier will be multiplied to get the final decision. The rank factor is the comparative competence of the collaborating classifiers. The higher the competences value the higher of its rank factor. Let RiCi be the rank factor of the ith classifier expressing the comparative k class competence of the classifiers be denoted by dik=RiCik with i=1..N and k=0..1. So the final decision Dfinal = max of dik. For an even number of classifiers, one of the probabilities could arise in the case of tie that is k=n/2. In that case the system will consider the classifier ranking. The system will then count the rank of the classier simultaneously and, based on the
768
Md.R. Islam and W. Zhou
RMVGL, the email will be determined accordingly. The Fig. 4 illustrates the RMV system for GL emails. In this approach the GL analyser will determine the rank of the classier based on the precision value along with classification predication. In the case of a tie, the analyzer will evaluate the rank value of each classifier. If the rank value is higher for the legitimate case, then the analyser will predict as positive otherwise negative and will send the email to the corresponding folder. This process will be initiated only in the case where the k value is n/2.
Fig. 4. GL analyser using RMV for N-classifier
Let C1,C2,C3…CN are the classifier and R1,R2,R3…RN are the corresponding rank values. For an even number of classifiers when the probability factor of the collective consensus is 0.5, then the system will determine the legitimate email that isDfinal=max of RiCil. (5)
Minimizing the Limitations of GL Analyser of Fusion Based Email Classification
769
And the rank factor of the classifier will be determined based on the precision of the classifier, that is -
Pi = ( true positive ) i /(( true positive ) i + ( false positive ) i )
(6)
If the precision is higher, then the rank of the classifier is higher and vice versa. The reason behind this philosophy is that our objective is to reduce the false positive, so higher precision means lower false positive.
4 Experimental Results In our experiment, we have used the public data sets PUA1-2-3 [21] and converted the data sets based on our experimental design and environment. Firstly we have encoded the whole data sets, both train and test sets, then indexed every email for test data sets and finally recorded the output according to the index value. 4.1 Experimental Setup Programming Language: Matlab-7.1 Basic Steps: The Fig. 5 shows the comparison of proposed MVGL approach with our previous GL analyser [7]. It is to be noted that, we have only used the MV approach in only for GL emails of the system, not for the others. It has been shown that the MVGL technique is not outperforms over GL analyser in terms of accuracy but it reduces the complexity, which is significant. However, on an average the performance is convincing.
Fig. 5. The performance comparison of MVGL and GL analyzer
770
Md.R. Islam and W. Zhou
4.2 ROC Report Table 1 shows the comparative ROC report of MVGL and multi-classifier technique. Four ROC estimations are used to compare the performance such as AUC, AUC Table 1. Shows the ROC report for MVGL and GL analyser technique
Data Sets PUD1
ROC Estimation AUC 95% of CI
PUD2
P-Value AUC (SdErr) AUC 95% of CI
PUD3
P-Value AUC (SdErr) AUC 95% of CI
PUD4
P-Value AUC (SdErr) AUC 95% of CI
PUD5
P-Value AUC (SdErr) AUC 95% of CI
PUD6
P-Value AUC (SdErr) AUC 95% of CI P-Value AUC (SdErr) AUC 95% of CI
AVG AUC (SdErr) PValue
GL Analyser 0.94444 0.795960.98573 ( n). The proposed scheme consists the following four phases: Phase 1 - Setup, Phase 2 - Broadcast, Phase 3 - Current Group Session Key and Self-Healing Keys Recovery in Session j, Phase 4 - Self-healing Property and Phase 5 - Add and Revoke Group Members. Phase 1 - Setup. First, GM randomly chooses a polynomial of degree t, say h(x) Fq [x] and keep it as his secret:
∈
∈
h(x) = a0 + a1 x + a2 x2 + ... + at xt Fq [x].
(1)
836
W. Du, M. He, and X. Li
∈
Also, GM selects a random initial number r0 Fq and keep it as his own secret. GM then computes the value of rj (j≥1) for session j by using one-way hash function H, where session j by using one-way: rj = H (rj −1 ) = ... = H j (r0 )
(2)
Hj (.) denotes j times hash operation and r0 is the seed of the one-way hash key chain. Note that a user who has the knowledge of the rj can compute all the rj’ (j’ > j), however cannot compute any rj’’(j’’ < j) by using one-way hash function H. Then, GM sends in a private way, for i = 1,…, n, to user Ui as personal secret si= {i, h(i)} and receives rj when it first joins the group in session j. For example, Uv joins the group in session 1, will receive sv = {v, h(v)} and r1 while Uk joins the group in session m, will received sk = {k, h(k)} and rm . At last, GM randomly chooses a prime key seed K0∈Fq to generate the group session key and kept it as his own secret. Phase 2 - Broadcast. (In the j - th group session key distribution, j ≥ 1). First, GM randomly chooses a numberβj as the self-healing key for session j; Second, GM computes the group session key Kj in session j by using one-way hash function H1 ( ⋅ ), where Kj = H1 (Kj-1 , βj)
(3)
GM randomly chooses a polynomial of degree t, say Tj (x)∈Fq[x], then computes the polynomial Sj (x), where Sj (x) = rj − Tj(x)
∈ Fq[x]
(4)
Let Sj = { U11 , U12 , ..., U1wj} ⊆ U be the set of revoked users in and before session j and l1, l2 ,..., lwj represent the revoked user’s ID, such that |Rj | = wj≤t. GM then broadcasts the following message in session j: Bj (x) = { Pj (x)= (Aj (x) ⋅ Kj + h (x) ⋅ Sj (x))}∪{ Qj (x)= Tj (x)+ h (x)}
∪EK (β ), EK (β ), ..., EK (β ) j
1
j
2
j
(5)
j
Where Aj(x)=(x - l1)(x - l2)…(x - lwj). The polynomial Aj(x) is called a revocation polynomial. Tj(x), Sj(x) respectively performs the role of masking polynomial to hide the secret polynomial h(x). Phase 3 - Current Group Session Key and Self-Healing Keys Recovery in Session j. a) for a non-revoked user: A non-revoked user Ui (1 ≤i ≤n) who joins the group in session j’ (1≤j’ j + 1), but it is computationally infeasible to calculate ri (i < j + 1). So the newly joined user cannot trace back the previous rj’ (j’≤ j). Thus even Uv get the value Tj(v) by using Equation (5), it cannot get the right value of Sj(v), because Sj(v) = rj - Tj(v). (see Equation (4)). Therefore, Uv cannot compute the group session key Kj by using Equation (5) unless it guess it rightly.
840
W. Du, M. He, and X. Li
Furthermore, users in J cannot recover the secret polynomial h(x). If users in J want to recover h(x), they have to get at least t + 1 points on the polynomial h(x), but | J | ≤ t, the maximum number of points they can get on the polynomial h(x) is t. So it is impossible for users in J to recover the polynomial h(x). Hence the users in J cannot get the previous group session keys. The proposed scheme is backward secure.
6 Efficiency Comparisons with Some Previous Schemes In this section, we compare the proposed scheme with some previous ones in several aspects, such as storage overhead, long life-span, communication overhead, etc. From Table 2, we can see that the most prominent properties of the proposed scheme are constant storage and long life-span of the user’s secret, t-wise forward secrecy and backward secrecy. Moreover, the communication overhead in our scheme is light. Storage Overhead. The storage overhead in the proposed scheme comes from two parts: the Setup phase and after receiving the group session key distribution message. In the setup phase, similar to Ref.[10], each user needs to store a value on h(x) and a value of rj’ (a number given to the user who joins the group in session j’ ) as its personal secret. In the group session key distribution phase that each user firstly joined as a new user, each user only needs to store the current group session key for the purpose of helping himself to operate the self-healing mechanism in latter sessions as we demonstrated before. So the storage overhead in our scheme is 3 log q bits, which is a constant storage overhead and it equals to the storage overhead of Ref.[10]. Life-span. As Ref.[10, 12], the life-time of the personal key is long-lived and not limited in a fixed m session in the Setup Phase, which greatly lightens the group manager’s burden and lighten the communication overhead. The group manager no longer needs to redistribute the next m session personal secret keys to each user through the security channel. Communication Overhead. The broadcast message Bj consists of a t-degree polynomial, a 2t-degree polynomial, a set of revoked users Rj , and a sequence EKj (β1 ), EKj (β2 ), ..., EKj (βj ), (see Equation (5)). One can ignore the communication overhead for the broadcast of the set Rj , because the member IDs can be selected from a small finite field [3]. So the size of the broadcast message in the proposed scheme is (3t + 2 + j)log q, which significantly reduces the communication overhead compared to some of the previous schemes. Although the communication overhead of the proposed scheme is still larger than the one in Ref.[10, [13], Ref.[16] had pointed out that Ref.[10] is not secure and Ref.[13] cannot is not a constant storage scheme. Thus the communication overhead of the proposed scheme, in some sense, is a optional one.
A New Constant Storage Self-healing Key Distribution with Revocation in WSN
841
Table 2. Performance Comparisions scheme
Storage overhead
of (m-j+1)2 log q of (m-j+1) log q of 2(m-j+1) log q of (m-j+1) log q 3log q 2log q (m-j+1) log q The pr- 3log q oposed sheme C3 [2] S3 [3] S3 [5] C1 [9] [10] [12] [13]
communicatio n overhead
long lifespan
(mt2+2mt+m+t) No log q (2tj+j)log q No
Session key secre -cy Yes
t-wise forward secrec y Yes
Yes
Unconditionally
Yes
Yes
Yes
Unconditionally
t-wise security backward secrecy
[(m+j+1)t+ (m+1)]log q (tj+j-t-1)log q
No
Yes
Yes
Yes
Unconditionally
No
Yes
Yes
Yes
Unconditionally
(t+1+j)log q 2tjlog q (t+1)log q
Yes Yes No
No Yes Yes
No Yes Yes
No Yes Yes
Computationally Computationally Computatioanlly
(3t+2+j)log q
Yes
Yes
Yes
Yes
Computationally
Efficiency Comparison with Access Polynomial Scheme. The access polynomial in Ref.[12] based on the assumption that GM picks every non-revoked users’ IDs to form the broadcast message in each session. But the assumption that access polynomial needs to involve all the non-revoked users’ IDs is impractical. Firstly, the number of non-revoked users, generally speaking are larger than the revoked ones in every session, so that it will no doubt increase GM’s competition overhead. But the proposed scheme does not have this limit. Secondly, the degree of the access polynomial will increased as the increasing number of the non-revoked users. So the communication will increase sharply as time goes on. So the communication overhead in Ref.[12], in some sense, is larger than it claims. But in the proposed scheme, the communication overhead is the same in each session. Thirdly, in Ref.[12], it is difficult for GM to construct the same degree of both the access polynomial and the secret polynomial in every session due to the variety of the numbers of the non-revoked users. However making the two polynomials have the same degree plays an important role, for if they have the same degree of variable x, they will not disclose the information of the group session key after the broadcast message. But in the proposed scheme, it is more practical and efficient. It is much easier for GM to generate the broadcast message. For one thing, the degree of the polynomial is always the same and is not related to the numbers of the users in the group. Moreover, the new broadcast structure can also perfectly mask the secret polynomial. Thus the new broadcast structure in proposed scheme is much more practical and more efficient than the access polynomial in Ref.[12].
842
W. Du, M. He, and X. Li
7 Conclusions In this paper, we proposed a new constant storage self-healing key distribution with revocation in wireless sensor networks. And the proposed scheme has the properties of constant storage, long life-span, forward secrecy and backward secrecy. Then we give the security analysis that our scheme satisfies the security requirements. Finally, we compare our scheme with some previous ones, and we can see that our scheme is a efficient scheme in wireless sensor network. Our future work mainly focuses on two aspects. One is to reduce the communication overhead. The other is to extend the ability to resistant to the collusion attack so that a revoked user with the assistance of the newly joined users cannot get any information of group session keys which is not entitled to get.
Acknowledgments The work is supported by the National Natural Science Foundation of China (Grant no. 60773035); the Key Projects Foundation of Ministry of Education of China (Grant no. 205136). The Foundation of Science and Technology Bureau of Sichuan Province, China (Grant no. 05JY029-131).
References 1. Camtepe, S., Yener, B.: Key Distribution Mechanisms for Wireless Sensor Networks: A Survey. Technical Report, TR-05-07, Rensselaer Polytechnic Institute (2005) 2. Staddon, J., Miner, S., Franklin, M., Balfanz, D., Malkin, M., Dean, D.: Self-healing Key Distribution with Revocation. In: Proceedings of IEEE Symposium on Security and Privacy, pp. 241–257 (2002) 3. Liu, D., Ning, P., Sun, K.: Efficient Self-healing Group Key Distribution with Revocation Capability. In: Proceedings of the 10th ACM Conference on Computer and Communications Security, pp. 231–240. ACM Press, New York (2003) 4. More, S., Malkin, M., Staddon, J.: Sliding-window Self-healing Key Distribution with Revocation. In: ACM Workshop on Survivable and Self-regenerative Systems (2003) 5. Blundo, C., D’Arco, P., Santis, A.D., Listo, M.: Design of self-healing key distribution schemes. Des. Codes Cryptography 32(1-3), 15–44 (2004) 6. Blundo, C.: Randomness in Self-Healing Key Distribution Schemes. In: Theory and Practice in Information-Theoretic Security, 2005. IEEE Information Theory Workshop, pp. 80– 84 (2005) 7. Blundo, C., D’Arco, P., Listo, M.: A Flaw in a Self-Healing Key Distribution Scheme. In: Proceedings of Information Theory Workshop, Paris, pp. 163–166 (2003) 8. Blundo, C., D’Arco, P., Santis, A., Listo, M.: Definitions and Bounds for Self- healing Key Distribution. In: Díaz, J., Karhumäki, J., Lepistö, A., Sannella, D. (eds.) ICALP 2004. LNCS, vol. 3142, pp. 234–245. Springer, Heidelberg (2004) 9. Hong, D., Kang, J.: An Efficient Key Distribution Scheme with Selfhealing Property. IEEE Communication Letters 9, 759–761 (2005)
A New Constant Storage Self-healing Key Distribution with Revocation in WSN
843
10. Dutta, R., Wu, Y., Mukhopadhyay, S.: Constant Storage Self-Healing Key Distribution with Revocation in Wireless Sensor Network. In: IEEE International Conference on Communications 2007, pp. 1323–1328 (2007) 11. Shamir, A.: How to Share a Secret. Communications of ACM 22, 612–613 (1979) 12. Zou, X., YuanShun, D.: A Robust and Stateless Self-Healing Group Key Management Scheme. In: International Conference on Communication Technology, pp. 1–4 (2006) 13. Dutta, R., Chang, E., Mukhopadhyay, S.: Efficient Self-healing Key Distribution with Revocation for Wireless Sensor Networks Using one way hash chains. In: Katz, J., Yung, M. (eds.) ACNS 2007. LNCS, vol. 4521, pp. 385–400. Springer, Heidelberg (2007) 14. Chadha, A., Yonghe, L., Das, S.K.: Group Key Distribution via Local Collaboration in Wireless Sensor Networks. In: Second Annual IEEE Communications Society Conference on Sensor and Ad Hoc Communications and Networks, pp. 46–54 (2005) 15. Tian, B., He, M.: A Self-healing Key Distribution Scheme with Novel Properties. International Journal of Network Security 7(1), 115–120 (2008) 16. Du, W., He, M.: Self-healing Key Distribution with Revocation and Resistance to the Collusion Attack in Wireless Sensor Networks. In: Baek, J., Bao, F., Chen, K., Lai, X. (eds.) ProvSec 2008. LNCS, vol. 5324, pp. 345–359. Springer, Heidelberg (2008)
Design a Hardware Mechanism to Utilize Multiprocessors on a Uni-processor Operating System Slo-Li Chu, Chih-Chieh Hsiao, and Pin-Hua Chiu Department of Information and Computer Engineering Chung-Yuan Christian University 200, Chung Pei Rd., Chung Li, 32023 Taiwan
[email protected], {s9224124,s9227241}@cycu.edu.tw
Abstract. The multiprocessor architecture for multimedia embedded systems becomes more popular, because of processor design and fabrication evolution. However the interprocessor communication is still an important problem in multiprocessor environments. In this paper, we propose a hardware interprocessor communication mechanism for a multi-core FPGA chip. Although the hardware/software develop tools do not support multi-core design in the target platform, we create a novel design flow to implement the multi-core under Linux with high speed communication mechanism. In the experiment results, the performance has at least 30% speedup when Dhrystone benchmark execute on the Xilinx ML310 platform which is redesign by our mechanism. Keywords: Multi-core, FPGA, Linux, Xilinx ML310, Inter-Processor Communication.
1 Introduction Nowadays, people use mobile phone, mp3 players and personal digital assistant everyday. And the application of these devices are become various, mobile phone can not only be a phone but also mp3 player, a video player or even a camera. People only need a mobile phone or PDA instead of carrying those devices individually when going out. In the environment of high integrated application, how to react for some situations immediately is an important issue. For example, how to stop videos playing on mobile phone and call back while someone calls in. In the environment of single processors, it is really difficult to make a real-time reaction cause the time wasting during context switch. Therefore, integrating several cores to single chip becomes essential stream of hardware development. There are still some problems in multiprocessor systems, such as utilization to system resources, connecting method between processors, compiler technology and operating system. In the traditional multi-core system, such as Core 2 Duo (as Fig. 1) [5], Athlon64 x2, there is no direct connection between processors. The only way to connect all processors is through system bus. And it must be plenty of latency while processor communicating with others. For example, the two processors must waste a lot of time during sharing memory and system bus while processing streaming data. A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 844–852, 2009. © Springer-Verlag Berlin Heidelberg 2009
Design a Hardware Mechanism to Utilize Multiprocessors
845
Fig. 1. Architecture of Intel Core 2 Duo
Even the operating systems, such as Linux, are poorly supporting to embedded multiprocessor system, and often waste too much time on scheduling. These problems can limit the overall performance of multiprocessor system. In the embedded development platform, Xilinx Virtex-II Pro and Virtex-IV FPGA chips provide the PowerPC 405 hardcore inside the chip. To address on high speed communication between processors, we drop the traditional architecture of multi-core processor and try to develop a different dual-core implementation method with Linux and a hardware/software design flow. In this paper, we propose a direct communication mechanism between two PowerPC 405 processors in Xilinx ML310 FPGA development platform (as Fig. 2).
Fig. 2. Xilinx ML310 Development Platform
846
S.-L. Chu, C.-C. Hsiao, and P.-H. Chiu
Even the current Linux kernel cannot handle dual PowerPC 405 but the hardware generation environment, Xilinx EDK (Embedded Development Kit) did not support this kind of hardware configuration, we still utilize the 2nd processor by using our mechanism. The organization of this paper is as following. In section 2, our previous work on multiprocessor scheduling is revealed. Section 3 presents the implementation of our mailbox mechanism. In section 4, we demonstrate the experimental results and the speedup obtained when our mechanism is used. Finally, section 5 gives the conclusion.
2 Previous Works In our previous study [3], we propose a tool, Monopoly for the dual Pentium 4 platforms with Linux kernel 2.6.11 [1][2][4][6][7]. In general, the Linux kernel will schedule the tasks in a fair manner between multiprocessor, but our mechanism is dynamically changing the kernel scheduling by users. The selected program will occupy the specified processor (except processor 0) when the program is executed by our tool. Processor 0
Processor 1
Processor 2
Processor 3
Task 0
Task 2
Task 3
Task 5
Task 1
Task 4
Fig. 3. A Snapshot of typical Linux scheduling
Processor 0
Processor 1
Processor 2
Processor 3
Task 0
Task 2
Task K
Task 5
Task 1 Task 3 Task 4
Task 3 Task 4 Tasks migrate to Processor 0 only Task K on this Processor
Fig. 4. When task 'K' execute by our tool
Design a Hardware Mechanism to Utilize Multiprocessors
847
In Fig. 3 & 4, when our mechanism started, the tasks will be removed from processor 2 to processor 1, then put task ‘K’ to processor 2 as shown Fig. 2. The other tasks cannot be arranged to the runqueue of processor 2 from this time. Oppositely, if there is not any program executed by Monopoly, the process scheduler of Linux will manage this processor automatically. The experimental results show when user starts the applications via our tool, it will achieve up to 5% ~ over 30% speedup by occupy processor 2 solely. This mechanism is suitable for the mission-critical applications which need burst computing power to reduce execution latency while the target platform has multiple processors and the OS supports multiprocessor configuration. However, most of the multi-core embedded system is lack of this architecture and OS capabilities. Then we proposed a hardware/software co-design mechanism to handle these problems in Xilinx ML310 in next section.
3 Implementation 3.1 Development Environment The target platform is Xilinx ML310, the main FPGA and processing chip is Virtex-II Pro (XC2VP30) which contain FPGA chip has 2 embedded PowerPC405 with extra 30,000 logic cells, and 2,400KBits BlockRAM. The target platform also includes 256Mbytes DDR Memory, Ethernet, USB, PCI physical chips and connectors. The integrated System ACE CF controller is deployed to perform board bring-up and to load applications from 512MB Compact Flash card. The hardware development environment is Xilinx ISE with EDK, which can generate whole pre-defined system with user-defined hardware modules. When we connect the two PowerPC405 to on the same PLB, we find that Xilinx EDK doesn’t support for multiprocessor design because it assume that users only use single PowerPC405 in the FPGA but not both of the cores at the same time. The software development environments, the standalone applications running in FPGA are built under Xilinx EDK. And the other applications running on Linux are built by our cross compilation toolchain under x86 Linux. Since MontaVista [7] doesn’t release Linux source code, we choose the PowerPC kernel in a branch of Linux development tree. These source codes are easy to get and build for custom kernel by our cross compiler. Although Linux kernel 2.4.25 supports SMP (Symmetric Multiprocessor) option for PowerPC405, but it lakes the corresponding system calls and settings. If connecting the 2nd PowerPC directly to the PLB as the 1st PowerPC, the console shows nothing when Linux boots. Since the Xilinx EDK and Linux do not support multi-core for PowerPC405, the difficulty of our research would be increase dramatically. Therefore we present a new mechanism mailbox in the next section. 3.2 Design of Our Mailbox Mechanism In this section, we propose a mechanism called mailbox, allow processors communicate with each other directly. The Fig. 5 is the default setting in EDK and Fig. 6 below is our multi-core design on the FPGA.
848
S.-L. Chu, C.-C. Hsiao, and P.-H. Chiu
Fig. 5. Block Diagram of Xilinx ML310
Fig. 6. Our Dual-Core Design
Comparing our design with Xilinx EDK’s default configuration, we add a PLB bus connected to 2nd PowerPC and initialize BlockRAM for the processor. According to the dual-port characteristic of BlockRAM, we connect one of the ports to the PLB bus connected of 1st PowerPC, and another port to the PLB bus connected of 2nd PowerPC. Then this BlockRAM will be a simple mailbox between processors. The two processors can communicate with each other through this mailbox. The Fig. 7 below indicates the address of the mailbox. Next, we design a simple program loader for the 2nd PowerPC. This simple program loader will wait for the signals on the mailbox. If the 1st processor indicates start/stop signal on the mailbox, the 2nd processor will receive this signal and start/stop the selected program. The code in Fig. 8 is the draft of simple program loader.
Design a Hardware Mechanism to Utilize Multiprocessors
849
Fig. 7. Memory Address of Mailbox
volatile int *start_signal; volatile int *program_addr; void (*prog)(void); start_signal = (void *)0xFA000000; program_addr = (void *)0xFA000008; //waiting for the start signal while( *start_signal != PPC1_AWAKE ); //set the start address of program prog = program_addr; //execute the program (*prog)(); //tell ppc0 the program is finished *start_signal = PPC1_DONE;
Fig. 8. The Draft code of Simple Program Loader
The first phase of our test is running standalone program in EDK environment without Linux booting. Because of the multi-level PLB design, the 2nd PowerPC processor cannot access DDR Memory, so the program and data executed on 2nd PowerPC processor must be in the user-defined region of mailbox or its initialized BlockRAM. When the 1st PowerPC write program to mailbox and put a signal on start/stop address, the program loader on 2nd PowerPC will execute the program in mailbox. Then 1st PowerPC can execute its tasks and wait for the signal of 2nd PowerPC on mailbox and get the answer back.
850
S.-L. Chu, C.-C. Hsiao, and P.-H. Chiu
Fig. 9. Communication between two PowerPC
The second phase is running our design with Linux. Because the operating system has its own memory map which maps physical addresses into virtual addresses. So we cannot use the physical address directly, instead we need to use the system call “mmap” to map the physical address of BRAM into virtual memory with Linux kernel’s MTD(Memory Technology Device) support enable (Fig. 9). When 1st PowerPC notify 2nd PowerPC to execute selected program via mmap, then the 1st PowerPC can continue its tasks in Linux and wait for finish of 2nd PowerPC. By building up these two parts of testing flow, the mailbox mechanism can be operated in Linux. From now on, we can operate our mailbox mechanism in standalone and Linux running environment both.
4 Experimental Results In experiment, we use the Dhrystone benchmark 2.1 to test how much speedup made by our mechanism. To fully utilize our mailbox mechanism, we do a little modification to the Dhrystone benchmark to suit with our requirement. The setting of our experimental environment, we disable the cache of PowerPC core, size the mailbox to 64Kbytes, the environment is Linux kernel 2.4.25 which is compiled by CrossCompiler GCC 2.95.3. Running Time 60 50 40 30 20
Time
10 0 N/A
100Mhz
200Mhz
300Mhz
400Mhz
Fig. 10. The Running Time for Dhrystone
Design a Hardware Mechanism to Utilize Multiprocessors
851
Speed Up 33.5 33 32.5 32
Speed Up
31.5 31 30.5 30 100Mhz
200Mhz
300Mhz
400Mhz
Fig. 11. The Speedup of Dhrystone
In the Fig. 10 and 11, the column of N/A means that only 1st PowerPC is running and the others columns means the core speed of 2nd PowerPC. Fig. 10 shows the total time that executes the same number of runs in Dhrystone benchmark. Figure 11 shows the speedup of our mechanism, the column indicates the percentage of speedup. From Fig. 10 and 11, there’s at least 30% performance enhancement when Dhrystone benchmark running by our mechanism. When Dhrystone is running with our mechanism, the core speed of 2nd PowerPC seems no effect to the result. According to our standalone testing, BlockRAM is very efficiency when there’s no rapid access to it. But when there is rapid access to the BlockRAM, the speed of BlockRAM will be decrease. Although the Xilinx claim that their BlockRAM can run with the speed 100Mhz on FPGA and finish access in 1 cycle, our result indicates that it is not efficiency as we think before. Just like when we running Dhrystone benchmark on BlockRAM, the speed limited by the BlockRAM. But the performance enhancement of our mechanism is still obvious to the original one.
5 Conclusion On the FPGA development environment, according to the reconfigurable characteristic of FPGA, we can design our own dual-core design on the FPGA and try to utilize the resource of processor under the dual-core design. In the paper, we provide a simple mailbox mechanism that two PowerPC processors can directly communicate by using our mechanism and cooperative execute one or more program. Even the OS and Xilinx EDK do not support the multiprocessor configuration, we can still use this mechanism by access some specific memory region directly or system call under Linux to activate the second processor. Since the OS could not sense the existence of the second processor, the scheduler of the OS would not waste too many computational resources on multiprocessor scheduling. In the experimental results, we can see that our mechanism provide at least 30% performance enhancement. If we can eliminate the access time to the BlockRAM device, we believe the performance can be better.
852
S.-L. Chu, C.-C. Hsiao, and P.-H. Chiu
Multi-core will become the mainstream in the territories of multimedia embedded system, the resources in such system is limited, so how to get better utilization of the resources will be an important problem. In this study, although both OS and EDK do not support multiprocessor, we provide a mechanism that multiprocessor system still can be operated and accelerate CPU-bound programs. Hope this will be a solution to the design of multimedia embedded.
Acknowledgements This work is supported in part by the National Science Council of Republic of China, Taiwan under Grant NSC 97-2221-E-033 -018
References 1. Allen, G.E., Evans, B.L.: Real-time Sonar Beamforming on Workstations Using Process Networks and POSIX threads. IEEE Trans. Signal Processing, 921–926 (March 2000) 2. Aas, J.: Understanding the Linux 2.6.8.1 CPU Scheduler. Silicon Graphics, Inc. (2005) 3. Chu, S.L., Hsiao, C.C., Chiu, P.H., Lin, H.C.: User Adjustable Process Scheduling Mechanism for a Multiprocessor Embedded System. In: 6th WSEAS International Conference on Applied Computer Science (2006) 4. Intel Corp. Intel® CoreTM Microarchitecture, http://www.intel.com/technology/ architecture/coremicro/index.htm 5. Liao, I.T., Tan, K.S., Tseng, S.Y., Chen, W.F.: Interprocessor Communication for PAC. ITRI SoC Technical Journal 002 6. Love, R.: Linux Kernel Development. SAMS, Developer Library Series (2003) 7. Morgan, K.: Preemptible Linux: A Reality Check. White Paper, MontaVista Software, Inc. (2001) 8. Piel, E., Marquet, P., Soula, J., Dekeyser, J.L.: Asymmetric Real-Time Scheduler on MultiProcessor Architecture. In: 20th International Parallel and Distributed Processing Symposium, pp. 25–29 (2006) 9. Valois, J.D.: Implementing Lock-Free Queues. In: Seventh International Conference on Parallel and Distributed Computing Systems (1994)
Refinement Proposal of the Goldberg’s Theory* Jérome Gallard1,**, Adrien Lèbre1, Geoffroy Vallée2, Christine Morin1, Pascal Gallard3, and Stephen L. Scott2 1 IRISA, INRIA Rennes Bretagne Atlantique, Rennes, France {jerome.gallard,adrien.lebre,christine.morin}@irisa.fr 2 Oak Ridge National Laboratory, Oak Ridge, USA {valleegr,scottsl}@ornl.gov 3 KERLABS, Rennes, France
[email protected]
Abstract. Virtual Machines (VM) allow the execution of various operating systems. VM mechanisms provide several functionalities which are nowadays strongly appreciated by developers and administrators (isolation between applications, flexibility of resource management...). So, “virtualization” has become a buzz word and a lot of “virtualization” solutions have been proposed, each providing particular functionalities. Goldberg proposed to classify virtualization techniques in two models (Type-I and Type-II), which does not enable the classification of latest “virtualization” technologies such emulation, partitioning... We propose an extension of the Goldberg model in order to take into account latest “virtualization” mechanisms. After giving general definitions, we show how our proposal enables to rigorously formalize the following terms: virtualization, emulation, abstraction, partitioning, and identity. We show that a single virtualization solution is generally composed by several layers of virtualization capabilities, depending on the granularity of the analysis. In this manner, our model allow us to classify virtualization technologies according to their performance, similarity and portability. Keywords: Goldberg Virtualization Theory, Emulation, Abstraction, Partionning, Identity.
1 Introduction Nowadays, the term “virtualization” is used to designate many solutions (such as abstraction, emulation, and partitioning) that do not necessarly have a clear formal definition. In 1970’s, because virtualization was already a buzz word *
The INRIA team carries out this research work in the framework of the XtreemOS project partially funded by the European Commission under contract #FP6-033576. ORNL’s research sponsored by the Laboratory Directed Research and Development Program of Oak Ridge National Laboratory (ORNL), managed by UT-Battelle, LLC for the U. S. Department of Energy under Contract No. DE-AC05-00OR22725. ** Corresponding author: phone: +33 2 99 84 25 56, fax: +33 2 99 84 71 71, mailing address: IRISA, Campus de Beaulieu, 35 042 Rennes Cedex, FRANCE. A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 853–865, 2009. © Springer-Verlag Berlin Heidelberg 2009
854
J. Gallard et al.
(used in several contexts with several definitions), Goldberg introduced an original definition of virtualization: A system in which the virtual machine is a hardware-software duplicate of a real existing machine, in which a non-trivial subset of the virtual machine’s instructions execute directly on the host machine in native mode [1–3]. Initially, the main goal of virtualization was to enable time-sharing on big mainframes having a monotask operating system (OS). However, nowadays, with more and more performant hardware, virtualization is used for many different purposes such as isolation, server consolidation, and application portability. As a consequence, lots of virtualization technologies are developed and the latest techniques don’t always fit in the Goldberg classification. For instance, containers, which allow processes to run concurrently on top of the same OS, based on their own view of available resources, can be considered in some extent as a virtualization mechanism which is not adressed by the Goldberg classification. In this document, we propose an extension of the Goldberg model in order to take into account and formaly define latest “virtualization” mechanisms. After giving general definitions, we show how our proposal enables to rigorously formalize the following terms which are commonly used nowadays: virtualization, emulation, abstraction, partitioning, and identity. Doing so, we emphasize the fact that a single virtualization solution is generally composed by several layers of virtualization capabilities, depending on the granularity of the analysis. Our model allow us to classify virtualization technologies to see if they are similar, performants, and portable according to the description we use. This paper is not a negative criticism of the Goldberg theory and our refinement is actually based on Goldberg’s definitions. To our best- knowledge, no works have been done to give formal definitions of virtualization solutions and their functionalities. The remainder of this paper is organized as follows: Section 2 introduces the context and defines common terms associated to virtualization. In addition, this section exposes Goldberg work. Section 3 proposes a refinement of the Goldberg’s model. This refinement allows us to specify concepts such as virtualization, emulation, abstraction, partitioning, and identity. Section 4 shows in which way the presented refinement can be used for the classification of some “virtualization solutions”. Section 5 exposes the analysis of typical existing systems with our refinement. Finally, Section 6 concludes.
2 Background Virtualization solutions provide several capabilities which are nowadays strongly appreciated by developers and system administrators. Before seeing the limitations of the Goldberg theory with regard to these latest solutions, we present his fundamental classification. 2.1 Goldberg Classification In 1973, Goldberg proposed a formalization of the virtualization concept and described a classification based on two types: Type-I and Type-II [4]. His model
Refinement Proposal of the Goldberg’s Theory
855
relies on two functions, φ and f [4, 5]. The function φ makes the association between processes running on the VM and resources exposed within the VM; whereas the function f makes the association between resources allocated to a VM and the bare hardware. Functions φ and f are totaly independant, as φ is linked to processes in the VM, f is linked to resources. Definition of the f function of Goldberg. Let: – V = {v0 , v1 , ..., vm } be the set of virtual resources.
– R = {r0 , r1 , ..., rn } be the set of resources present in the real hardware.
Goldberg defines f : V → R such that if y ∈ V and z ∈ R then
f (y) = z, if z is the physical resource for the virtual resource y. Definition of the recursion in the meaning of Goldberg. Recursion could be reached interpreting V and R as two adjacent levels of virtual resources. Then, the real physical machine is level 0 and virtual resources is level n. As a consequence, f does the mapping between level n and level n + 1. Recursion example. If f1 : V1 → R, f2 : V2 → V1 , then, a level 2 virtual resource name y is mapped into f1 (f2 (y)) or f1 of2 (y). Then, Goldberg generalized this case with n-recursion: f1 of2 o...ofn (y). Definition of the φ function of Goldberg. Let: – P = {p0 , p1 , ..., pj } be the set of processes. Goldberg defines φ : P → R such that if x ∈ P , y ∈ R then φ(x) = y, if y is the resource for the process x. Running a virtual machine: f oφ. Running a process on a virtual machine means running a process on virtual resources. Thus, if processes P = {p0, p1, ..., pj } run on the virtual machine composed of virtual resources V = {v0, v1, ..., vm }, then φ : P → V . The virtual resources, in turn, are mapped into their equivalents: f oφ : P → R. General Virtual Machine. From the previous statement, Goldberg defined the execution of a virtual machine: f1 of2 o...ofn oφ. Figure 1 depicts a simplified view of the Goldberg map composition [4]. The composition starts by applying φ to the selected process P . The result of this composition is a set of resources R. This set of resources is virtual (level > 1) or
Fig. 1. Simplified view of the Goldberg map composition
856
J. Gallard et al.
not (level = 0). If the level is equal to 0, the composition is done. Otherwise, the composition applies f to the obtained set of virtual resources. This is done until the level reachs 0. From φ and f , Goldberg identified two different system virtualization types: – Type-I : the general case of the definition of Goldberg, -- Type-II : the case where f does the mapping between resources of level n + 1 to processes of level n. 2.2 Goldberg Classification Limitations Nowadays, in addition to the Goldberg Type-I and Type-II models, two new approaches have to be considered: system- and process-level virtualization. System-level virtualization (issued from the Goldberg definition). This approach aims at virtualizing a full OS: a virtual hardware is exposed to a full OS within a VM. The system running in a VM is named a guest OS. The VM cannot execute privileged instructions at the processor level. To access the physical devices, drivers are hosted in a privileged OS, called host OS. Moreover, virtual machines run concurrently and their execution is scheduled by a hypervisor. The hypervisor is also in charge of forwarding all privileged instructions from VMs to the host OS. Type-I virtualization is when the hypervisor is run directly on the bare hardware, e.g., Xen [6] whereas Type-II virtualization is when the hypervisor is run on the host OS, e.g., QEMU [7] and VMware Server [8]. Process-level virtualization. It consists of running several processes concurrently on top of the same OS, each having its own view of available resources. OpenVZ [9], chroot [10], and containers capabilities provided by recent kernels are examples of process-level virtualization. Based on Goldberg terminology, it means the function φ realizes (this is done by the kernel of the host OS) the mapping of the virtualized process to the resources (virtual or not), and the function f is the standard mathematical function identity (the virtualized resources are already the same as the physical resources, and therefore the composition is already done). The present work aims at refining the Goldberg model in order to include new virtualization technologies. Our refinement is based on the extension of two concepts introduced by Goldberg: primitives constructs and derived constructs [2]. Primitive constructs deal with hardware status whereas derived constructs extend the hardware by mapping processes. In other terms, primitive constructs deals with physical value of the hardware (for instance 2 GB of disk space) whereas derived constructs deals with software intervention (for instance partition ext3 ). Primitive and derived constructs seem to be linked directly to the function f , however, to our bestknowledge, this never has been clarified and studied.
3 Refinement of the f Goldberg Function In this section, we propose a refinement of the Goldberg theory which allows us to formaly define the terms virtualization, emulation, abstraction, partitioning, and identity.
Refinement Proposal of the Goldberg’s Theory
857
Primitive constructs and derived constructs deal with two different aspects of resources, respectively their physical and logical characteristics. The goal of our proposal is to refine these two notions in order to improve the virtualization definitions. Therefore, in the rest of the document, we focus only on the physical resource set R, the virtual resource set V and the f function proposed by Goldberg. Our refinement doesn’t change in any way definitions or semantics given by Goldberg. Effectively, we just add new ”attributes” to the already proposed definitions of Goldberg, that is to say, our refinement is applicable on a system only if the definitions of Goldberg are applicable. 3.1 Definitions Definition 1 (Capacity, functionality, and status attributes). A resource (M ), virtual or not, is characterized by a set of attributes. Capacity attributes : the atomic attributes that define a resource (M). Functionality attributes : the atomic operations provided by a resource (M). Status attributes : the resource status that is exposed to the users. Take the example of a hard disk (HDD). We could describe this HDD by: a capacity attribute: 10 GB of disk space; functionality attributes: read and write operations; and a status attribute: ext3 partition. Definition 2 (Attribute Sets). We can also define attribute sets: Set of capacity attributes : C = {attributeC1 , attributeC2 , ..., attributeCk } is a set of capacity attributes. We note Cn the set of capacity attributes at level n, hence Cn ⊆ C . Set of functionality attributes : Q = {attributeQ1 , attributeQ2 , ..., attributeQk } is a set of functionality attributes. We note Qn the set of functional attributes at level n, hence Qn ⊆ Q. Set of status attributes : E = {attributeE1 , attributeE2 , ..., attributeEk } is a set of status attributes. We note En the set of status attributes at level n, hence En ⊆ E. With our example, we have attributeC1 = 10 GB, attributeQ1 = attributeQ2 = write, and attributeE1 = ext3.
read,
Definition 3 (Resource refinement). From the previous definitions, we refine the f function of Goldberg by giving three new functions to characterize a resource (M ) (virtual or not): – c, a function from a set of capacity attributes to another set of capacity of attributes, i.e., cn+1 : Cn+1 → Cn . – q, a function from a set of functionality attributes to another set of functionality attributes, i.e., qn+1 : Qn+1 → Qn . – e, a function from a set of status attributes to another set of status attributes, i.e., en+1 : En+1 → En .
858
J. Gallard et al.
Let’s go back to our HDD example, let hd ∈ R corresponding to our physical HDD resource with f : hdn+1 (1 GB, ext2, read, write) → hdn (10 GB, ext3, read, write). This could be noted: – cn+1 : hdn+1 (1 GB) → hdn (10 GB), – qn+1 : hdn+1 (read, write) → hdn (read, write), – en+1 : hdn+1 (ext2) → hdn (ext3).
It means that the HDD provides: (i) at level n, 10 GB of disk space, and ext3 file system, and read and write operations, and (ii) at level n + 1, 1 GB of disk space with a ext2 file system with the same read and write operations. In that particular case, functionality attributes have not been modified. In the rest of this document, we adopt the following notation:
Set / Level n + 1 n Resource (virtual or not): R Ӣ V {hdn+1 } {hdn } Capacity: C {1 GB } {10 GB } Functionality: Q {read, write} {read, write} Satus: E {ext2} {ext3} Definition 4 (Instructions). We define instructionn (f nct) a function giving the number of instructions necessary to execute the function f nct at level n. For instance, take the functionality “+”: (i) in upper language level, we could use the operator + (i.e., x + y ), or (ii) in lower language level, we had to use operator add, move (i.e., move x, move y, add ). In this example, one instruction is necessary with the upper language level whereas 3 instructions are necessary on the lower language level. Then, we could write: (i) instructionn+1 (+) = 1, and (ii) instructionn (+) = 3. 3.2 Refinement Proposal Notation used in this section: – let set A and set B, we note A = B if A ∩ B = ∅ – let set A and set B, we note A = B if A ∩ B = ∅ – let AND and NOT the binary operator ∧ and ¬. Based on the previous definitions, we can designate (see Figure 2): Definition 5 (Virtualization). (Qn+1 = Qn ) AN D (En+1 = En ) ⇒ V irtualization (this definition is from the Goldberg definition of virtualization). Definition 6 (Identity). (V irtualization) AN D (Cn+1 = Cn ) ⇒ I dentity Definition 7 (Partitioning). (V irtualization) AN D (Cn+1 = Cn ) ⇒ P artitioning
Refinement Proposal of the Goldberg’s Theory
859
Definition 8 (Emulation). N OT (V irtualization) ⇒ Emulation Definition 9 (Simplicity). We define the simplicity by the comparison of the number of instructions needed to execute a functionality at a level n and n + 1: ½
simplicity(f nct) = 0, if instructionn+1 (f nct) ≥ instructionn (f nct) simplicity(f nct) = 1, if instructionn+1 (f nct) < instructionn (f nct)
Definition 10 (Abstraction) (Emulation) AN D (∀f nct ∈ Qn+1 , simplicity(f nct) = 1) ⇒ Abstraction We start the analysis with a virtual resource M ∈ V composed of several attributes. According to the resource’s attributes, a given system provides virtualization or emulation (e.g., abstraction, partitioning, identity). Then, by recursivity, it is possible to take a subset of these attributes (subsetOfAttributes ) and to start the analysis on this subset. Doing so, it is possible to refine the virtualization capabilities of such systems.
Fig. 2. Representation of our refinement Goldberg gives the definition of virtualization and emulation, with our refinement, we include the definition of abstraction, partitioning and identity.
4 Refined Model Application All examples we use are described with our refinement of the Goldberg theory. Doing so, we show clearly the meaning of virtualization, emulation, abstraction, partitioning, and identity.
860
J. Gallard et al.
4.1 Emulation and Abstraction Based on our model, the following example shows emulation in a general way:
Set / Level n + 1 n R Ӣ V {objectn+1 } {objectn } C {attributeC1 } {attributeCA } Q {attributeQ1 } {attributeQB , attributeQC } E {attributeE1 } {attributeEA } Thus, we have two cases: emulation and emulation-abstraction. Emulation (see Definition 8) adds functionalities to level n + 1 that are not available at level n: simplicity(attributeQ1 ) = 0. Abstraction (see Definition 10) reduces the functional complexity exposed from a level n to a level n+1. Moreover, if simplicity(attributeQ1 ) = 1, then this is emulation-abstraction. From the end-user point of view, it is easier to use the level n + 1 rather than the level n. Functionalities at level n + 1 are made by functionalities provided by level n. It is not possible, from level n + 1, to use directly any functionalities provided by level n. Abstraction is a particular case of emulation associated to the notion of simplification. The case of a calculator providing at level n + 1 the functionality “+” and at level n the functionalities “move” and “add” illustrates the concept of abstraction:
Set / Level n + 1 n R Ӣ V {calculatorn+1 } {calculatorn } C {} {} Q { +} {add, move} E {} {} simplicity(+) = 1. Emulation and Emulation-Abstraction are not performant technics because of the code is not exectuted directly on the bare hardware. 4.2 Virtualization - Identity Based on our model, the following example shows virtualization-identity in a general way:
Set / Level n + 1 n R Ӣ V {objectn+1 } {objectn } C {attributeC1 } {attributeC1 } Q {attributeQB } {attributeQB } E {attributeEA } {attributeEA } Identity (see Definition 6) is when the action executed in a virtualized environment is the same than the one directly executed on the resources. With identity, the whole resource at level n is exposed to the upper level.
Refinement Proposal of the Goldberg’s Theory
861
Now, we could instantiate this general example to a VM that is directly accessing the hard disk. We define hdn+1 the VM hard disk and hdn the real hard disk:
Set / Level n + 1 n R Ӣ V {hdn+1 } {hdn } C {2 GB } {2 GB } Q {powersaf e} {powersaf e} E {ext2} {ext2} Identity is the most performant technic because of that the code is directly executed on the bare hardware. 4.3 Virtualization - Partitioning Based on our model, the following example shows virtualization-partitioning in a general way:
Set / Level n + 1 n R Ӣ V {objectn+1 } {objectn } C {attributeC1 } {attributeCA } Q {attributeQB } {attributeQB } E {attributeEA } {attributeEA } Partitioning (see Definition 7) is the creation of separates sub-parts of a resource at level n, each part being exposed at level n + 1. Moreover, each part is isolated from others by hardware or software mechanisms. For a given subpart of a resource, partitioning allows identity. For instance, if hdn+1 is the VM hard disk, and hdn the physical hard disk, we have:
Set / Level n + 1 n R Ӣ V {hdn+1 } Rn = {hdn } C {2 GB } Cn = {10 GB } Q {powersaf e} Qn = {powersaf e} E {ext2} En = {ext2} Partitioning is performant (according to the number and size of partitions) because of this technic allows the code to be executed directly on a sub-part of the bare hardware. 4.4 Virtualization Granularity Problem The distinction between emulation and virtualization is difficult and actually depends on the granularity used to describe a system. For instance, with a calculator that provides at level n the operations “+, −, ∗, and /”, and at level n + 1 the operations “%, and +”, we could write:
862
J. Gallard et al.
Set / Level n + 1 n R Ӣ V {calculatorn+1 } {calculatorn } C {} {} Q {%, +} {+, ì, Ӓ, /} E {} {} simplicity(%) = 1, simplicity(+) = 0. In this case, Qn+1 = Qn , i.e., this is emulation (see Definition 8). Intuitively, we understand that the function % is emulated by the functions +, ∗, and /. In addition, the simplicity of % is 1, therefore it is abstraction. Moreover, the level n + 1 provides the function +; this function is not emulated. In fact, from the + operation point of view, this is virtualization - identity. This example shows that a system could be composed of emulation and virtualization according to the analysis granularity (see Figure 2): in the first analysis, we show that the system provides emulation, and in the second analysis, for a subset of functionalities, the system provides identity. Here, it is important to note that our refinement uses the same mechanism of recursion that Goldberg describes in his theory.
5 Use Cases In this section, we analyse the CPU usage of several well-known common alization solutions. However, to save space, we only put the analysis container virtualization solution. More information concerning Type-I and II virtualization solutions analysis could be found in our reseach report We define a CPU by: – C={%_time} with % time is the percentage processor,
of time allocated
virtuof the Type[11]. to the
– Q = {user instructions, privileged instructions} with user instructions and privileged instructions the user and privileged instructions of the processor, – E = {architecture} with architecture the type of the processor. 5.1 Containers Containers, such as OpenVZ [9], create isolated, secure “boxes” on a single physical server, enabling better server utilization and ensuring that applications do not conflict with each other. Each container performs and executes exactly like a stand-alone server; containers can be rebooted independently from the host OS. With this kind of system, φ makes the association between processes and resources provided by the containers; and, f makes the association between resources provided by containers and physical resources. Therefore, f is the identity ; the resource provided in containers is the same as the real resource.
Refinement Proposal of the Goldberg’s Theory
863
We define user-instr0 ∈ Q and privileged-instr0 ∈ Q the sets of functionalities provided by the CPU. At level 1, we define user-instr1 ∈ Q and user-instr1 ∈ Q the set of virtual functionalities provided by the container. With a container (like OpenVZ), user-instr0 = user-instr1 and privileged-instr0 = privileged instr1. In addition, we considere that the resources provided by the bare hardware, at level 0, are available 100% of the time and, at level 1, each container gets y% of the time (the time of the physical CPU is shared between containers). Moreover, we define architecture1 the architecture of the processor at level 1, and architecture0 the architecture of the processor at level 0. With the container approach (like OpenVZ), architecture1 = architecture0 .
Set / Level 1 0 R Ӣ V {cpu container1 } {cpu container0 } C {y%C P U } {100%C P U } Q {user instr0 } {user instr0 } {privileged instr0 } {privileged instr0 } E {architecture0 } {architecture0 } According to Definition 7, this system provides partitioning which performances are similar to the native ones. However, it is not possible to migrate a container from a physical architecture to a different physical architecture and it is not possible to provide on a container a different architecture that the underlying physical one. This results conforms with the common sense. 5.2 Summary In this section we give a comparison of several well-known virtualization systems from the CPU point of view using our refinement. We analyse a total of five systems. One (Containers: OpenVZ) has been already analysed in the Section 5. Four systems (Type-I: XEN 3.0, Type-II: QEMU, VMware, QEMU+KQEMU) have to be analysed in the same way as the first one. To save space, we just put the result of our analysis in this pa- per (more information could be found in our reseach report [11]). Table 1 shows a summary of our analyse. With this comparison, we show that, Type-I virtualization (as XEN 3.0), Type-II virtualization (as VMware or QEMU + KQEMU) and container approach (OpenVZ) are very similar in term of virtualization capabilities from the CPU point of view: they made partitioning/identity or emulation of just a subpart of instructions of the processors (performance near to the native one). However for this previously cited virtualization system, it is not possible to migrate one VM from one physical architecture to another with a different kind of architecture. Effectively, this is not the same for QEMU who is able to emulate the CPU instructions completely.1
1
Partitioning/Identity.
864
J. Gallard et al.
Table 1. Comparison between several kind of virtualization systems from the CPU point of view 2 CPU Global Performance Prob. of port.3
XEN 3.0 Part./Id.1 Partitioning Near native yes
VMWare Emul.(priv instr)2 Emul.(priv instr) Near native yes
QEMU Emul. Emul. Slow no
QEMU+KQEMU Emul.(priv instr) Emul.(priv instr) Near native yes
OpenVZ Part./Id. Partitioning Near Native yes
6 Conclusion Goldberg defines virtualization with two functions φ and f : φ does the mapping between virtualized processes and resources (virtualized or not), whereas, f does the mapping between virtualized resources and real resources. Based on these two functions, Goldberg defines two kinds of system-level virtualization: Type-I and Type-II. However, we show that some process-level virtualizations, such as containers, do not perfectly fit with the Goldberg classification. In this document, we propose a refinement of the Goldberg functions, based on the primitive and derived constructs proposed by Goldberg. This allows us to specify systems that do not belong to Type-I or Type-II systems. In addition, we have extended the formal Goldberg definition for virtualization and emulation in order to introduce the abstraction, partitioning, and identity concepts. Doing so, we emphasis the fact that, even with a single virtualization solution (for instance containers), the virtualization capabilites may differ, depending on the virtualization granularity. In other words, one complex virtualization system could integrate, according to the granularity of the analysis, several virtualization capabilities. We presented how different analysis granularities can be applied to containers. Our refinement of the Goldberg model allows us to strictly classify available virtualization solutions. Our model allow us to classify virtualization technologies to see if they are similar, performants, and portable according to the description we use. This could help developpers or users of VMs to choose a certain type of mechanism or another one. We think that our model can be extended to systems such as Java Virtual Machines and operating systems. In other terms, it could be interesting to see if a JVM, an OS, or any computing system, can be analyzed with the Goldberg theory and our refinement (first elements of response could be seen in the research report [11]).
References 1. Goldberg, R.P.: Virtual machines: semantics and examples. In: Proceedings IEEE International Computer Society, Conference, Boston, Massachusetts (1971) 2. Gagliardi, U.O., Goldberg, R.P.: Virtualizeable architectures. In: Proceedings ACM AICA International Computing Symposium, Venice, Italy (1972) 2
Emulation(privileged instructions): this system use only emulation for privileged in structions and partitioning/identity for user instructions. 3 Problem of portability.
Refinement Proposal of the Goldberg’s Theory
865
3. Amdahl, G.M., Blaauw, G.A., Brooks Jr., F.P.: Architecture of the ibm system/360. IBM J. Res. Develop. 44(1/2) (1964) 4. Goldberg, R.P.: Architecture of virtual machines. In: AFIPS National Computer Conference (July 1973) 5. Popek, G.J., Goldberg, R.P.: Formal requirements for virtulizable third generation architectures (July 1974) 6. Barham, P., Dragovic, B., Fraser, K., Hand, S., Harris, T., Ho, A., Neugebauer, R., Pratt, I., Warfield, A.: Xen and the art of virtualization. In: SOSP 2003, Bolton Landing, New York, USA (October 2003) 7. Bellard, F.: Qemu, a fast and portable dynamic translator. Technical report, USENIX Association (2005) 8. VMware: Vmware server (2007), http://www.vmware.com/products/server/ 9. OpenVZ: Openvz welcome page (2007) , http://wiki.openvz.org/Main_Page 10. GNU: Chroot (2007), http://www.gnu.org/software/coreutils/manual/ coreutils.html#chroot-invocation 11. Gallard, J., Gallard, P., Lebre, A., Morin, C., Scott, S.L., Vallée, G.: Refinement Proposal of the Goldberg’s Theory. Research Report: RR-6613 (2008), http://hal.inria.fr/inria-00310899/en/
Variable Dimension Space Audio Scrambling Algorithm Against MP3 Compression Huan Li1,2, Zheng Qin1, Liping Shao1, Shanjun Zhang3, and Bin Wang2,* 1
School of Electronics and Information Engineering, Xi’an Jiaotong University 710049, Xi’an, Shanxi, China 2 Department of Computer Science of Dongguan University of Technology 523808, Dongguan, Guangdong, China
[email protected] 3 Department of Computer Science, Faculty of Science, KanagawaUniversity Kanagawa, Japan
Abstract. A novel Variable Dimension Space Audio Scrambling Algorithm Against MP3 Compression is proposed. The algorithm is implemented in audio position space, which changes the dimension of coordinates and uses arbitrary matrices to scramble audio. The scrambled audio was segmented and a sequence number is embedded in the front of each segment to discriminate different segments. The proposed method can increase the combination of encrypting parameters, which increases the difficulty being attacked; random generated high dimensional transform matrix has no fixed period and has no special restriction on the audio length; a sequence number can be used to determine the each segment audio positions, so the scrambled audio compressed by MP3 can be recovered. Experiments show the proposed algorithm is validity in audio scrambling, low cost in recovering the scrambled audio and still has a wonderful one time scrambling performance. The proposed algorithm is robust in enduring MP3 attacks. Keywords: Variable Dimension, Audio Scrambling, Arbitrary Matrix, Mp3 compression.
1 Introduction Due to the open nature of internet, the chances of digital information being illegal intercepted, modified and ravaged are being improved, which makes the information security becomes an important and urgent issue. In recent years, people have obtained some useful results such as image watermarking, visual cryptology, information sharing and image scrambling, etc. Among them, the scrambling technique is a basic work, which can be used in pre-process or post-process of information hiding, information sharing and digital watermarking, etc. The basic idea of image scrambling method is to disarrange the position or gray value of pixel in image, so that the original image cannot be recognized. At present, *
Corresponding author.
A. Hua and S.-L. Chang (Eds.): ICA3PP 2009, LNCS 5574, pp. 866–876, 2009. © Springer-Verlag Berlin Heidelberg 2009
Variable Dimension Space Audio Scrambling Algorithm Against MP3 Compression
867
many scrambling methods have been proposed, such as methods based on Arnold transformation [1-2], magic square [3], John Conway’s game [4], Fibonacci-Q transformation [5], knight’s tour [6], etc. Comparing with the image scrambling methods, the audio scrambling methods are relatively less [7]. Because compared with Human Video System (HVS), Human Auditory System (HAS) is more sensitive to noise, at the same time because the audio is a one-dimensional sequence, the image scrambling methods can’t directly used to audio. The conventional audio scrambling method has the following deficiencies: the combination of encrypting parameters is too less; it has a fixed period, which is easy to be attacked; it has poor value on against MP3 compression. To address these problems in one-dimensional linear mapping, based on early work [8], we proposed a novel Variable Dimension Space Audio Scrambling Algorithm Against MP3 Compression. The proposed algorithm uses variable dimension operation to change the dimension of coordinates and uses arbitrary matrices to scramble the original audio. The scrambled audio was segmented and a sequence number is embedded in the front of each segment to discriminate different segments. Experiments show that the proposed algorithm is validity in audio scrambling, low cost in recovering the scrambled audio and still has a wonderful one time scrambling performance. It is robust in enduring MP3 attacks.
2 The Relevant Work In this section, we give the definition of matrix transformation, the procedure of variable dimension operation, and the method of a sequence number embedded in. 2.1 Matrix Transformation The basic idea of algorithm is coming from the high dimension matrix transformation. Definition 1: High dimensional matrix transformation n For a given m×m×…×m (mn) super cube space, let x =(x , x ,…, x ) denote the element coordinate in this super cube space and (y1, y2,…,yn) be the mapped element coordinate. The following is the high dimensional matrix transformation: ⎡ y1 ⎤ ⎡ x1 ⎤ ⎢y ⎥ ⎢x ⎥ (1) ⎢ 2 ⎥ = A ⎢ 2 ⎥ m od m n× n ⎢# ⎥ ⎢# ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ yn ⎦ ⎣ xn ⎦ Where An×n is an n×n integer coefficients matrix and the determinant of An×n (|An×n |) is a relative prime of m. At present, the prevalent scrambling methods are to use special matrices such as high dimensional Arnold transformation matrix [2], Fibonacci-Q transformation matrix [5], A-type Arnold transformation matrix [9], B-type Arnold transformation matrix [9] and T-matrix [10], etc. The special matrices decrease the security in fact. To address the problem of arbitrary matrix generation, in [8], we give a method in generating a random high dimensional scrambling matrix A and its corresponding integer coefficients inverse transformation matrix A’. 1
2
n
868
H. Li et al.
2.2 The Variable Dimension Operation The objective of variable dimension operation is changing the dimension of audio sequence and then use the arbitrary high dimention matrix to scramble it. The variable dimension operation includes two sub-operations: dimension increasing operation and dimension decreasing operation. The dimension increasing operation is used to increase the one-dimensional audio coordinate into a high dimension space coordinate; the dimension decreasing operation is used to decrease the mapped high dimension space audio coordinate into a one-dimensional audio coordinate. Definition 2: Dimension Increasing Let L denote the audio sequence length, x denote the audio position coordinate, x [1, L]. In order to get an n-dimensional audio coordinate (xn, xn-1, … , x1) m , the dimension increasing operation is defined in Eq.2, where m satisfies (m-1)n