Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Overview Assignment 7: hints  Distributed objects Assignment 6: solution  Living with a garbage collector.

Similar presentations


Presentation on theme: "1 Overview Assignment 7: hints  Distributed objects Assignment 6: solution  Living with a garbage collector."— Presentation transcript:

1 1 Overview Assignment 7: hints  Distributed objects Assignment 6: solution  Living with a garbage collector

2 2 A7 - Distributed Objects Imagine a distributed FileSystem as a distributed object of type: Write a small client/server Application using Java/RMI http://java.sun.com/docs/books/tutorial/rmi/ public interface RemoteFS { public byte[] readFile(String filename); public void writeFile(String filename, byte[] content); }

3 3 A7 - RMI Client operates on Interface, Implementation on a remote Server It should be possible to use the client program in the following way:  java RemoteFSClient to read a File  echo | java RemoteFSClient to write a file  cat | java RemoteFSClient copy

4 4 Overview Assignment 7: hints  Distributed objects Assignment 6: solution  Living with a garbage collector

5 5 A6 Ex1 – Finalizers Finalizers are not executed by the GC:  takes time  could block Resuscitation:  Finalizers are executed only once  The finalizer of a resuscitated object is not run again (since there is no entry in the finalizer queue)  Finalizers can be re-enabled using ReRegisterForFinalize

6 6 A6 Ex1 – Finalizers Pointers in finalizers:  Objects referenced in finalizers could be invalid since objects are disposed in no particular order.  Dependencies should be handled by the user (e.g. in a close method).

7 7 A6 Ex2 – Write barriers To check if we have a pointer from an older generation to a younger one for each assignment is expensive.  we divide the heap in small regions (cards)  we mark the enclosing region every time we update a pointer  at GC time we check for all the marked cards if such an old-young reference was created.

8 8 A6 Ex3 – Weak pointers.NET  big structures that can be easily reconstructed  ex: file hierarchy, file buffers, I/O buffers Java  object monitoring (A  B) we can link them without blocking collection an object (A) receives a notification when the pointed-to object (B) is removed


Download ppt "1 Overview Assignment 7: hints  Distributed objects Assignment 6: solution  Living with a garbage collector."

Similar presentations


Ads by Google