More work on word-count.

Updated the MapReduce protocol so that it's correct more often. It's
still not perfect, but the bugs repro less often now.

Also found a race condition in channel sending. The problem is that
send and receive both need to refer to the _unread field in
circular_buffer. For now I just grabbed the port lock to send. We can
probably get around this by using atomics instead.
This commit is contained in:
Eric Holk 2011-07-21 12:11:05 -07:00
parent 8f2254b8c2
commit 8878b128ba
6 changed files with 134 additions and 36 deletions

View file

@ -41,7 +41,7 @@ mod map_reduce {
fn map_task(chan[ctrl_proto] ctrl,
str input) {
auto intermediates = map::new_str_hash();
fn emit(&map::hashmap[str, int] im,
@ -85,7 +85,7 @@ mod map_reduce {
while(num_mappers > 0) {
auto m;
ctrl |> m;
alt(m) {
case(mapper_done) { num_mappers -= 1; }
case(find_reducer(?k, ?cc)) {