Recap - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Recap

Description:

http://www.cs.caltech.edu/ rather than http: ... http://www.cs.caltech.edu/~cs141/ 7 January 2002. Aliases. Multiple names ... http://www.cs.caltech.edu ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 32
Provided by: danielzi
Category:
Tags: http | recap

less

Transcript and Presenter's Notes

Title: Recap


1
Recap
  • Communication Methods
  • Testing Software Systems

2
Today
  • Naming
  • Unit Testing with JUnit
  • Lab 6

3
Naming
  • Names are important
  • Sharing
  • Identification
  • Location
  • Naming in distributed systems is implemented
    differently from naming in nondistributed systems

4
Naming Entities
  • A name is a string of bits or characters that
    refers to an entity
  • Hosts
  • Printers
  • Disks
  • Files
  • Entities have access points names of access
    points are called addresses

5
Naming EntitiesAccess Points and Addresses
  • Entities can have multiple access points
  • Entities can change their access points over time
  • Addresses are special names that refer to
    specific access points
  • Addresses of entities are almost never used as
    names for those entities
  • http//www.cs.caltech.edu/ rather than
    http//131.215.44.107/

6
Naming EntitiesAddresses and Entities
  • Using addresses as names would limit flexibility
  • Distributed systems are often reorganized, which
    would instantly break anything using the address
  • When theres more than one access point, which
    address do you use as a name?
  • Names that are separate from addresses are
    location independent

7
Identifiers
  • Used to uniquely identify an entity
  • 3 properties
  • An identifier refers to at most one entity
  • Each entity is referred to by at most one
    identifier
  • An identifier always refers to the same entity
  • Makes it easy to determine when two distributed
    processes are referring to the same entity

8
Human-Friendly Names
  • Addresses and identifiers are usually bit strings
  • By contrast, human-friendly names are usually
    character strings
  • Filenames
  • DNS names
  • Universal Resource Locators (sometimes these have
    not-very-human-readable components)

9
Name Spaces
  • Used to organize names
  • Essentially, a labeled directed graph with two
    types of nodes
  • Leaf nodes represent named entities and have no
    outgoing edges
  • Directory nodes have outgoing edges labeled with
    names
  • Each node is an entity and has an identifier

10
Name Spaces
  • A directory node with no incoming edges is a root
    node
  • Most naming graphs have only one root node, but
    it is possible to have more
  • Every path in the graph can be referred to by a
    path name, the sequence of labels corresponding
    to its edges
  • Absolute pathnames start at a root node
  • Relative pathnames start at a non-root node

11
Name Spaces
12
Name Space Organization
  • One root vs. multiple roots
  • Tree (each node has at most one incoming edge)
  • Directed graph (any nodes can have any edges)
  • Directed acyclic graph (each node can have more
    than one incoming edge, but no cycles allowed)

13
Name Resolution
  • The process of looking up a name
  • Name resolution starts at some node, and proceeds
    along edges corresponding to pathname components
  • Closure mechanism - how the initial node for name
    resolution is selected
  • Example in a UNIX filesystem, the closure
    mechanism is that the root directorys inode is
    always the first inode in the disk

14
Aliases
  • Multiple names for the same entity
  • Two basic mechanisms
  • Allow multiple absolute paths to point to the
    same node in a naming graph
  • Represent an entity by another leaf node that
    stores the absolute path to that entity
  • The first mechanism is analogous to UNIX hard
    links, the second is analogous to UNIX symbolic
    links

15
Aliases - Symbolic Links
16
Merging Multiple Name Spaces
  • Name resolution allows us to mount name spaces in
    other name spaces (with protocols like NFS)
  • Directory node that stores the identifier of a
    remote node is called a mount point
  • Directory node in the foreign space whose
    identifier is stored in the mount point is called
    the mounting point

17
Merging Multiple Name Spaces
18
Another Approach for Merging Multiple Name Spaces
  • DECs Global Name Service (GNS) took another
    approach add a new root node, and make the
    existing root nodes children of the new node
  • Existing names would need to be changed
  • To get around this problem, GNS names always
    implicitly include the identifier of the node
    where name resolution should start

19
Another Approach for Merging Multiple Name Spaces
20
Name Space Distribution
  • Typically organized in a hierarchy
  • Three layers
  • The global layer is the root nodes and other
    nodes very close to the root node. The directory
    tables in these nodes are relatively stable.
  • The administrational layer is directory nodes
    that are managed within single organizations
    (academic departments, universities, companies,
    etc)
  • The managerial layer consists of nodes that can
    change regularly (hosts in the local network,
    shared files, etc)

21
Name Space Distribution
22
Implementation of Name ResolutionIterative
  • Client queries a root name server with an
    absolute path name
  • Root name server resolves the path name as far as
    it can, and returns the result
  • If the result is another name server, client
    queries that server with remaining part of the
    path name
  • This process repeats until the path name is fully
    resolved

23
Implementation of Name ResolutionIterative
24
Implementation of Name ResolutionRecursive
  • Client queries a root name server with an
    absolute path name
  • Root name server resolves the pathname as far as
    it can
  • If the result is a name server, root name server
    queries that name server with remaining part of
    the path name
  • This process repeats until the path name is fully
    resolved, and then it is returned to the client

25
Implementation of Name ResolutionRecursive
26
Implementation of Name ResolutionIterative vs.
Recursive
  • In iterative name resolution only the name
    resolver can cache, but in recursive name
    resolution both the name resolver and the name
    server can cache
  • In iterative name resolution, more long-distance
    communication may be required than in recursive
    name resolution
  • Name servers in adjacent levels of the name space
    are usually pretty close to each other, while the
    client may be far away from all the name servers

27
Unit Testing with JUnit
  • Individual test cases written as methods in a
    subclass of class junit.framework.TestCase
  • Related test cases (such as testing public
    methods of the same class, or testing different
    pieces of related functionality on a server) all
    methods of the same class
  • Multiple TestCase subclasses can be grouped
    together into a test suite by subclassing
    junit.framework.TestSuite

28
Unit Testing with JUnit
  • A subclass of class junit.extensions.TestSetup
    can be used to set up and tear down resources
    needed for testing
  • Tests can be executed in a specific order if they
    depend on each other
  • Execution of tests is all automatic - methods of
    the TestCase subclasses are called using
    reflection, and fail() method of the TestCase
    class is used to report failures

29
Unit Testing with JUnit
  • Textual interface junit.textui.TestRunner
  • Graphical interface junit.ui.TestRunner
  • Both interfaces can be called programmatically
    (from a main() method in one of your classes), or
    directly from the command line with the class
    name of a test suite
  • Lab 4 test code available online for you to use
    as an example

30
Lab 6
  • Out now, due 235959 Thursday, 21 February
  • Implementation of what you specified for the
    second part of Lab 5 (three components of the
    computation distribution system), along with unit
    tests with JUnit
  • You shouldnt have to do any actual network
    programming (except perhaps an RMI call or two,
    depending on your design)

31
Next Class
  • Institute Holiday on Monday
  • On Thursday
  • Locating Entities
  • Reference Counting
  • Lab 7
Write a Comment
User Comments (0)
About PowerShow.com