zoukankan      html  css  js  c++  java
  • go 笔记

    ipc{
    1.通信{
    数据传送{
    pipe 传字节流
    ,MessageQueue 传结构化消息对象
    }
    共享内存(最快)
    }
    2.信号 Signal(唯一异步的IPC)
    3.同步 semaphore (最重要)
    }
    exec 把一个新程序加载到自己内存中,替换数据段,代码段,堆,stack

    父进程先结束,他子进程会被内核启动进程收养
    所以系统调用都是原子操作

    pid := os.Getpid()
    ppid := os.Getppid()

    sync/atomic
    os/exec

    cmd0 := exec.Command("echo","-n","my fist command")
    stdout0 ,err := cmd0.StdoutPipe()
    output0 := make([]byte,30)
    n,err :=stdio0.Read(output0)
    if err != nil{
    fmt.Printf("error: %s ",err)
    }
    fmt.Printf("%s ",output0[:n])
    命名管道
    reader ,writer,err := os.Pipe()
    reader,writer := io.Piple() //内存管道
    信号: os/signal
    没有32,33
    1-31 标准信号(不可靠信号); 34-64 实时信号(可靠信号)
    runtime/debug.SetMaxThreads
    runtime.GOMAXPROCS

  • 相关阅读:
    __file__ 作用以及模块导入方法
    random 模块
    time 模块
    module模块和包
    装饰器
    python闭包
    filter map reduce函数的使用
    python文件处理
    python内置函数使用
    函数
  • 原文地址:https://www.cnblogs.com/anjunact/p/6747851.html
Copyright © 2011-2022 走看看