CSE503: Software Engineering
Lecture 5  (April 5, 2000)

David Notkin

 

v     Today

Ø      Layering

Ø      Possible projects

v     Layering

Ø      Layering is a standard software structuring technique

Ø      If you’ve taken OS, you’ve seen it in its classic form in Dijkstra’s T.H.E. system

§        Level 5: User Programs

§        Level 4: Buffering for input and output devices

§        Level 3: Operator Console Device Driver

§        Level 2: Memory Management (Software Paging)

§        Level 1: CPU Scheduling (priority) P and V operations

§        Level 0: Hardware

Ø      Parnas’ paper discusses layering in terms of the potential ease of extension and contraction of systems

Ø      Strictly, one layer can only use operations at the next lower level

§        This constrains, in the extreme, invocations between components at a given level

§        This constrains recursion

§        It prohibits calling down multiple levels

Ø      But layering does allow for a nice style of building: a lower layer can be debugged and tested without concern for the higher layers, since there are by definition no dependences

v     Invokes vs. uses

Ø      Parnas discusses how the uses relation is distinct from the invokes relation

§        A program A uses a program B if the correctness of A depends on the presence of a correct version of B

§        Requires specification and implementation of A and the specification of B

§        Again, what is the “specification”? The interface? Implied or informal semantics?

Ø      Here's an example where invokes does not imply uses

§        Invocation without use: name service with cached hints

·       ipAddr := cache(hostName);
if not(ping(ipAddr))
    ipAddr := lookup(hostName)
endif

v     What is the relationship, if any, between layering and information hiding modules?

Ø      HW2 has one question in this regard

Ø      Strict application of layering in operating systems is hard; for example, if you have lots of processes, you may not be able to store all your process tables in memory, so you might have a dependency from process table management to virtual memory

Ø      Here's a small example of this, taken from the FAMOS operating system (family of operating systems) research project from the early 1980's

§        An OS might have both a "process ADT" and a "segment ADT", each of which hides secrets such as the data structures to support these functions

§        But in terms of layering, you might have the structure:

·       Level 3: Segment management
Level 2: Process management
Level 1: Segment creation
Level 0: Process creation

§        So, the information hiding modules (the ADTs) span levels in this situation

v     Language support for layering

Ø      Why do we have tons of language support for information hiding modules, but essentially none for layering?