当前位置: 首页 > news >正文

MIT6.824(6.5840) Lab1笔记+源码

文章目录

  • 其他人的内容,笔记写的更好,思路可以去看他们的
  • MapReduce
    • worker
      • map
      • reduce
    • coordinator
    • rpc
    • 纠错
  • 源码
    • worker.go
    • coordinator.go
    • rpc.go

原本有可借鉴的部分
mrsequential.go,多看几遍源码

其他人的内容,笔记写的更好,思路可以去看他们的

MIT - 6.824 全课程 + Lab 博客总览-CSDN博客

MapReuce 详解与复现, 完成 MIT 6.824(6.5840) Lab1 - 掘金 (juejin.cn)

mit 6.824 lab1 笔记 - 掘金 (juejin.cn)

MapReduce

每个 worker 进程需完成以下工作:
向 master 进程请求 task,从若干文件中读取输入数据,执行 task,并将 task 的输出写入到若干文件中。

master 进程除了为 worker 进程分配 task 外,还需要检查在一定时间内(本实验中为 10 秒)每个 worker 进程是否完成了相应的 task,如果未完成的话则将该 task 转交给其他 worker 进程。

worker

worker函数包含map和redicef两个功能
需要知道自己执行哪个功能

worker 请求获取任务 GetTask

任务设置为结构体,其中一个字段为任务类型

type Task struct{Type:0 1 }0为map,1为reduce const枚举

一个为编号

如何获取任务?

GetTask请求coordinator的assignTask方法,传入为自己的信息(???),获得任务信息

自己当前的状态 空闲 忙碌

call(rpcname,args,reply)bool的rpcname对应coordinator.go中coordinator的相关方法

???没理解这个什么用
GetTask中调用call来从coordinator获取任务信息?

那么rpc.go来干什么

使用ihash(key) % NReduce为Map发出的每个KeyValue选择reduce任务号。随机选择序号
n个文件,生成m个不同文件 n X m个 文件??

保存多少个文件

map得到

对结果ohashkey,写入到文件序号1-10

根据序号分配reduce任务

将结果写入到同一文件

map

mapf func(filename string, content string) []KeyValue

filename是传入的文件名
content为传入的文件的内容——传入前需读取内容

传出intermediate[] 产生文件名 mr-x-y

reduce

reducef func(key string, values []string) string)

这里的key对应ihash生成的任务号??

coordinator

分配任务
需要创建几个map worker—根据几个文件
几个 reduce worker—根据设置,这里为10

coordinator函数用来生成唯一id

Coordinator 结构体定义

用来在不同rpc之间通信,所以其内容是公用的?

type Coordinator struct{files   []stringnReduce int
当前处在什么阶段? state}type dic struct{
status 0or1or2
id       
}

map[file string]

如何解决并发问题??

怎么查询worker的状态??

worker主动向coordinator发送信息

rpc

args 请求参数怎么定义

type args struct{

自己的身份信息

自己的状态信息

}

纠错

  1. 6.5840/mr.writeKVs({0xc000e90000, 0x1462a, 0x16800?}, 0xc00007d100, {0xc39d00, 0x0, 0x0?})
    /home/wang2/6.5840/src/mr/worker.go:109 +0x285

  2. *** Starting wc test.
    panic: runtime error: index out of range [1141634764] with length 0

    ihash取余

  3. runtime error: integer divide by zero

reply.NReduce = c.nReduce // 设置 NReduce

  1. 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

    cat: ‘mr-out*’: No such file or directory
    — too few parallel reduces.
    — reduce parallelism test: FAIL
    文件句柄问题

  2. sort: cannot read: ‘mr-out*’: No such file or directory
    cmp: EOF on mr-wc-all which is empty
    2024/07/19 11:15:10 dialing:dial unix /var/tmp/5840-mr-1000: connect: connection refused
    2024/07/19 11:15:10 dialing:dial unix /var/tmp/5840-mr-1000: connect: connection refused
    2024/07/19 11:15:10 dialing:dial unix /var/tmp/5840-mr-1000: connect: connection refused

  3. coordinator结构体的并发读取问题
    dialing:dial-http unix /var/tmp/5840-mr-1000: read unix @->/var/tmp/5840-mr-1000: read: connection reset by peer

源码

