Presentation is loading. Please wait.

Presentation is loading. Please wait.

System Models Bina Ramamurthy 9/7/2019 B.Ramamurthy.

Similar presentations


Presentation on theme: "System Models Bina Ramamurthy 9/7/2019 B.Ramamurthy."— Presentation transcript:

1 System Models Bina Ramamurthy 9/7/2019 B.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. 9/7/2019 B.Ramamurthy

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. 9/7/2019 B.Ramamurthy

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. 9/7/2019 B.Ramamurthy

5 Software and hardware service layers in distributed systems
9/7/2019 B.Ramamurthy

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, MS’s DCOM. 9/7/2019 B.Ramamurthy

7 Clients invoke individual servers
EX: 1. File server, 2. Web crawler EX: Web server EX: browser, web client 9/7/2019 B.Ramamurthy

8 A service provided by multiple servers
EX: akamai, altavista, Sun’s NIS (data replication) 9/7/2019 B.Ramamurthy

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. 9/7/2019 B.Ramamurthy

10 A distributed application based on peer processes
Ex: distributed Whiteboard Application; EJB-based? 9/7/2019 B.Ramamurthy

11 Web applets EX: Look at Object by value in CORBA 9/7/2019 B.Ramamurthy

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. 9/7/2019 B.Ramamurthy

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 <===>byte stream, other data to help in reconstruction Converting an object into an organized byte form for storage, streaming etc. 9/7/2019 B.Ramamurthy

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 ClassNotFoundException, IOException; 9/7/2019 B.Ramamurthy

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); 9/7/2019 B.Ramamurthy

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(); 9/7/2019 B.Ramamurthy

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. 9/7/2019 B.Ramamurthy

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. 9/7/2019 B.Ramamurthy

19 Try blocks Syntax: try { normal statements;
statements that may result in exceptions; //dynamic scope “throw” happens from here } 9/7/2019 B.Ramamurthy

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. 9/7/2019 B.Ramamurthy

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. 9/7/2019 B.Ramamurthy

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. 9/7/2019 B.Ramamurthy

23 Java Exception class java.lang.Exception class :
public class Exception extends Throwable { public Exception() { super();} public Exception(String s){super(s);} } 9/7/2019 B.Ramamurthy

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. 9/7/2019 B.Ramamurthy


Download ppt "System Models Bina Ramamurthy 9/7/2019 B.Ramamurthy."

Similar presentations


Ads by Google