C+J Software Architecture by isbangee

VIEWS: 57 PAGES: 22

									C+J Software Architecture

Shanghai Jiaotong University Author: Lu, Fei Advisor: Yu, Yong

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

C+J Software Architecture

Table of Contents
Motivation
C+J portable library

Distribution and Execution Mechanism
Contribution and future work

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

Motivation
Shortfalls of Java Architecture
Runtime overhead is significant even using JIT Space efficiency degrades greatly when heap allocations is universal and frequent
Heapallocations allocate more space than you want (see malloc.c)

Space for Reference
4 bytes

Space for Object
(20 bytes)

16 bytes 32 bytes
100%

Heap allocation is slower 80% than stack allocation by 60% 40% two significant orders 20%
0%
1 5 9 13 17 21 25 29 33 37 41

Reference Overhead % Object overhead % Space in Use %

Space efficiency as individual object size(X-axis) grows
assuming there are no memory fragments, which is in an ideal case Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept. Next

Motivation

Digital signature on ActiveX only guarantees its source, not its runtime security; ActiveX does not work on other platforms.
Need a more general and flexible architecture while maintaining high performance

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

C+J portable library Advantages of C+J library
C+J applications can run on different OS without recompilation C+J applets can run in Web browsers High performance, suitable for less powerful mobile devices C++ is the most widely used programming language C+J library is well designed; it has two layers in order to be portable

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

C+J portable library Structure of C+J Library

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

C+J portable library
Usage: C+J compared with Java

Java package vs. C++ namespace Class and Interface Exception Keyword: synchronized

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

C+J portable library Java package vs. C++ namespace
java cpp
- cpp::lang - cpp::awt - cpp::awt::Graphics - ... - cpp::io - cpp::net cpp::util
Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept. Next

- java.lang - java.awt - java.awt.Graphics - ... - java.io - java.net java.util

C+J portable library
interface Shape{ public int getArea(); public void draw(); } class Rect implements Shape{ ... public int getArea(){ return a*b; }; public void draw(){ ... }; } class Shape{ public:

virtual virtual

int getArea()=0; void draw()=0;

}; class Rect : public Shape, public Object{ public: ... virtual int getArea(); virtual void draw(); ... }; int Rect::getArea() { return a*b; } void Rect::draw() { ... } ...
Previous Next

06/18/2000

Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

C+J portable library
Exception
#define throws(Exception) // trick: I currently define it to be empty class Socket : public Object { …

Socket(char* host, int port) throws(UnknownHostException | IOException); … // this annotation can be utilized by pre-processor };

ANSI C++ standard usage
Socket(char* host, int port) throw (UnknownHostException, IOException);

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

C+J portable library Keyword synchronized
Using Java
Function(){ ... synchronized(Obj){ ... } ... }

Using C+J lib
Function(){ ... { Synchronize belowWith(Obj); ... } ... }

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

Distribution & Execution Mechanism
Flexible Distribution Format
Share binaries among different operating systems Can be compiled into intermediate code

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

Distribution & Execution Mechanism
Share executable of local application
C+J Application

C+J Dynamic Link Lib Abstract layer for OS For Windows

x86
Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept. Next

Distribution & Execution Mechanism
Share executable of local application
C+J Application
Same binary

Abstract layer for OS C+J Dynamic Link Lib For Linux

x86
Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept. Next

Distribution & Execution Mechanism
Compile to Intermediate Code
Source Code
compile Intermediate Code Download Translator Insert SFI protection Final executable
Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept. Next

Client Browser
Native Machine code

Distribution & Execution Mechanism
Software-based Fault Isolation(SFI)
Security issues in machine instruction level
Privileged Instructions Memory Access Control Flow R/W/Jump address

AND, OR operations

Solutions:
Static check for instruction and immediate address Runtime protection(code inserted ) Control Flow restricted in protected region
Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept. Next

Runtime Overhead: about 10%

Distribution & Execution Mechanism
Hidden Execution Sequence Attack

call ebx

Hidden JMP instruction, jump out of restricted region

Normal Execution Sequence
06/18/2000

Hidden Execution Sequence

Previous

Next

Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Distribution & Execution Mechanism

SFI on x86
f1:
func_id

No need to reserve 5 registers
No need to use hash table to verify the correctness of function entry

call ebx ret_id

ret
Globle Table 1: Globle Table 2:
Previous Next

No need for stack extension
06/18/2000

ret_id ->address

func_id ->address

Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Distribution & Execution Mechanism
Runtime overhead: C+J Applet vs Java Applet

C+J Applet

Java Applet

Time:???% Space:300%-400% +

C+J Applet Time:110%

(SFI overhead)

Space:100% (no overhead)

Java class library

Time:100%(no overhead) C+J Dynamic Lib Space:100%(no overhead)

Time:???%

Space:300%-400% +

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

Conclusion Contribution
Clean C+J library design C+J core library development Innovative cross-platform Architecture
Share binaries among OSes, cross-platform development Run C+J Applet in Web browser

A new SFI approach for CISC processors

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

Conclusion Future
Provides an ideal software architecture for mobile devices High performance Cross-platform development Flexible cross-platform distribution

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next

C+J Based Software Architecture

The End

Thank you

Previous 06/18/2000 Shanghai Jiaotong Univ. Computer Science & Engineering Dept.

Next


								
To top