由于笔记等提示跟没有没区别,这里将源码放上,等大家实在没办法再看吧,
github仓库地址
注意lab1中的提示很重要

博主初期也迷茫过,检查bug也痛苦过,祝福大家。
在这里插入图片描述

有的时候也会出错,但是不想搞了–

在这里插入图片描述

worker.go

package mrimport ("encoding/json""fmt""io""os""sort""strings""time"
)
import "log"
import "net/rpc"
import "hash/fnv"// for sorting by key.
type ByKey []KeyValue// for sorting by key.
func (a ByKey) Len() int           { return len(a) }
func (a ByKey) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ByKey) Less(i, j int) bool { return a[i].Key < a[j].Key }const (Map = iotaReduceOver
)
const (Idle = iotaBusyFinish
)// Map functions return a slice of KeyValue.type KeyValue struct {Key   stringValue string
}// use ihash(key) % NReduce to choose the reduce
// task number for each KeyValue emitted by Map.func ihash(key string) int {h := fnv.New32a()h.Write([]byte(key))return int(h.Sum32() & 0x7fffffff)
}// main/mrworker.go calls this function.func Worker(mapf func(string, string) []KeyValue, reducef func(string, []string) string) {// Your worker implementation here.Ch := make(chan bool)for {var Res = &Args{State: Idle} //初始化为idle状态var TaskInformation = &TaskInfo{}GetTask(Res, TaskInformation)//主任务结束后不再请求if TaskInformation.TaskType == Over {break}//fmt.Println("do it!")go DoTask(TaskInformation, mapf, reducef, Ch)sign := <-Ch//fmt.Println("sign:", sign)if sign == true {//fmt.Println("Finish one,ID:", TaskInformation.TaskId)Done(Res, TaskInformation)} else {//TaskInformation.Status = Idle//fmt.Println("err one,ID:", TaskInformation.TaskId)call("Coordinator.Err", Res, TaskInformation)Res = &Args{State: Idle}}time.Sleep(time.Second)}// uncomment to send the Example RPC to the coordinator.//CallExample()}func GetTask(Args *Args, TaskInformation *TaskInfo) {// 调用coordinator获取任务for {call("Coordinator.AssignTask", Args, TaskInformation)//fmt.Println(TaskInformation)if TaskInformation.Status != Idle {Args.State = BusyArgs.Tasktype = TaskInformation.TaskTypeArgs.TaskId = TaskInformation.TaskId//fmt.Println("TaskInfo:", TaskInformation)//fmt.Println("Args:", Args)call("Coordinator.Verify", Args, TaskInformation)break}time.Sleep(time.Second)}//fmt.Printf("Type:%v,Id:%v\n", TaskInformation.TaskType, TaskInformation.TaskId)
}func writeKVs(KVs []KeyValue, info *TaskInfo, fConts []*os.File) {//fConts := make([]io.Writer, info.NReduce)KVset := make([][]KeyValue, info.NReduce)//fmt.Println("start write")//for j := 1; j <= info.NReduce; j++ {////	fileName := fmt.Sprintf("mr-%v-%v", info.TaskId, j)//	os.Create(fileName)////	f, _ := os.Open(fileName)//	fConts[j-1] = f////	defer f.Close()//}var Order intfor _, v := range KVs {Order = ihash(v.Key) % info.NReduceKVset[Order] = append(KVset[Order], v)}//fmt.Println("kvset:", KVset)for i, v := range KVset {for _, value := range v {data, _ := json.Marshal(value)_, err := fConts[i].Write(data)//fmt.Println("data: ", data)//fmt.Println("numbers:", write)if err != nil {return}}}//fmt.Println("finish write")
}func read(filename string) []byte {//fmt.Println("read", filename)file, err := os.Open(filename)defer file.Close()if err != nil {log.Fatalf("cannot open %v", filename)fmt.Println(err)}content, err := io.ReadAll(file)if err != nil {log.Fatalf("cannot read %v", filename)}return content
}// DoTask 执行mapf或者reducef任务func DoTask(info *TaskInfo, mapf func(string, string) []KeyValue, reducef func(string, []string) string, Ch chan bool) {//fConts := make([]io.Writer, info.NReduce)//fmt.Println("start", info.TaskId)//go AssignAnother(Ch)switch info.TaskType {case Map:info.FileContent = string(read(info.FileName))//fmt.Println(info.FileContent)KVs := mapf(info.FileName, info.FileContent.(string))//fmt.Println("map:", KVs)//将其排序sort.Sort(ByKey(KVs))var fConts []*os.File // 修改为 *os.File 类型//0-9for j := 0; j < info.NReduce; j++ {//暂时名,完成后重命名fileName := fmt.Sprintf("mr-%v-%v-test", info.TaskId, j)//_, err := os.Create(fileName)//if err != nil {//	fmt.Println(err)//	return//}////f, _ := os.Open(fileName)//fConts[j-1] = f////defer f.Close()f, err := os.Create(fileName) // 直接使用 Create 函数if err != nil {fmt.Println(err)return}//fmt.Println("creatfile:  ", fileName)//fConts[j] = ffConts = append(fConts, f)defer os.Rename(fileName, strings.TrimSuffix(fileName, "-test"))defer f.Close()}writeKVs(KVs, info, fConts)case Reduce:fileName := fmt.Sprintf("testmr-out-%v", info.TaskId)fileOS, err := os.Create(fileName)//fmt.Println("create success")if err != nil {fmt.Println("Error creating file:", err)return}defer os.Rename(fileName, strings.TrimPrefix(fileName, "test"))defer fileOS.Close()var KVs []KeyValue//读取文件for i := 0; i < info.Nmap; i++ {fileName := fmt.Sprintf("mr-%v-%v", i, info.TaskId)//fmt.Println(fileName)file, err := os.Open(fileName)defer file.Close()if err != nil {fmt.Println(err)}dec := json.NewDecoder(file)for {var kv KeyValueif err := dec.Decode(&kv); err != nil {break}//fmt.Println(kv)KVs = append(KVs, kv)}}//var KVsRes []KeyValuesort.Sort(ByKey(KVs))//整理并传输内容给reducei := 0for i < len(KVs) {j := i + 1for j < len(KVs) && KVs[j].Key == KVs[i].Key {j++}values := []string{}for k := i; k < j; k++ {values = append(values, KVs[k].Value)}// this is the correct format for each line of Reduce output.output := reducef(KVs[i].Key, values)//每个key对应的计数//KVsRes = append(KVsRes, KeyValue{KVs[i].Key, output})fmt.Fprintf(fileOS, "%v %v\n", KVs[i].Key, output)i = j}}Ch <- true}func Done(Arg *Args, Info *TaskInfo) {//Info.Status = Idlecall("Coordinator.WorkerDone", Arg, Info)//arg重新清空Arg = &Args{State: Idle}
}func AssignAnother(Ch chan bool) {time.Sleep(2 * time.Second)Ch <- false
}// example function to show how to make an RPC call to the coordinator.
//
// the RPC argument and reply types are defined in rpc.go.
func CallExample() {// declare an argument structure.args := ExampleArgs{}// fill in the argument(s).args.X = 99// declare a reply structure.reply := ExampleReply{}// send the RPC request, wait for the reply.// the "Coordinator.Example" tells the// receiving server that we'd like to call// the Example() method of struct Coordinator.ok := call("Coordinator.Example", &args, &reply)if ok {// reply.Y should be 100.fmt.Printf("reply.Y %v\n", reply.Y)} else {fmt.Printf("call failed!\n")}
}// send an RPC request to the coordinator, wait for the response.
// usually returns true.
// returns false if something goes wrong.func call(rpcname string, args interface{}, reply interface{}) bool {// c, err := rpc.DialHTTP("tcp", "127.0.0.1"+":1234")sockname := coordinatorSock()//fmt.Println("Worker is dialing", sockname)c, err := rpc.DialHTTP("unix", sockname)if err != nil {//log.Fatal("dialing:", err)return false}defer c.Close()err = c.Call(rpcname, args, reply)if err != nil {//fmt.Println(err)return false}return true
}

