How does golang share or read other processes shared memory? I've checked some information, but did not find relevant information. Can anyone give me an example?
how to use share memory with Golang?
7.7k views Asked by xichen At
2
There are 2 answers
0
On
golang: It is a programming language, so it does not relate to the shared memory that the operating system level things. Not to say golang not use shared memory, but this is not it need to be defined. Posix use shared memory, you can use syscall package, which contains a lot of system calls, as long as the reference c system call interface on the line.
In the world of go, don't communicate by sharing memory; share memory by communicating. If you really want to have a try, you can call the C API with cgo:
wrapper.c:
reader.go
writter.go:
run the writer, then the reader by
go run filename
. The code is from here