icexin 最近的时间轴更新
icexin's repos on GitHub
Go · 2193 人关注
eggos
A Go unikernel running on x86 bare metal
Go · 1857 人关注
gocraft
A Minecraft like game written in go
Go · 76 人关注
gocraft-server
gocraft's server https://github.com/icexin/gocraft
Go · 51 人关注
dueros
百度DuerOS的golang实现
HTML · 30 人关注
eggos-book
The docs of eggos
Go · 10 人关注
brpc-go
Go version of brpc baidu_std protocol implementation
Go · 5 人关注
markdown
markdown parses markdown file and generates html in github style
Go · 4 人关注
clang_complete
A tool generates .clang_complete file for c++ project
Go · 4 人关注
gotun
Simple tunnel using tun/tap
Go · 4 人关注
gowasm
gowasm is a go runtime implemention for WebAssembly generated by go(>=1.11) toolchain.
C · 3 人关注
fanos
A toy os implemention
2 人关注
delve
Delve is a debugger for the Go programming language.
Go · 1 人关注
avro
Package avro implements encoding and decoding of avro objects
Go · 1 人关注
fdfs
Package fdfs implements fastdfs client in pure go
Go · 1 人关注
god
HTML · 0 人关注
blog
The blog site
TypeScript · 0 人关注
ChatGPT-Next-Web
一键拥有你自己的 ChatGPT 网页服务。 One-Click to deploy your own ChatGPT web UI.
Go · 0 人关注
clusterd
Start multiple apps at once when debugging
0 人关注
contract-sdk-go
The Go contract sdk for xuperchain
0 人关注
doc-comments
JavaScript · 0 人关注
docs
documents of xuperchain
Emacs Lisp · 0 人关注
emacs.d
My emacs.d profile forked from https://github.com/purcell/emacs.d
Go · 0 人关注
gcdemo
a simple mark-and-sweep garbage collection algorithm implementation in golang.
C · 0 人关注
glfw
Go bindings for GLFW 3
Go · 0 人关注
goc
a simple go to c translator
Go · 0 人关注
golib
golib for test
0 人关注
havenask
0 人关注
iavl
Merkleized IAVL+ Tree implementation in Go
Python · 0 人关注
lispy
Automatically exported from code.google.com/p/lispy
Go · 0 人关注
log15
Structured, composable logging for Go
icexin

icexin

V2EX 第 97481 号会员,加入于 2015-02-14 19:43:08 +08:00
将 Go 程序跑在裸机上之 LibOS
  •  3   
    Go 编程语言  •  icexin  •  2021-08-09 11:51:44 AM  •  最后回复来自 wupeaking
    15
    Go 编写的跑在 x86 裸机上的 unikernel
    Go 编程语言  •  icexin  •  2020-10-18 19:14:41 PM  •  最后回复来自 icexin
    22
    go 实现的 Minecraft
  •  2   
    Go 编程语言  •  icexin  •  2018-04-08 01:20:22 AM  •  最后回复来自 zjyl1994
    27
    icexin 最近回复了
    一般是通过 jit 编译到机器码的,具体实现上可以有不经过优化的一遍翻译,也可以有多遍的优化编译。可以参考一下 v8 的 https://v8.dev/blog/liftoff
    2021-11-30 14:50:41 +08:00
    回复了 sunny1688 创建的主题 问与答 关于 golang 碰到的一个问题!
    大家回答的点都集中在内存回收上,实际的问题是没有加锁导致的不变式被打破的问题。

    实际的 slice 包含 data ,len 和 cap 字段,这些大家也都知道了。slice 结构的不变式是:在任意时刻,data 指向的数据长度都是至少是 len 长度,否则访问 len-1 的数据就会 内存错误。

    在题主的代码里面,多个 goroutine 同时对 demo.llist 进行赋值,但因为没有加锁,所以赋值不是原子的,从而会出现一个 goroutine 刚赋值了 data ,还没来得及赋值 data 和 cap 就被其他 goroutine 拿去用了, 破坏了不变式, 从而在扩容的时候就访问了非法内存,从而 panic 。

    一段简单代码就可以复现:


    package main

    import "log"

    type T struct {
    A, B int
    }

    func step(t T) T {
    if t.B != t.A*2 {
    log.Panic(t)
    }
    x := t.A+1
    return T{
    A: x,
    B: 2*x,
    }
    }

    func main() {
    var t = T{
    A: 1,
    B: 2,
    }
    for {
    go func() {
    t = step(t)
    }()
    }
    }
    2021-11-30 11:19:12 +08:00
    回复了 ryougifujino 创建的主题 NAS 威联通大家存储用的什么模式?
    @rwecho 我是用了两个静态盘,一个纯粹备份,按理备份盘寿命会长一些。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5059 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 18ms · UTC 05:43 · PVG 13:43 · LAX 22:43 · JFK 01:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.