coordinator.go

package mrimport ("log""sync""time"
)
import "net"
import "os"
import "net/rpc"
import "net/http"type Coordinator struct {// Your definitions here.files      []stringnReduce    intMapTask    map[int]*TaskReduceTask []intOK         boolLock       sync.Mutex
}type Task struct {fileName stringstate    int
}var TaskMapR map[int]*Taskfunc (c *Coordinator) Verify(Arg *Args, Reply *TaskInfo) error {switch Arg.Tasktype {case Map:time.Sleep(3 * time.Second)if c.MapTask[Arg.TaskId].state != Finish {c.MapTask[Arg.TaskId].state = IdleReply = &TaskInfo{}}case Reduce:time.Sleep(3 * time.Second)if c.ReduceTask[Arg.TaskId] != Finish {c.ReduceTask[Arg.TaskId] = IdleReply = &TaskInfo{}}}return nil
}// Your code here -- RPC handlers for the worker to call.
func (c *Coordinator) AssignTask(Arg *Args, Reply *TaskInfo) error {c.Lock.Lock()defer c.Lock.Unlock()//如果请求为空闲if Arg.State == Idle {//Args.State = Busy//首先分配Mapfor i, task := range c.MapTask {//fmt.Println(*task, "Id:", i)if task.state == Idle {//Arg.Tasktype = Map//Arg.TaskId = i + 1Reply.TaskType = MapReply.FileName = task.fileName//fmt.Println(task.fileName)Reply.TaskId = i          //range从0开始Reply.NReduce = c.nReduce // 设置 NReduceReply.Status = Busytask.state = Busy//fmt.Println("map,Id:", i)return nil}}//Map完成后再Reducefor _, task := range c.MapTask {if task.state != Finish {//fmt.Println("等待Map完成")return nil}}//fmt.Println("MapDone")//分配Reducefor i, v := range c.ReduceTask {//fmt.Println(c.ReduceTask)if v == Idle {Arg.Tasktype = ReduceArg.TaskId = iReply.TaskType = ReduceReply.TaskId = iReply.NReduce = c.nReduce // 设置 NReduceReply.Status = BusyReply.Nmap = len(c.files)c.ReduceTask[i] = Busy//fmt.Println(c.ReduceTask[i])//fmt.Println("reduce", i)return nil}}//Reduce都结束则成功for _, v := range c.ReduceTask {if v == Finish {} else {return nil}}Reply.TaskType = Overc.OK = true}return nil
}func (c *Coordinator) WorkerDone(args *Args, reply *TaskInfo) error {//c.Lock.Lock()//defer c.Lock.Unlock()//reply清空reply = &TaskInfo{}//args.State = Finishid := args.TaskId//fmt.Println("id", id)switch args.Tasktype {case Map:c.MapTask[id].state = Finish//fmt.Println(*c.MapTask[id])case Reduce:c.ReduceTask[id] = Finish//fmt.Println(c.ReduceTask)}return nil
}func (c *Coordinator) Err(args *Args, reply *TaskInfo) error {//c.Lock.Lock()//defer c.Lock.Unlock()reply = &TaskInfo{}id := args.TaskIdswitch args.Tasktype {case Map:if c.MapTask[id].state != Finish {c.MapTask[id].state = Idle}case Reduce:if c.ReduceTask[id] != Finish {c.ReduceTask[id] = Idle}}return nil
}// an example RPC handler.
//
// the RPC argument and reply types are defined in rpc.go.func (c *Coordinator) Example(args *ExampleArgs, reply *ExampleReply) error {reply.Y = args.X + 1return nil
}// start a thread that listens for RPCs from worker.gofunc (c *Coordinator) server() {rpc.Register(c)rpc.HandleHTTP()sockname := coordinatorSock()os.Remove(sockname)l, e := net.Listen("unix", sockname)if e != nil {log.Fatal("listen error:", e)}//fmt.Println("Coordinator is listening on", sockname)go http.Serve(l, nil)
}// main/mrcoordinator.go calls Done() periodically to find out
// if the entire job has finished.func (c *Coordinator) Done() bool {//c.Lock.Lock()//defer c.Lock.Unlock()ret := falseif c.OK == true {ret = true}// Your code here.return ret
}// create a Coordinator.
// main/mrcoordinator.go calls this function.
// nReduce is the number of reduce tasks to use.
func MakeCoordinator(files []string, nReduce int) *Coordinator {//fmt.Println(files)TaskMapR = make(map[int]*Task, len(files))for i, file := range files {TaskMapR[i] = &Task{fileName: file,state:    Idle,}}ReduceMap := make([]int, nReduce)c := Coordinator{files:      files,nReduce:    nReduce,MapTask:    TaskMapR,ReduceTask: ReduceMap,OK:         false,}// Your code here.c.server()return &c
}

