`
sillycat
  • 浏览: 2551605 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

High Performance(1)Events Threads Actors

 
阅读更多

High Performance(1)Events Threads Actors

Stream can be file, socket, pipe. I/O, read and write.
Blocking IO
        One thread can only handle one IO, ask A and B to read and write through a buffer.
        If we plan to deal with more IO in the same time, we need multiple threads or multiple processes.
             RPC Model
               Process per Connection, apache 
          
             TPC Model
               Thread per Connection 

NON-Blocking IO
        Put all the IO in the chain, ask them one by one.
        while true {
               for i in stream[];{
                    if i has data
                    read until unavailable
               }
        }

        select and poll (proxy)
        If there is no IO event, thread/process sleep, once event happen, wake up the all streams and ask them one by one.
          while true {
               select(streams[])
               for i in streams[]{
                    if i has data
                    read until unavailable
               }
          }

                    select Model


                    poll Model

          event poll (proxy)
                It will tell us which events are having IO, we only need to wake up the active streams and ask them one by one.
                while true{
                    active_stream[] = epoll_wait(epollfd)
                    for i in active_stream[]{
                         read or write till unavailable
                    }
               }
                    Epoll Model

Actor Model
               Data + Behavior + Message
               Thread can not call behavior in the Model, it will only send the message to the Model. (Disruptor, LMAX)
          

References:
http://www.zhihu.com/question/20122137

http://sillycat.iteye.com/blog/1767866
http://sillycat.iteye.com/blog/2099267

http://www.jdon.com/45728

分享到:
评论

相关推荐

    Actors That Unify Threads and Events.pdf

    1. **线程编程**:传统上,线程是处理并发的一种方式,但在多核环境下容易出现资源竞争和死锁等问题。 2. **事件驱动编程**:这种方式虽然可以避免资源竞争问题,但会增加控制流的复杂度,使得程序难以理解和调试。 ...

    Julia High performance.pdf

    ### Julia High Performance: Key Knowledge Points #### Introduction to Julia Language - **Origin and Development**: Julia was created by a team of four computer scientists who sought to develop a ...

    A Review of Lightweight Thread Approaches for High Performance

    随着计算技术的飞速发展,高性能计算(High Performance Computing, HPC)领域正面临着前所未有的挑战。未来的exascale系统将提供大规模的并发硬件,使得单节点内的并行性成为不可避免的趋势。自2001年以来,顶级500...

    jboss-threads-3.1.0.Final-API文档-中文版.zip

    赠送jar包:jboss-threads-3.1.0.Final.jar; 赠送原API文档:jboss-threads-3.1.0.Final-javadoc.jar; 赠送源代码:jboss-threads-3.1.0.Final-sources.jar; 赠送Maven依赖信息文件:jboss-threads-3.1.0.Final....

    C语言Threads等程序(Use P-threads)

    P-threads中的信号量分为二进制信号量(`pthread_semaphore_t`)和计数信号量,前者只能在0和1之间变化,后者可以有任意非负整数值。 7. **线程控制块(Thread Control Block, TCB)**: 每个线程都有一个TCB,存储...

    C_threads_events_delegate_instance.rar_delegate_threads_线程委托

    在C#编程中,线程(threads)、事件(events)和委托(delegates)是构建多线程应用程序和实现异步编程的关键概念。本压缩包文件"ydaima"可能包含一些示例代码或教程,旨在帮助理解这些概念在实际应用中的工作方式。...

    MySQL 5.6中备份及还原performance_schema配置

    MySQL提供了一些内置的视图,如`events_statements_summary_by_digest`用于查看SQL语句的执行统计,`threads`用于查看当前活动的线程信息,等等。理解这些视图并学会分析它们提供的数据,是优化数据库性能的关键。 ...

    Working with Ruby Threads

    《Working with Ruby Threads》这本书深入探讨了Ruby语言中的线程机制,对于希望利用Ruby进行高效并发编程的开发者来说是一本不可多得的资源。 #### Ruby为什么值得关注? Ruby作为一种动态类型、解释型语言,在...

    jboss-threads-3.1.0.Final-API文档-中英对照版.zip

    赠送jar包:jboss-threads-3.1.0.Final.jar; 赠送原API文档:jboss-threads-3.1.0.Final-javadoc.jar; 赠送源代码:jboss-threads-3.1.0.Final-sources.jar; 赠送Maven依赖信息文件:jboss-threads-3.1.0.Final....

    螺纹查询软件threads汉化版

    螺纹查询软件threads汉化版 螺纹查询软件threads汉化版

    Programming with POSIX Threads

    Programming with POSIX Threads

    Java.Threads.and.the.Concurrency.Utilities.1484216997

    Chapter 1: Threads and Runnables Chapter 2: Synchronization Chapter 3: Waiting and Notification Chapter 4: Additional Thread Capabilities Part II: Concurrency Utilities Chapter 5: Concurrency ...

    POSIX Threads Programming

    For UNIX systems, a standardized C language threads programming interface has been specified by the IEEE POSIX 1003.1c standard. Implementations that adhere to this standard are referred to as POSIX ...

    show-busy-java-threads.sh文件

    1. 找到Java进程ID:可以使用`jps`命令列出所有Java进程,然后找到目标应用的进程ID。 2. 运行脚本:执行`./show-busy-java-threads.sh <pid>`,将`<pid>`替换为目标进程ID。 3. 分析结果:查看脚本输出的线程堆栈...

    linux实用脚本show-busy-java-threads

    1. **show-busy-java-threads** 这个脚本的主要功能是显示正在忙碌的Java线程,帮助我们了解Java应用的运行状况。在多线程环境中,如果某个线程长时间处于忙碌状态,可能会导致性能问题或者阻塞其他线程。通过运行...

    Programming with POSIX Threads 英文版+ 中文版+源码

    1. **线程基础**:首先,书中介绍了线程的概念,包括线程与进程的区别,以及为什么要在应用程序中使用线程。它阐述了线程的创建、销毁和同步的基本API,如pthread_create、pthread_join、pthread_exit等。 2. **...

    Node.js-worker-threads-pool轻松管理Node.js工作线程池

    为了解决这个问题,Node.js 10.5.0版本引入了worker_threads模块,允许开发者利用多核处理器的优势,通过工作线程(Worker Threads)进行并行计算。 "worker-threads-pool" 是一个专门为Node.js设计的库,它的目的...

Global site tag (gtag.js) - Google Analytics