顯示包含「Exercise 5」標籤的文章。顯示所有文章
顯示包含「Exercise 5」標籤的文章。顯示所有文章

3/23/2009

Exercise 5-3

5-3. Framework for development. Compare and contrast any Two of:

a. Java

b. .NET

c. Ruby on Rails

d. Turbo Gears

e. Google Gears

f. AJAX frameworks.

I would like to compare and contrast the framework between Java and .NET based on c-charpcorner (2001).

I.) Object-oriented approach - Both of them use an object-oriented approach for design.

II.) CLR vs JVM - The .NET framework's Common Language Runtime (CLR) is much similar to Java Virtual Machine (JVM), in terms of garbage collection, security, just in time compilation (JIT).

One of the fundamental differences between Java Virtual Machine (JVM) instruction sets and Common Intermediate Language (CIL) is that JVM is big endian ( most significant byte first) and CIL uses little endian ( least significant byte first) binary representation. This difference will not be apparent to most of the programmers. Only system level programmers would have to deal with it.

III.) Multiple platform vs multiple languages - Java platform views the Internet world as one language running on different operating systems (OS), whereas .NET framework views the world running on one OS with a programmers having choice of multiple languages. Therefore Java platform interpolates multiple operating systems, and .NET framework interpolates multiple languages.

IV.) Assemblies - An assembly is the functional unit of sharing and reuse in the Common Language Runtime. It is the equivalent of JAR (Java Archive) files of Java. The Microsoft documentation stress that assemblies are "logical dlls". This may be a reasonable paradigm for VB or C++ programmers, but Java programmers will find it easier, if we visualize assemblies as an extension of JAR concept. However, unlike JAR, each assembly can have only one entry point defined, which can be either DllMain, WinMain, or Main.

V.) Conclusion - .NET is definitely an improvement over Java framework, but it is NOT going to displace Java any time soon. Though in coming years Java and .NET will converge.
It currently lacks support for other platforms. Since .NET has been architected by Microsoft, it is less likely to find the open source support base of free thinking programmers, which was one of the main reasons of Java's popularity.



References:
c-charpcorner (2001). “.Net framework comparsion with Java Architecture”. Received 20th March, 2009 from URL -
http://www.c-sharpcorner.com/UploadFile/abanerjee/DotNetforJava11292005023419AM/DotNetforJava.aspx

3/22/2009

Exercise 5-2

5.2. Describe the important and distinguishing properties of Peer to Peer computing and the Grid. How is this peer to peer and the Grid architecture changing work flow and service-oriented applications?

Peer to Peer computing is important for distributed computing, data/content sharing, communication and collaboration, or platform services.

HP(2003) states that the term “peer-to-peer” refers to a class of systems and applications that employ distributed resources to perform a function in a decentralized manner. The resources encompass computing power, data (storage and content), network bandwidth, and presence (computers, human, and other resources). The critical function can be distributed computing, data/content sharing, communication and collaboration, or platform services.
Furthermore, peer-to-peer(P2P) enables valuable externalities, by aggregating resources through low-cost interoperability, the whole is made greater than the sum of its parts escalator, it also lowers cost of ownership and cost sharing, by using existing infrastructure and by eliminating or distributing the maintenance cost, moreover, it enables anonymity/privacy, by incorporating these requirements in the design and algorithms of P2P systems and applications, and by allowing peers a greater degree of autonomous control over their data and resources

Grid computong is important for support various business processes.


HP(2009) states resources can be dynamically provisioned to users or applications that need them in grid computing. Resources can be shared within a workgroup, department or enterprise; among different organizations and geographies; and even with groups outside the enterprise in collaborative projects. Grids can be designed to support various business processes. Grid technologies use emerging Web services standards such as XML, SOAP and WSDL and have long been used for scientific and technical work, where dispersed computers are linked to create virtual supercomputers that rapidly process vast amounts of information.


Domenico Talia (2003) states that Grid and P2P can be distinguished by the following points:

First, Security is a central theme in grids, and several efforts are devoted to integrating relevant mechanisms for authentication, authorization, integrity, and confidentiality in grid platforms. In contrast, P2P systems originate in "open communities," in which users share more generic goals such as retrieving music from the Internet, rather than specific objectives such as participating in high-energy physics simulations.

Second, Connectivity, Grids generally include powerful machines that are statically connected through high-performance networks with high levels of availability. On the other hand, the number of accessible nodes is generally low because access to grid resources is bonded to rigorous accounting mechanisms. Conversely, P2P systems are composed mainly of common desktop computers that are connected intermittently to the network, remaining available for a limited time with reduced reliability. The number of nodes connected in a P2P network at a given time is much greater than in a grid. Thus, the grid connectivity approach is still too stiff for new nodes and user access and accounting; it could benefit from the more flexible connectivity models used in P2P networks today.