rpc.go

package mr//
// RPC definitions.
//
// remember to capitalize all names.
//import "os"
import "strconv"//
// example to show how to declare the arguments
// and reply for an RPC.
//type ExampleArgs struct {X int
}type ExampleReply struct {Y int
}// Add your RPC definitions here.type Args struct {State    intTasktype intTaskId   int
}type TaskInfo struct {Status intTaskType int //任务基本信息TaskId   intNReduce intNmap    intFileName    stringFileContent any//Key    string //reduce所需信息//Values []string
}// Cook up a unique-ish UNIX-domain socket name
// in /var/tmp, for the coordinator.
// Can't use the current directory since
// Athena AFS doesn't support UNIX-domain sockets.func coordinatorSock() string {s := "/var/tmp/5840-mr-"s += strconv.Itoa(os.Getuid())return s
}

相关文章:

MIT6.824(6.5840) Lab1笔记+源码

文章目录 其他人的内容&#xff0c;笔记写的更好&#xff0c;思路可以去看他们的MapReduceworkermapreduce coordinatorrpc纠错 源码worker.gocoordinator.gorpc.go 原本有可借鉴的部分 mrsequential.go&#xff0c;多看几遍源码 其他人的内容&#xff0c;笔记写的更好&#xf…...

【目录】8051汇编与C语言系列教程

