System Models - PowerPoint PPT Presentation

About This Presentation
Title:

System Models

Description:

System Models. Interaction model deals with performance and setting time limits in a ... { public Exception() { super();} public Exception(String s){super(s);} 11 ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 25
Provided by: bina1
Learn more at: https://cse.buffalo.edu
Category:
Tags: models | super | system

less

Transcript and Presenter's Notes

Title: System Models


1
System Models
  • Bina Ramamurthy

2
Fundamental Issues
  • There is no global time.
  • All communications are by means of messages.
  • Message communication may be affected by network
    delays and can suffer from a variety of failures
    and security attacks.
  • How does one express a solution/process for
    handling an issue? One of the ways is to
    establish a model.

3
System Models
  • Interaction model deals with performance and
    setting time limits in a distributed system, say,
    for message delivery.
  • Failure model gives specification of faults and
    defines reliable communication and correct
    processes.
  • Security model specifies possible threats and
    defines the concept of secure channels.
  • Architectural model defines the way in which the
    components of the system interact with one
    another and the way in which they are mapped onto
    the underlying network of computers.

4
Architectural Model
  • Abstracts the functions of the individual
    components.
  • Defines patterns for distribution of data and
    workload.
  • Defines patterns of communication among the
    components.
  • Example Definition of server process, client
    process and peer process and protocols for
    communication among processes definition
    client/server model and its variations.

5
Software and hardware service layers in
distributed systems
6
Middleware
  • Layer of software whose purpose is to mask the
    heterogeneity and to provide a convenient
    programming model for application programmers.
  • Middleware supports such abstractions as remote
    method invocation, group communications, event
    notification, replication of shared data,
    real-time data streaming.
  • Examples CORBA spec by OMG, Java RMI, MSs DCOM.

7
Clients invoke individual servers
EX 1. File server, 2. Web crawler
EX Web server
EX browser, web client
8
A service provided by multiple servers
EX akamai, altavista, Suns NIS (data
replication)
9
Web proxy server and caches
Proxy servers cache are used to provide
increased Availability and performance. They
also play a major role Firewall based security.
http//www.interhack.net/pubs/fwfaq/
10
A distributed application based on peer processes
Ex distributed Whiteboard Application EJB-base
d?
11
Web applets
EX Look at Object by value in CORBA
12
Java Object Serialization
  • The capability to store and retrieve Java objects
    is essential to building persistence and
    streaming into application.
  • We will discuss details about Serialization and
    saving and restoring objects in files/streams.

13
Object Serialization
  • Key to storing and retrieving objects is
    representing the state of the objects in a
    serialized form sufficient to reconstruct the
    objects.
  • Object ltgtbyte stream, other data to help in
    reconstruction
  • Converting an object into an organized byte form
    for storage, streaming etc.

14
How to use Serialization?
  • 1. import java.io.
  • 2. Implement java.io.Serialization interface.
  • 3. Use writeObject and readObject methods whose
    header are as given below
  • void writeObject (Object obj) throws
    IOException
  • Object readObject() thorws ClassNotFoundExcepti
    on, IOException

15
Writing to an Object Stream
  • // serilaize various objects into a file
  • FileOutputStream f new FileOutputStream(tmp)
  • ObjectOutputStream s new ObjectOutputStream(f)
  • s.writeObject(Today)
  • s.writeObject(new Date())
  • Theater t new Theater(4,6,10)
  • //4 shows, 6 rows, 10 cols
  • s.writeObject(t)

16
Reading from an Object Stream
  • // Deserialize a objects from a file
  • FileInputStream inf new FileInputStream(tmp)
  • ObjectInputStream s1 new ObjectInputStream(inf)
  • //read the Object and cast to retrieve the
  • // actual object
  • String (String)s1.readObject()
  • Data date (Date)s1.readObject()

17
Exception Handling
  • When a condition arises that the currently
    executing code cannot handle an exception occurs.
  • Such conditions require special exception
    handling facilities.
  • Traditionally these were handled by function
    return value.

18
Basics of Java Exception Handling
  • Use try, throw, catch primitives.
  • Enclose the code that you expect to result in an
    exception within a try block
  • Attach a catch block that contains the code to
    handle the exception, following the try block.
    Use throw to transfer control to catch an
    exception (thrown).
  • There can be many catch blocks following a single
    try to process the various types of exceptions.

19
Try blocks
  • Syntax
  • try
  • normal statements
  • statements that may result in exceptions
    //dynamic scope
  • throw happens from here

20
Throwing an Exception
  • throw is a keyword that can be used to announce
    that an exception has occurred.
  • Throw normally specifies one operand.
  • Thrown operand is an Object an object of
    Exception class is thrown.
  • When an exception is thrown, control exits the
    try block and proceeds to the appropriate catch
    handler after the try block.

21
Catching an Exception
  • Exception handlers are located within catch
    blocks.
  • Each catch block starts with the keyword catch
    followed by parentheses containing a type of the
    exception this catch can handle.
  • This is followed by the code for handling the
    exception enclosed within parentheses.

22
Exception handling examples
  • For distributed computing Ex waiting for other
    host to respond.
  • When dynamically allocating memory (large
    chunks).
  • In large projects to handle error processing in a
    uniform manner project-wide.

23
Java Exception class
  • java.lang.Exception class
  • public class Exception extends Throwable
  • public Exception() super()
  • public Exception(String s)super(s)

24
User-defined Exception class
  • For every project you implement you need to have
    a project dependent exception class so that
    objects of this type can be thrown.
  • Java API also supports an extensive list of
    Exceptions.
Write a Comment
User Comments (0)
About PowerShow.com