Third, Fault Tolerance, the dynamic nature of grids necessitates some level of fault tolerance—especially for highly distributed code, such as parameter-sweep applications, which can fork numerous similar, independent jobs on many nodes.
Beyond simple checkpointing and restarting, reliability and fault tolerance are largely unexplored in grid models and tools. The Globus information system allows fault detection, for instance, but developers must implement fault tolerance at the application level. For greater reliability, designers of fault-tolerance mechanisms and policies for grids should consider using decentralized P2P algorithms, which avoid centralized services that can represent critical failure points.




Peer to peer is changing the work flow and service-oriented applications, firstly i want to describe how is traditional work flow and service-oriented application, please see the below figure:




The traditional work flow and service-oriented application are one-to-many, that's one server serves many clients, for example, one FTP server can allow many ftp client to download / upload online files.

Conversely, P2P's work flow and service-oriented application are many-to-many, please refer to the below figure, you can find that all nodes are multi-connected between each others, this design allows for scalable incremental growth and aggregates tremendous amount of computation and storage resources, for example, internet users cooperate to share such as music files
Napster, Gnutella, Morpheus and KaZaA; online communication application such as Skype and free Internet IP telephony.



And Grid architecture is changing the work flow and service-oriented applications, it is because...
a.) need for people-services as well as middleware services(computer services), for example, credential authorities, VO managers, support.

b.) Single sign-on to resources in multiple organisations.

c.) Flexible collaboration across multiple administrative domains for example sharing data, computers, instruments, application software

d.) It is a virtual organisation covered people and resources collaborating for example across admin and organisational boundaries.


References:

HP(2003). “Peer to Peer Computing”. Received 20th March, 2009 from URL -
http://www.hpl.hp.com/techreports/2002/HPL-2002-57R1.pdf

HP(2009). “What is grid computing?”. Received 20th March, 2009 from URL -
http://h71028.www7.hp.com/enterprise/cache/125371-0-0-0-121.html


Domenico Talia (2003), Paolo Trunfio, "Toward a Synergy Between P2P and Grids," IEEE Internet Computing, vol. 7, no. 4, pp. 96, 94-95.



Exercise 5-1

5-1. Investigate a simple chat client/Server system. Look at some program code and describe how it works with multiple uses.

A simple chat clent/server uses TCP/IP sockets to communicate between chat clients and chat server. In the chat client's side, users can send and view messages from server, correspondingly, in the chat server's side, it continuously listens for incoming messages from chat clients, integrates all messages and send it back to all chat clients.

I will show you some program code that is found from javaworld(2009) as follows:

a.) Classes on Chat server
In the chat server side, there are two classes, they are main class, ChatServer, is a server that accepts connections from clients and assigns them to new connection handler objects. The ChatHandler class actually does the work of listening for messages and broadcasting them to all connected clients. On thread (the main thread) handles new connections, and there is a thread (the ChatHandler class) for each client.
Every new ChatClient will connect to the ChatServer; this ChatServer will handle the connection to a new instance of ChatHandler class that will receive messages from the new client. Within the ChatHandler class, a list of the current handlers is maintained; the broadcast() method uses the list to transmit a message to all connected ChatClients. See below program code:


public class ChatServer {
public ChatServer (in port) throws IOException
{
ServerSocket server = new ServerSocker (port);
While (true) { //continuously listen for chatclient by while-loop
Socket client = server.accept();
System.out.println (“Accepted from” + clien.getInetAddress ());
ChatHandler c= new ChatHandler (client);
c.start ();}
}
public start void man (String args[]) throws IOException
{
if (arg.length !=1)
throw new RuntimeException (“Syntax: ChatServer ”);
new ChatServer (Integer.parseInt (args[0]));
}
}

For more information, please see the below figure for understanding how the class work.
1.) All ChatClient use their core function name main() to connected to ChatServer via TCP/IP socket.
2.) Each ChatClient is handled by dedicated ChatHander which is located in Chat server side.
3.) All ChatClient use the function named run() to send the message to ChatHandler.
4.) After receiving any message from ChatClient, the ChatHanlder will use the function named broadcast() in order to broadcast all received message back to all ChatClient


The figure is received from javaworld(2009)

References:

JavaWorld (2009). “Multithreaded client/sever Chat”. Received 20th March, 2009 from URL - http://www.javaworld.com/javaworld/jw-01-1997/jw-01-chat.html?page=4