8051汇编与C语言系列教程 作者将狼才鲸创建日期2024-07-23 CSDN文章地址&#xff1a;【目录】8051汇编与C语言系列教程本Gitee仓库原始地址&#xff1a;才鲸嵌入式/8051_c51_单片机从汇编到C_从Boot到应用实践教程 一、本教程目录 序号教程名称简述教程链接1点亮LCD灯通过IO…...

群管机器人官网源码

一款非常好看的群管机器人html官网源码 搭建教程&#xff1a; 域名解析绑定 源码文件上传解压 访问域名即可 演示图片&#xff1a; 群管机器人官网源码下载&#xff1a;客户端下载 - 红客网络编程与渗透技术 原文链接&#xff1a; 群管机器人官网源码...

整合EasyExcel实现灵活的导入导出java

引入pom依赖 <dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId></dependency>实现功能 结合Vue前端&#xff0c;实现浏览器页面直接导出日志文件实现文件的灵活导入文件导出 3. 实体类 实体类里有自定义转…...

springSecurity学习之springSecurity web如何取得用户信息

web如何取得用户信息 之前说过SecurityContextHolder默认使用的是ThreadLocal来进行存储的&#xff0c;而且每次都会清除&#xff0c;但是web每次请求都会验证用户权限&#xff0c;这是如何做到的呢&#xff1f; 这是通过SecurityContextPersistenceFilter来实现的&#xff0…...

eclipse中的classbean导入外部class文件,clean项目后删除问题

最近被eclipse搞得头疼&#xff0c;下午终于解决 eclipse创建的java项目中&#xff0c;类的输出目录是classbean。由于项目需要&#xff0c;classbean目录下已经导入了外部的类&#xff0c;但每次clean项目时&#xff0c;会把class删掉。 广泛查询&#xff0c;eclipse不清空c…...

OBD诊断(ISO15031) 0A服务

文章目录 功能简介ISO 15765-4的诊断服务定义1、请求具有永久状态的排放相关故障诊断码2、请求具有永久状态的排放相关故障诊断码3、示例报文 功能简介 0A服务&#xff0c;即 Request emission-related diagnostic trouble code with permanent status&#xff08;请求排放相关…...

ForCloud全栈安全体验,一站式云安全托管试用 开启全能高效攻防

对于正处于业务快速发展阶段的企业&#xff0c;特别是大型央国企而言&#xff0c;日常的安全部署和运营管理往往横跨多家子公司&#xff0c;所面临的挑战不言而喻。尤其是在面对当前常态化的大型攻防演练任务时&#xff0c;难度更是呈“几何级数”上升&#xff1a; 合规难 众…...

Java——————接口(interface) <详解>

