Simulation of Local Area Networks Simulation of Local Area Networks Matthew N 0.Sadiku, Ph.D I Associate Professor Department of Electrical Engineeing Temple University Philadelphia, Pennsylvania Mohammad Ilyas, Ph.D Professor Department of Computer Science and Engineering Florida Atlantic University Boca Raton, Boca Raton London New York CRC Press is an imprint of the Taylor & Francis Group, an informa business First published 1995 by CRC Press Taylor & Francis Group 6000 Broken Sound Parkway NW, Suite 300 Boca Raton, FL 33487-2742 Reissued 2018 by CRC Press © 1995 by CRC Press, Inc CRC Press is an imprint of Taylor & Francis Group, an Informa business No claim to original U.S Government works This book contains information obtained from authentic and highly regarded sources Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint Except as permitted under U.S Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers For permission to photocopy or use material electronically from this work, please access www.copyright.com (http:// www.copyright.com/) or contact the Copyright Clearance Center, Inc (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400 CCC is a not-for-profit organization that provides licenses and registration for a variety of users For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe Library of Congress Cataloging-in-Publication Data Sadiku, Matthew N O Simulation of local area networks / Matthew N O Sadiku, Mohammad Ilyas p cm Includes bibliographical references and index ISBN 0-8493-2473-4 Local area networks (Computer networks) Mathematical models I Ilyas, Mohammad, 1953- II Title TK5105.7.S22 1994 004.6’8’01135133—dc20 DNLM/DLC for Library of Congress 94-23413 A Library of Congress record exists under LC control number: 94023413 Publisher’s Note The publisher has gone to great lengths to ensure the quality of this reprint but points out that some imperfections in the original copies may be apparent Disclaimer The publisher has made every effort to trace copyright holders and welcomes correspondence from those they have been unable to contact ISBN 13: 978-1-315-89753-0 (hbk) ISBN 13: 978-1-351-07663-0 (ebk) Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com and the CRC Press Web site at http://www.crcpress.com Dedicated t o our families: Chris, Ann, and Joyce Parveen, Safia, Omar, and Zakia PREFACE One of the growing areas in the communication industry is the internetworking of the increased proliferation of computers, particularly via local area networks (LANs) A LAN is a data communication system, usually owned by a single organization, that enables similar or dissimilar digital devices t o talk t o each other over a common transmission medium Establishing the performance characteristics of a LAN before putting it into use is of paramount importance It gives the designer the freedom and flexibility t o adjust various parameters of the network at the planning stage This way the designer eliminates the risk of unforeseen bottlenecks, underuse or overuse of resources, and failure t o meet targeted system requirements The common approaches t o performance evaluation apply analytical models, simulation models, or hybrid models Simulation models allow systems analysts to evaluate the performance of existing or proposed systems under different conditions that lie beyond what analytic models can handle Unlike analytic models, simulation models can provide estimates of virtually any network performance measure So far there are two categories of texts on simulation Texts in the first category cover the general principles of simulation and apply them t o a specific system for illustration purposes; they are not specific enough t o help a beginner apply those principles in developing a simulation model for a LAN Texts in the second category instruct readers on how t o apply special-purpose languages (such as GPSS, GASP, SIMSCRIPT, SIMULA, SLAM, and RESQ) in constructing a simulation model for computer systems including LANs Besides the fact that these languages are still evolving and are limited, the reader must first learn the specific simulation language before a simulation model can be developed This text has two major advantages over these existing texts First, it uses C, a well developed general-purpose language that is familiar t o most analysts This avoids the need for learning a new simulation language or package Second, the text specifically applies the simulation principles t o local area networks In addition, the text is student oriented and is suitable for classroom use or self-learning The text is intended for LAN designers who want to analyze the performance of their designs using simulation It may be used for a one-semester course on simulation of LANs The main requirements for students taking such a course are introductory LAN course and a knowledge of a high-level language, preferably C Although familiarity with probability theory and statistics is useful, it is not required vii The book consists of eight chapters Each chapter has a list of references to the literature, and there is bibliography at the end of the book Chapter provides a brief review of local area networks, and Chapter gives the analytical models of popular LANs-token-passing bus and ring networks, CSMAICD, and star network Chapter covers the general principles of simulation, and Chapter deals with fundamental concepts in probability and statistic relating t o simulation modeling Materials in Chapters and are specifically applied in developing simulation models on token-passing LANs, CSMAICD LANs, and Star LANs in Chapters 5, 6, and respectively The computer codes in Chapters t o are divided into segments and a detailed explanation of each segment is presented t o give a thorough understanding of the simulation models The entire codes are put together in the appendices It is hoped that the ideas gained in learning how t o simulate these common LANs can be applied t o other communication systems The authors are indebted to various students and colleagues who have contributed t o this book We are particularly indebted to George Paramanis and Sharuhk Murad for working on some of the simulation models as special graduate projects Special thanks are due to Robert Stern of CRC Press for providing expert editorial guidance on the manuscript Finally, we owe much to our families for their patience and support while preparing the material To them this book is dedicated Table of Contents LOCAL AREA NETWORKS 1.1 Definition of a LAN 1.2 Evolution of LANs 1.3 LAN Technology 1.3.1 Network Topology and Access-Control 1.3.2 Transmission Media 1.3.3 Transmission Techniques 1.4 Standardization of LANs 1.5 LAN Architectures 1.5.1 The OSI Model 1.5.2 The Seven OSI Layers 1.5.3 The IEEE Model for LANs 1.6 Performance Evaluation 1.6.1 Channel Utilization 1.6.2 Delay, Power, and Effective Transmission Ratio 1.7 Summary References Problems 2 7 9 10 11 11 13 14 15 16 ANALYTICAL MODELS OF LAN 17 2.1 Introduction 2.2 Token-Passing Ring 2.2.1 Basic Operation 2.2.2 Delay Analysis 2.3 Token-Passing Bus 2.3.1 Basic Operation 2.3.2 Delay Analysis 2.4 CSMA/CD Bus 2.4.1 Basic Operation 2.4.2 Delay Analysis 2.5 Star 2.5.1 Basic Operation 2.5.2 Delay Analysis 2.6 Performance Comparisons 2.7 Summary References Problems 17 19 19 20 27 27 28 31 32 33 35 36 37 38 40 40 41 SIMULATION MODELS 43 3.1 Introduction 3.2 Why Simulation? 43 44 IX 186 Simulation of Local Area Networks q u e u e s i z e [ n e x t s t a t i o n l ++ ; i f ( q u e u e s i z e [ n e x t s t a t i o n ] > MAX-Q-SIZE) i p r i n t f he q u e u e s i z e is l a r g e a n d is = % d \ n l ' , queuesize [nextstation] ) ; exit(1) ; q ; e u e - i d ~ n e x t - s t a t i o n ~ [(queuesize Cnext-station]-l)] = idnumber ; start-time[idnumber = clock; i f ( q u e u e s i z e C n e x t s t a t i o n l == ) I e v e n t - t ime [ n e x t s t a t i o n ] [l] = d - c l o c k ; i f ( e v e n t - t i m e [ n e x t s t a t i o n l C11 l ) I = (float) rand(); X = x/randslze; f o r ( i = ; i < no-attempts; i + + ) { select-prob = ( f l o a t ) ( i + l ) / ( ( f l o a t ) no-attempts); i f ( X i::$:% stdi0.h stdlib 3math.hs # define HAXSTATIOBS RATE 50 5000000.0 # define # define PACKET-LENGTH POLLIBGPKTLEBGTH BUSLEBGTH HAXPACKETS 1000.0 50.0 1000.0 I000 # define # define # define */ X define FACTOR 1000.0 # define # define HAX-&SIZE DEGREESIR 100 /* lumber of s t a t i o n s */ /* Transmission r a t e i n b i t s p e r second */ /* packet l e n g t h ( b i t s ) */ /* P o l l packet l e n g t h ( b i t s ) */ /* Bus l e n g t h i n meters */ /* Haximum p a c k e t s t o be t r a n s m i t t e d i n s i m u l a t i o n run */ /* A f a c t o r u s e d f o y changing u n i t s of time */ /* Haximum queue s i z e */ /* Degrees of freedom */ a r r i v a l z a t e ; /* A r r i v a l r a t e ( i n p a c k e t s / s e c ) f o r each s t a t i o n */ t a u ; /* End-to-end propagation d e l a y */ packet-time; /* Packet t r a n s m i s s i o n time */ polling-pkt-time; /* P o l l i n g packet t r a n s m i s s i o n time * / s t a r t - t i m e [HAXSTATIOHS] [HAXJJ-SIZE] ; /* S t a r t i n g time of p a c k e t s */ event-time [HAXSTATIOBS] [3] ; /* Time of occurrence of an event */ t - d i s t p a r [l01 = (12.706, 4.303, , 7 , 2.571, 4 , 2.365, 2.306, 2.262, 2.228); /* T- d i s t r i b u t i o n parameters */ f l o a t d e l a y - c i [DEGREESIR + I ] ; /* An a r r a y t o s t o r e d e l a y v a l u e s */ float float float float float float float f l o a t r h o , c l o c k , n o q k t s d e p a r t e d , next-event-time ; f l o a t X , logx, r a n d s i z e , i n f i n i t e ; f l o a t delay, t o t a l d e l a y , averagedelay; f l o a t d e l a y s u m , d e l a y s q r , delay-var , d e l a y s d v , delay-con-int ; i n t q u e u e s i z e [HAXSTATIOBS]; /* Current queue s i z e a t a s t a t i o n i n t 1, j , i c , i i , n e x t , n e x t s t a t i o n , next-event; */ 192 main { Simulation of Local Area Networks p r i n t f ("The f o l l o w i n g r e s u l t s a r e f o r : \ n u ) ; p r i n t f ("Degrees of freedom = %d\n" , DEGREESIR) ; p r i n t f ( " C o n f i d e n c e i n t e r v a l = 95 p e r c e n t \ n u ) ; p r i n t f ( u \nat); p r i n t f ("\nu) ; a r r i v a l r a t e = 0.0; t a u = BUSLEBGTH FACTOR * pow ( , - ) ; FACTOR / RATE; packet-time = PACKETLENGTH FACTOR / RATE; p o l l i n g - p k t - t i m e = POLLIBG9KTLEBGTH * * * * a r r i v a l r a t e += f o r ( i c = ; i c = ) I * */ UAXSTATIOBS / RATE; ; r i n t f ( " ~ r a f f i c i n t e n s i t y is too high"); e x i t (1) ; /* I n i t i a l i z e a l l v a r i a b l e s t o t h e i r a p p r o p r i a t e v a l u e s for ( i = 0; i f o r ( i = Q; i i FIAXSTATIOBS; i + + ) q u e u e s i z e [ i ] = O ; UAXSTATIOBS; i + + ) for ( j = 0; j for ( i = 0; i I */ < UAX-QSIZE; j + + ) s t a r t - t i m e [ i ] [j]=O.O; UAXSTATIOBS; i + + ) ; v e n t - t i m e ~ i l ~ j l= ; = infinite; i f ( j !=0) e v e n t - t i m e [ i ] [ j l i f (i==O && j==2) event-time[i] [j] = ; /* Scan t h e e v e n t l i s t and p i c k t h e n e x t e v e n t t o be e x e c u t e d while (no-pktsdeparted I UAXPACKETS) next-event-time = i n f i n i t e ; f o r ( i = ; i < UAXSTATIOIIS; i + + ) I I i f (next-event-time { > event-time [i] [j] ) */ Appendix C n e x t - e v e n t - t i m e = event-time[i] [j] ; nextstation = i ; next-event = j ; 1 d o c k = next-event-time ; i f (next-event > ) i printf("Check t h e event l i s t " ) ; exit(1); s w i t c h (dext-event ) I tase 0: /* T h i s i s an a r r i v a l e v e n t */ i p r i n t f ( " T h e queue s i z e is l a r g e and i s = %d\n", queuesize[nextstation] ) ; exit(1); siart-time [next_station] [(queuesize[nextstation]-l] /* S c h e d u l e t h e n e x t a r r i v a l = clock; */ f o r (;;) I = ( f l o a t ) rand(); i f ( x = 0.0) break; lAgx = -10 ( x / r a n d s i z e ) * FACTOR / a r r i v a l l a t e ; e v e n t - t i m e f n e x t s t a t ion] [next-event] = c l o c k + l o g x ; break ; c a s e 1: l /* T h i s i s a d e p a r t u r e e v e n t */ i u e u e - s i z e ~ n e x t s t a t i o n l ; n o - p k t s d e p a r t e d ++ ; c l o c k - s t a r t - t i m e [ n e x t s t a t i o n ] [O] ; /* Push t h e queue f o r w a r d */ I f o r (i=O; i < q u e u e s i z e [ n e x t s t a t i o n ] ; i + + ) ? t a r t - t i m e C n e x t s t a t i o n [i] = s t a r t - t i m e [ n e x t s t a t i o n ] Ci+l] ; s t a r t - t ime [ n e x t s t a t i o n ] [ q u e u e s i z e [ n e x t s t a t i o n ] ] = O ; e v e n t f ime [ n e x t s t a t ion] [next-event] = i n f i n i t e ; break; case 2: * ' l I Find t h e next s t a t i o n t o be s e r v i c e d e v e n t - t i m e [ n e x t q t a t ion] [next-event] next = n e x t s t a t l o n + l ' i f ( n e x t == HAXSTATIOBS~ n e x t = ; i f (queuesizeCnextstation1 > 0) I */ = infinite; : v e n t - t i m e ~ n e x t s t a t ion] 111 = c l o c k + p a c k e t - t i m e + t a u ; event_time[nextl[2] = c l o c k + packet-time + polling-pkt-time + tau; Simulation of Local Area Networks ; v e n t - t i m e ~ n e x t s t a t i o n ] [l] = i n f i n i t e ; event-timeCnext1 C21 = clock + p o l l i n g q k t - t i m e + t a u ; average-delay = t o t a l d e l a y / ( n o q k t s d e p a r t e d delay-ci [ic] = a v e r a g e d e l a y ; * FACTOR) ; delaysum = 0.0; delaysqr = 0.0; f o r ( i c = ; i c