1 / 8

Overview

Overview. Assignment 7: hints Distributed objects Assignment 6: solution Living with a garbage collector. A7 - Distributed Objects. public interface RemoteFS { public byte[] readFile(String filename); public void writeFile(String filename, byte[] content); }.

binh
Télécharger la présentation

Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. A7 - Distributed Objects public interface RemoteFS { public byte[] readFile(String filename); public void writeFile(String filename, byte[] content); } 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/

  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 <filename> to read a File • echo <anything> | java RemoteFSClient <filename> to write a file • cat <fromFile> | java RemoteFSClient <toFile> copy

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

  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. 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. 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. 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

More Related