1.1 接口的概念 在现实生活中&#xff0c;接口的例子比比皆是&#xff0c;比如&#xff1a;笔记本电脑上的USB接口&#xff0c;电源插座等。 电脑的USB口上&#xff0c;可以插&#xff1a;U盘、鼠标、键盘...所有符合USB协议的设备 电源插座插孔上&#xff0c;可以插&#xff…...

【C++】【继承】【子对象】【构造函数】含子对象的派生类的构造函数写法

&#xff08;1&#xff09;子对象的概念&#xff1a;若派生类A1的数据成员中包含基类A的对象a&#xff0c;则a为派生类A1的子对象 &#xff08;2&#xff09;含子对象的派生类的构造函数的执行顺序是&#xff1a; ①调用基类构造函数&#xff0c;对基类数据成员初始化 ②调用子…...

golang语言 .go文件版本条件编译,xxx.go文件指定go的编译版本必须大于等于xxx才生效的方法, 同一个项目多个go版本文件共存方法

在go语言中&#xff0c;我们不关是可以在编译时指定版本&#xff0c; 在我们的xxx.go文件中也可以指定go的运行版本&#xff0c;即 忽略go.mod中的版本&#xff0c;而是当当前的go运行版本达到指定条件后才生效的xxx.go文件。 方法如下&#xff1a; 我们通过在xxx.go文件的头部…...

深入浅出mediasoup—通信框架

libuv 是一个跨平台的异步事件驱动库&#xff0c;用于构建高性能和可扩展的网络应用程序。mediasoup 基于 libuv 构建了包括管道、信号和 socket 在内的一整套通信框架&#xff0c;具有单线程、事件驱动和异步的典型特征&#xff0c;是构建高性能 WebRTC 流媒体服务器的重要基础…...

每日一题 LeetCode03 无重复字符的最长字串

1.题目描述 给定一个字符串 s &#xff0c;请你找出其中不含有重复字符的最长字串的长度。 2 思路 可以用两个指针, 滑动窗口的思想来做这道题,即定义两个指针.一个left和一个right 并且用一个set容器,一个length , 一个maxlength来记录, 让right往右走,并且用一个set容器来…...

栈和队列(C语言)

栈的定义 栈&#xff1a;一种特殊的线性表&#xff0c;其只允许在固定的一端进行插入和删除元素操作。进行数据插入和删除操作的一端称为栈顶&#xff0c;另一端称为栈底。栈中的数据元素遵守后进先出LIFO&#xff08;Last In First Out&#xff09;的原则。 压栈&#xff1a;…...

swagger-ui.html报错404

问题1&#xff1a;权限受限无法访问 由于采用的Shiro安全框架&#xff0c;需要在配置类ShiroConfig下的Shiro 的过滤器链放行该页面&#xff1a;【添加&#xff1a;filterChainDefinitionMap.put("/swagger-ui.html", "anon");】 public ShiroFilterFact…...

Milvus 核心组件(3)--- MinIO详解

目录 背景 MinIO 安装 docker desktop 安装 Ubuntu UI 在 docker 中的安装 Minio 下载及安装 启动minio docker image 保存 启动 minio web 网页 下一次启动 MinIO基本概念 基本概述 主要特性 应用场景 MinIO 使用 连接server 创建bucket 查询bucket 上传文件…...

[数据集][目标检测]婴儿车检测数据集VOC+YOLO格式1073张5类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;1073 标注数量(xml文件个数)&#xff1a;1073 标注数量(txt文件个数)&#xff1a;1073 标注…...

JAVASE进阶day14(网络编程续TCP,日志)

