zoukankan      html  css  js  c++  java
  • advacing lnux program thread[copy]

    We’ve seen how a program can fork a child process.The child process is initially
    running its parent’s program, with its parent’s virtual memory, file descriptors, and so
    on copied.The child process can modify its memory, close file descriptors, and the like
    without affecting its parent, and vice versa.When a program creates another thread,
    though, nothing is copied.The creating and the created thread share the same memory
    space, file descriptors, and other system resources as the original. If one thread changes
    the value of a variable, for instance, the other thread subsequently will see the modi-fied

    value. Similarly, if one thread closes a file descriptor, other threads may not read

    from or write to that file descriptor. Because a process and all its threads can be exe-cuting only one program at a time, if any thread inside a process calls one of the exec
    functions, all the other threads are ended (the new program may, of course, create new
    threads).

  • 相关阅读:
    51nod1042
    51nod1009
    分库分表Mycat总结
    RocketMQ事务消息实现分析
    RocketMQ消费模式
    mysql中的隐式转换总结
    EXPLAIN用法和结果分析
    MySQL日期时间处理函数总结
    RocketMQ在windows环境下的安装
    深入分析Synchronized原理
  • 原文地址:https://www.cnblogs.com/michile/p/2890568.html
Copyright © 2011-2022 走看看