24.10.2013 Views

Using Kilim's isolation types for multicore efficiency

Using Kilim's isolation types for multicore efficiency

Using Kilim's isolation types for multicore efficiency

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Type Systems – weakness<br />

UNIVERSITYOF<br />

CAMBRIDGE<br />

Variables keeping the same type throughout a block means that the<br />

two errors in the following program can’t be detected by the type<br />

system:<br />

{ char *x = malloc(10); // x has type char *<br />

foo(x); // x has type char *<br />

free(x); // x has type char * (but should not??)<br />

foo(x); // a well-known disaster...<br />

x = malloc(20); // x has type char * (and should)<br />

// problem: a memory leak now occurs<br />

} // as x goes out-of-scope<br />

Replacing free(x) with pass_ownership(x,task42) shows the<br />

weakness of classical <strong>types</strong> at controlling sharing of data.<br />

<strong>Using</strong> Kilim’s <strong>isolation</strong> <strong>types</strong> <strong>for</strong> <strong>multicore</strong> <strong>efficiency</strong> 23 FoVeOOS’2011

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!