TCP 三次握手 四次挥手 package com.lu.day14.tcp;import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket;public class Client {public static void main(String[] args) {try(Socket socket new Socket("192.…...

机器学习(五) -- 无监督学习(1) --聚类1

系列文章目录及链接 上篇&#xff1a;机器学习&#xff08;五&#xff09; -- 监督学习&#xff08;7&#xff09; --SVM2 下篇&#xff1a;机器学习&#xff08;五&#xff09; -- 无监督学习&#xff08;1&#xff09; --聚类2 前言 tips&#xff1a;标题前有“***”的内容…...

leetcode 116. 填充每个节点的下一个右侧节点指针

leetcode 116. 填充每个节点的下一个右侧节点指针 题目 给定一个 完美二叉树 &#xff0c;其所有叶子节点都在同一层&#xff0c;每个父节点都有两个子节点。二叉树定义如下&#xff1a; struct Node { int val; Node *left; Node *right; Node *next; } 填充它的每个 next …...

stm32G473的flash模式是单bank还是双bank?

今天突然有人stm32G473的flash模式是单bank还是双bank&#xff1f;由于时间太久&#xff0c;我真忘记了。搜搜发现&#xff0c;还真有人和我一样。见下面的链接&#xff1a;https://shequ.stmicroelectronics.cn/forum.php?modviewthread&tid644563 根据STM32G4系列参考手…...

Linux链表操作全解析

Linux C语言链表深度解析与实战技巧 一、链表基础概念与内核链表优势1.1 为什么使用链表&#xff1f;1.2 Linux 内核链表与用户态链表的区别 二、内核链表结构与宏解析常用宏/函数 三、内核链表的优点四、用户态链表示例五、双向循环链表在内核中的实现优势5.1 插入效率5.2 安全…...

在rocky linux 9.5上在线安装 docker

前面是指南&#xff0c;后面是日志 sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo dnf install docker-ce docker-ce-cli containerd.io -y docker version sudo systemctl start docker sudo systemctl status docker …...

iPhone密码忘记了办?iPhoneUnlocker,iPhone解锁工具Aiseesoft iPhone Unlocker 高级注册版​分享

平时用 iPhone 的时候&#xff0c;难免会碰到解锁的麻烦事。比如密码忘了、人脸识别 / 指纹识别突然不灵&#xff0c;或者买了二手 iPhone 却被原来的 iCloud 账号锁住&#xff0c;这时候就需要靠谱的解锁工具来帮忙了。Aiseesoft iPhone Unlocker 就是专门解决这些问题的软件&…...

UDP(Echoserver)

网络命令 Ping 命令 检测网络是否连通 使用方法: ping -c 次数 网址ping -c 3 www.baidu.comnetstat 命令 netstat 是一个用来查看网络状态的重要工具. 语法&#xff1a;netstat [选项] 功能&#xff1a;查看网络状态 常用选项&#xff1a; n 拒绝显示别名&#…...

剑指offer20_链表中环的入口节点

链表中环的入口节点 给定一个链表&#xff0c;若其中包含环&#xff0c;则输出环的入口节点。 若其中不包含环&#xff0c;则输出null。 数据范围 节点 val 值取值范围 [ 1 , 1000 ] [1,1000] [1,1000]。 节点 val 值各不相同。 链表长度 [ 0 , 500 ] [0,500] [0,500]。 …...

【论文笔记】若干矿井粉尘检测算法概述

总的来说&#xff0c;传统机器学习、传统机器学习与深度学习的结合、LSTM等算法所需要的数据集来源于矿井传感器测量的粉尘浓度&#xff0c;通过建立回归模型来预测未来矿井的粉尘浓度。传统机器学习算法性能易受数据中极端值的影响。YOLO等计算机视觉算法所需要的数据集来源于…...

[Java恶补day16] 238.除自身以外数组的乘积

给你一个整数数组 nums&#xff0c;返回 数组 answer &#xff0c;其中 answer[i] 等于 nums 中除 nums[i] 之外其余各元素的乘积 。 题目数据 保证 数组 nums之中任意元素的全部前缀元素和后缀的乘积都在 32 位 整数范围内。 请 不要使用除法&#xff0c;且在 O(n) 时间复杂度…...

智能仓储的未来:自动化、AI与数据分析如何重塑物流中心

当仓库学会“思考”&#xff0c;物流的终极形态正在诞生 想象这样的场景&#xff1a; 凌晨3点&#xff0c;某物流中心灯火通明却空无一人。AGV机器人集群根据实时订单动态规划路径&#xff1b;AI视觉系统在0.1秒内扫描包裹信息&#xff1b;数字孪生平台正模拟次日峰值流量压力…...

Docker 本地安装 mysql 数据库

Docker: Accelerated Container Application Development 下载对应操作系统版本的 docker &#xff1b;并安装。 基础操作不再赘述。 打开 macOS 终端&#xff0c;开始 docker 安装mysql之旅 第一步 docker search mysql 》〉docker search mysql NAME DE…...