archive-ca.com » CA » E » EVANJONES.CA

Total: 397

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Python: module networks
    object to end count L count value integer return number of occurrences of value extend L extend iterable extend list by appending elements from the iterable index L index value start stop integer return first index of value insert L insert index object insert object before index pop L pop index item remove and return item at index default last remove L remove value remove first occurrence of value reverse L reverse reverse IN PLACE sort L sort cmpfunc None stable sort IN PLACE cmpfunc x y 1 0 1 Data and other attributes inherited from builtin list new built in method new of type object at 0xa5f444fc T new S a new object with type S a subtype of T class NS2ScriptBuilder Methods defined here init self network addFlow self paths UDP True tcpType SACKDelAck rate False getNsToTopologyIndex self Returns a dictionary that maps the ns2 indexes back to topology indexes getScript self ns2Footer self ns2TCPAgent self type rate ns2UDPAgent self class Network Represents a collection of nodes Methods defined here init self size range 250 size A tuple of the x y dimensions of the network terrain range The maximum distance between connected nodes addNode self x y drawScript self paths None Returns a list of node coordinates in the format for my network topology drawing program drawnetwork findNeighbours self Recalculates the neighbour lists for each node It also forgets any cached routing information findShortestPaths self source destination extraHopLimit 0 Finds all the shortest paths from source index node to the destination index nodes It will also return paths with up to extraHopLimit hops past the shortest path findShortestPathsHeuristic self source destination extraHopLimit 0 Same as findShortestPaths but it uses the heuristic path so it runs much faster I believe the results should be the same but I have not thought about it enough to be able to be certain about it findShortestPathsOnly self source destination onlyDestination True Yet another findShortestPaths implementation but this one finds only the shortest paths If onlyDestination is false it will find all the shortest paths that begin at source This is used to implement the route function maximumConnectedSet self pathToIndexes self path Converts a path object into a list of node indexes route self source destination Yet another shortest paths implementation This one finds all the shortest paths that start at the given source It also uses extensive caching and relies on the fact that the routing is symmetric The implementation relies on findShortestPathsOnly routeAll self maxPaths None Floyd Warshall all pairs shortest path O n 3 Implemented thanks to http ai depot com BotNavigation Path AllPairs html Computes all the shortest paths in the network It will only do this computation once and it is faster to do it for the entire network at the same time than it is to do if for each pair of nodes in order After calling this paths can be found via self nodes source routes destination unconnectedNodes self class Node builtin object This class

    Original URL path: http://www.evanjones.ca/software/networks.html (2016-04-30)
    Open archived version from archive


  • Building PXE Imager from Scratch
    etc hosts rootdir etc hosts Since we are using PXE boot we know that the system has an Ethernet card Assuming that it is found during the boot process use the following for etc network interfaces as it will automatically bring up eth0 using DHCP Used by ifup 8 and ifdown 8 See the interfaces 5 manpage or usr share doc ifupdown examples for more information The loopback network interface auto lo iface lo inet loopback The primary network interface auto eth0 iface eth0 inet dhcp Configure your hostname echo pxeboot rootdir etc hostname Edit etc inittab to run bash instead of presenting a login prompt This allows us to remove a bunch of packages related to logging in which won t be needed anyway 1 2345 respawn bin bash 2 23 respawn sbin getty 38400 tty2 3 23 respawn sbin getty 38400 tty3 4 23 respawn sbin getty 38400 tty4 5 23 respawn sbin getty 38400 tty5 6 23 respawn sbin getty 38400 tty6 Remove Useless Packages Since we want to put this image in RAM we need to remove all the useless stuff To remove packages run chroot rootdir dpkg purge package names Here is a list that I removed ppp pppconfig pppoe pppoeconf whiptail libnewt0 51 libpcap0 7 logrotate libpopt0 at sysklogd klogd iptables ipchains wget telnet cron exim4 exim4 base exim4 config exim4 daemon light mailx base config adduser makedev apt apt utils base config aptitude tasksel gettext base nano nvi ed man db manpages groff base info pciutils bsdmainutils fdutils cpio modutils console tools console common console data libconsole force depends needed to remove the following tcpd libwrap0 netkit inetd iputils ping Finally libraries libsigc 1 2 5c102 libtextwrap1 liblockfile1 libssl0 9 7 libdb4 2 libpcre3 libgnutls11 libtasn1 2 liblzo1 libopencdk8 libgcrypt11 libgpg error0 Need force depends or to install debconf english libtext wrapi18n perl libgdbm3 libtext iconv perl liblocale gettext perl libtext charwidth perl Then install the following packages replaces debconf i18n which is much larger debconf english Small vi clone elvis tiny Automatic hardware detection discover discover data libdiscover2 libexpat1 Needed for 2 6 kernel modules module init tools For TFTP transfers atftp libncurses5 For the pxeimager py script use force depends to install python2 3 dev Devices Modern Linux distributions use tools like udev to create devices in dev as needed Those tools are great but take up too much space for our stripped down image I just created them the old fashioned way You can use the MAKEDEV script to create devices for you but I find it creates far too many I simply used the dev directory from Pebble Linux Kernel Since this image is going to be booted over the network the kernel configuration is a bit unconventional The only files we need on the actual system are the modules since the kernel itself is downloaded over the network I unpack the kernel package and then manually install the modules Also you will need the kernel on your TFTP

    Original URL path: http://www.evanjones.ca/software/pxeimager-scratch.html (2016-04-30)
    Open archived version from archive


  • 21 52 25 2005 This paper speculates that in the near future cell phones will become the predominant way of using the Internet Interestingly Keshav predicts that this will lead to deployment of a lot of advanced networking technology that we have been waiting for like IPv6 and quality of service guarantees While I disagree with some of the details I agree with the overall idea and I think his

    Original URL path: http://www.evanjones.ca/researchpapers/cellphones.txt (2016-04-30)
    Open archived version from archive



  • Improving Python's Memory Allocator
    the procedure is very similar First some magic is performed in order to determine what pool a block belongs to see obmalloc c for the gory details The block is then placed on the pool s free list If the pool was completely allocated it is added to the usedpools array If the pool is now completely available it is removed from usedpools and added to the freepools list 3 Solving the Problem The problem is that the process stops there There is no code to match free pools with the arenas they belong to and then to return free arenas to the operating system To do this a free pool needs to be put on a list specifically for the arena that it comes from Once all the pools in the arena are on that list the entire arena can be released This means that some data structure must be associated with each arena to track available and allocated pools An array of arena structures is maintained to provide good memory locality when manipulating arenas The next challenge is to get from a pool to the arena it was allocated from To do this the pool header was extended to include the index of the arena in the array Additionally the freepools list was changed into a partially allocated arenas list This list shown in Figure 4 keeps track of arenas that have pools available With these changes the procedure for allocating memory described in Section 2 1 needs to be modified when a free pool is needed Instead of taking the pool from the freepools list the pool is taken from the first arena in the partially allocated arenas list Figure 4 The partially allocated arenas list contains arenas with free pools 3 1 Freeing Memory Take Two More significant changes are made to the procedure for freeing memory If a pool is completely free the pool is placed on a free list specifically for its arena If the arena was completely allocated it is added to the partially allocated arenas list This linked list contains arenas that contain some free pools If the arena is now completely available it is removed from the partially allocated arenas list and it is released to the operating system by calling free One additional tweak is that the partially allocated arenas list is kept sorted so that the most allocated arenas are used first when a pool is needed This gives the arenas that are nearly empty a chance to become completely deallocated and returned to the operating system and was experimentally determined to improve the amount of memory that could be freed 4 Impact These changes will not affect the correctness of programs only their performance The new version of the allocator is capable of returning memory to the operating system which should improve the overall system performance for applications that allocate memory in a bursty fashion The disadvantage is that is some additional overhead required when freeing blocks to

    Original URL path: http://www.evanjones.ca/memoryallocator/ (2016-04-30)
    Open archived version from archive


  • Greenspun an MIT professor and the former founder of the now defunct Ars Digita has a proposal that he is going to present at Xerox PARC for making the mobile phone the centre of a user s computing environment I think that cell phones will absolutely become most people s primary computing devices Greenspun s plan for making this a reality with today s hardware and software seems like a

    Original URL path: http://www.evanjones.ca/researchpapers/cellphone-pcs.txt (2016-04-30)
    Open archived version from archive