# © Lab for Soft Tech, ETH Zurich, SSW WS03/041 2003-11-13 Week 46 – Overview Exercise 3: hints 64 bit addressing Exercise 2: solution.

## Presentation on theme: "© Lab for Soft Tech, ETH Zurich, SSW WS03/041 2003-11-13 Week 46 – Overview Exercise 3: hints 64 bit addressing Exercise 2: solution."— Presentation transcript:

© Lab for Soft Tech, ETH Zurich, SSW WS03/041 2003-11-13 Week 46 – Overview Exercise 3: hints 64 bit addressing Exercise 2: solution

© Lab for Soft Tech, ETH Zurich, SSW WS03/042 2003-11-13 A3.1 – 64-bit addressing – Size Consider an address space of 64 bits. Compute: the size of the addressable memory in bytes the number of 100GB disks needed to store the whole address space the time needed to read the whole memory with transfer rate of 1GB/s the size of a simple linear page table with the following page sizes: 4KB, 128KB and 4MB

© Lab for Soft Tech, ETH Zurich, SSW WS03/043 2003-11-13 A3.1 – Linear Page Table A simple linear page table: [pres]present bit (valid) [prot]protection bits (read, write, …) [mod]modified [ref]referenced [cache]caching disabled … physical frame addrpresprotmodrefcache 1 bit3 bits1 bit

© Lab for Soft Tech, ETH Zurich, SSW WS03/044 2003-11-13 A3.2 – Alternative Structures Discuss some alternatives to linear page tables. Describe how trees and inverted tables work. Which parts of these structures can potentially be swapped out? Which parts not? Compute the worst-case memory access time for a three-indirection levels page table.

© Lab for Soft Tech, ETH Zurich, SSW WS03/045 2003-11-13 A3.2 – Inverted Page Tables Virtual page number Offset Hash fnc Page frame number Hash anchor table PID VPF

© Lab for Soft Tech, ETH Zurich, SSW WS03/046 2003-11-13 A3.2 – Trees Only the first level page table is kept in memory (the others can be swapped out). CR3 (reg) Global tableMiddle tableOffset

© Lab for Soft Tech, ETH Zurich, SSW WS03/047 2003-11-13 A3.3 – IA-64 Read the article! Which is the idea behind region registers? What does pinning mean? Why and where is it used? Which page sizes are supported? Which size would you choose for stack, heap, mapped I/O and video frame buffer? Which TLBs are implemented? Which are the allowed operations on TLBs? Which access rights are supported? What is a virtual hash page table (VHPT)? How can this be used? What is virtual aliasing? How and where is this harmful?

© Lab for Soft Tech, ETH Zurich, SSW WS03/048 2003-11-13 Week 46 – Overview Exercise 3: hints 64 bit addressing Exercise 2: solution

© Lab for Soft Tech, ETH Zurich, SSW WS03/049 2003-11-13 A2.1 – Final Methods A final method cannot be modified. The address of called method is known at compile time. No virtual method table is necessary. public class Test { public final void foo() {} } public class MyClass { public void bar(Test t) { t.foo(); } The type of t is known (foo cannot be overwritten)

© Lab for Soft Tech, ETH Zurich, SSW WS03/0410 2003-11-13 A2.1 – Example class A { final void foo() { } class B extends A { } void bar(A myObject) { myObject.foo(); } the address of foo is known since no class could overwrite the method

© Lab for Soft Tech, ETH Zurich, SSW WS03/0411 2003-11-13 int i; int bar() { return 42; } class A void foo(int i) { write(i); } class B class C extends A, B A2.2 – Example

© Lab for Soft Tech, ETH Zurich, SSW WS03/0412 2003-11-13 int i; int bar() { return 42; } class A implements IA void foo(int i) { write(i); } class B implements IB class C implements IC int bar() ; interface IA void foo(int i); interface IB interface IC implements IA,IB

© Lab for Soft Tech, ETH Zurich, SSW WS03/0413 2003-11-13 int i; int bar() { return SA.bar(); } class A implements IA void foo(int i) { SB.foo(i); } class B implements IB class C implements IC int bar() ; interface IA void foo(int i); interface IB interface IC implements IA,IB static int bar() { return 42; } class SA static void foo(int i) { write(i); } class SB class SC int i; int bar() { return SA.bar(); } void foo(int i) { SB.foo(i); }

© Lab for Soft Tech, ETH Zurich, SSW WS03/0414 2003-11-13 C# Properties C# supports automatic getter and setter methods for fields: public class MyClass { private int x_; public int x { get { return x_; } set { x_ = value; } } } This properties can then be assigned as normal fields: MyClass o = new MyClass(); o.x = 42;

© Lab for Soft Tech, ETH Zurich, SSW WS03/0415 2003-11-13 int i; int bar() { return 42; } int i_get() { return i; } void i_set(int j) { i = j; } class A implements IA void foo(int i) { write(i); } class B implements IB class C implements IC int bar() ; int i_get(); void i_set(int j); interface IA void foo(int i); interface IB interface IC implements IA,IB static int bar() { return 42; } class SA static void foo(int i) { write(i); } class SB class SC int i; int bar() { return SA.bar(); } void foo(int i) { SB.foo(i); } int i_get() { return i; } void i_set(int j) { i = j; }

Download ppt "© Lab for Soft Tech, ETH Zurich, SSW WS03/041 2003-11-13 Week 46 – Overview Exercise 3: hints 64 bit addressing Exercise 2: solution."

Similar presentations