int find(a, x) i = 0 while i < a.length if a[i] == x, return 0 i++ return i
i = 0 ; i < a.length ; a[i] == x ; ...
|
|
|
|
buffer b p() {... b.put() ...} c() {... b.get() ...} main {... fork(p) fork(c) ...}
|
int pthread_create( thread id, out to caller thread attributes, stack, priority, ... thread function, statements thread arguments) to the function void pthread_exit(result) int pthread_join( thread id, result)
class P implements Runnable { ... } class C implements Runnable { ... } Main() { Queue q = new Queue() Thread p = new Thread(new P(q)) Thread c = new Thread(new C(q)) p.run() ; c.run() p.join() ; c.join() }
avg, std dev | |||||
threads | processes | ||||
n = 100 | 123, 158 | 1730, 180 | |||
n = 1000 | 77, 41 | 1590, 321 |
This page last modified on 2012 February 6. |