(undone) MIT6.824 Lab1

server/2024/10/21 5:41:34/

参考:http://nil.csail.mit.edu/6.824/2021/labs/lab-mr.html


task1: 熟悉讲义,尤其是搞明白如何运行测试程序(完成) ------------------------------------------------ start

先看 Introduction
我们的目标:构建一个MapReduce系统。
细节:实现一个工作进程,调用应用程序的Map和Reduce函数,并处理文件的读写;同时还将实现一个协调进程,负责分配任务给工作进程并应对失败的工作进程。构建的内容类似于MapReduce论文中描述的内容。(注意:实验中使用“协调者”而不是论文中的“主节点”。)
在这里插入图片描述

细节在后边
在这里插入图片描述
先根据讲义下载 LAB 代码

git clone git://g.csail.mit.edu/6.824-golabs-2021 6.824

看讲义:代码中已经有了 word-count 和 text indexer 两个应用。同时还有一个极简单的 MapReduce 实现(在一个进程中,一次只运行一个 map 和 一个reduce)。
我们电脑上没 go ,先安装,安装步骤如下 (WSL2 ubuntu20.04)

wget -qO- https://golang.org/dl/go1.15.8.linux-amd64.tar.gz | sudo tar xz -C /usr/local
sudo ln -s /usr/local/go/bin/go /usr/local/bin/go

安装完毕,我们试着按照讲义运行 word count 这个应用

cd ~/6.824
cd src/main
go build -race -buildmode=plugin ../mrapps/wc.go
go run -race mrsequential.go wc.so pg*.txt
more mr-out-0

出现了单词统计结果:
在这里插入图片描述
看来顺利运行了

看看后边的内容
这一段概述了要做的事情(作业目标)
在这里插入图片描述

下面内容介绍了一些代码大致位置:
1.main函数,包括对 协调者 和 工作者 的调动,在 main/mrcoordinator.go 里(不应修改)
2.我们的实现应该放在 mr/coordinator.go, mr/worker.go 和 mr/rpc.go 里
更多内容看后边
在这里插入图片描述
仔细阅读了后边的内容,总结了运行测试程序的方式:
1.修改 mr/coordinator.go Done 函数中的 返回值,把 return false 改成 return true
2.在 main 文件夹下,运行 bash test-mr.sh
看到输出如下:

*** Starting wc test.
2024/09/29 10:39:19 rpc.Register: method "Done" has 1 input parameters; needs exactly three
sort: cannot read: 'mr-out*': No such file or directory
cmp: EOF on mr-wc-all which is empty
--- wc output is not the same as mr-correct-wc.txt
--- wc test: FAIL
*** Starting indexer test.
2024/09/29 10:39:21 rpc.Register: method "Done" has 1 input parameters; needs exactly three
sort: cannot read: 'mr-out*': No such file or directory
cmp: EOF on mr-indexer-all which is empty
--- indexer output is not the same as mr-correct-indexer.txt
--- indexer test: FAIL
*** Starting map parallelism test.
2024/09/29 10:39:22 rpc.Register: method "Done" has 1 input parameters; needs exactly three
cat: 'mr-out*': No such file or directory
--- saw 0 workers rather than 2
--- map parallelism test: FAIL
cat: 'mr-out*': No such file or directory
--- map workers did not run in parallel
--- map parallelism test: FAIL
*** Starting job count test.
2024/09/29 10:39:24 rpc.Register: method "Done" has 1 input parameters; needs exactly three
cat: 'mr-out*': No such file or directory
test-mr.sh: line 170: [: : integer expression expected
--- job count test: PASS
*** Starting early exit test.
2024/09/29 10:39:25 rpc.Register: method "Done" has 1 input parameters; needs exactly three
sort: cannot read: 'mr-out*': No such file or directory
sort: cannot read: 'mr-out*': No such file or directory
--- early exit test: PASS
*** Starting crash test.
2024/09/29 10:39:26 rpc.Register: method "Done" has 1 input parameters; needs exactly three
sort: cannot read: 'mr-out*': No such file or directory
cmp: EOF on mr-crash-all which is empty
--- crash output is not the same as mr-correct-crash.txt
--- crash test: FAIL
*** FAILED SOME TESTS

本 task 完成

task1: 熟悉讲义,尤其是搞明白如何运行测试程序(完成) ------------------------------------------------ end

task2: 该明白测试程序的原理,尤其是如何测试代码是并行运行的 ------------------------------------------------ start

TODO:here

task2: 该明白测试程序的原理,尤其是如何测试代码是并行运行的 ------------------------------------------------ end

TODO: 看看 word count 和 MapReduce 的联动

TODO: here


http://www.ppmy.cn/server/127372.html

相关文章

基于ESP8266—AT指令连接阿里云+MQTT透传数据(1)

在阿里云创建MQTT产品的过程涉及几个关键步骤,主要包括注册阿里云账号、实名认证、开通MQTT服务实例、创建产品与设备等。以下是详细的步骤说明: 一、准备工作 访问阿里云官网,点击注册按钮,填写相关信息(如账号、密码、手机号等)完成注册。注册完成后,需要对账号进行实…

Django一分钟:使用prefetch_related避免陷入大量的查询中导致严重的性能问题

本文将通过简单的示例介绍为什么要使用prefetch_related。 准备工作 创建模型 from django.db import modelsclass Product(models.Model):product_name models.CharField(max_length255)class Component(models.Model):product models.ForeignKey(Product, on_deletemode…

誉天Linux云计算课程学什么?为什么保障就业?

一个IT工程师相当于干了哪些职业? 其中置顶回答生动而形象地描绘道: 一个IT工程师宛如一个超级多面手,相当于——加班狂程序员测试工程师实施工程师网络工程师电工装卸工搬运工超人。 此中酸甜苦辣咸,相信很多小伙伴们都深有体会。除了典…

图片编辑添加文字,四款快速上手的软件分享

在这个视觉为王的时代,一张吸睛的图片往往能瞬间抓住读者的眼球。而想要在图片上优雅地添加文字,不仅能为作品增添灵魂,还能让你的社交媒体动态、博客文章或是产品展示更加生动有趣。今天,就为大家揭秘四款简单易上手、功能强大的…

角色动画——RootMotion全解

1. Unity(2022)的应用 由Animtor组件控制 在Animation Clip下可进行详细设置 ​ 官方文档的介绍(Animation选项卡 - Unity 手册) 上述动画类型在Rag选项卡中设置: Rig 选项卡上的设置定义了 Unity 如何将变形体映射到导入模型中的网格,以便能够将其动画化。 对于人…

Centos怎么执行脚本

方法一:切换到shell脚本所在的目录(此时,称为工作目录)执行shell脚本 cd /data/shell ./hello.sh 方法二:以绝对路径的方式去执行bash shell脚本 /data/shell/hello.sh 方法三:直接使用bash 或sh 来执行…

睡眠对于生活的重要性

在快节奏的现代生活中,健康养生不再是遥不可及的概念,而是融入日常每一刻的必需。其中,睡眠作为生命不可或缺的环节,其重要性往往被忽视,实则它是身体修复、能量积蓄的黄金时段。今天,让我们深入探讨“健康…

Web 服务器与动态脚本语言通信的接口协议有哪些

Web 服务器与动态脚本语言通信的接口协议主要有以下几种: 一、FastCGI(Fast Common Gateway Interface) 特点:使用持久进程处理请求,减少了进程启动和关闭的开销,提高了性能和可扩展性。多个请求可由同一个…