Sign inMusic

![](data:image/svg+xml,)

![](data:image/svg+xml,)

斐斐のBlog

@kidultff

首页 » 计算机组成原理 » 同步异步、阻塞非阻塞、并发并行的理解

斐斐のBlog

@kidultff

  • 天津大学·智算学部
  • www.mmuaa.com
  • 主人在20小时前来过。

发送邮件

同步异步、阻塞非阻塞、并发并行的理解

发布于 2018年11月26日 / 计算机组成原理 / 0 条评论

同步与异步:

  • 同步:事情一件一件的做。执行事件A时,需要等A完成,再去做事件B。

  • 异步:事情可以一起做。执行事件A时,在等待事件A的结果的同时可以去做事件B。

  • 状态:等待事件A的结果的同时去做事件B,在做事件B时,每隔一段时间询问一次(轮询)事件A的状态如何,是否完成。

  • 通知:等待事件A的结果的同时去做事件B,并让A完成后通知一下调用者。

  • 回调:等待事件A的结果的同时去做事件B,并让A完成后执行一个函数,这个函数叫做回调函数。

阻塞与非阻塞:

  • 阻塞:调用结果返回之前,线程被挂起,处于等待状态,直到结果返回

  • 非阻塞:调用不会使进程挂起,不会阻塞当前线程

并发与并行:

  • 并发:计算机只有一个CPU,却要运行辣么多线程,不可能同时进行,所以将CPU分成若干个时间段,分给不同的线程。当CPU在忙某个线程时,其他线程被挂起

  • 并行:计算机装有多个CPU或者CPU多线程,多个线程可以同时进行,这样叫做并行

转载原创文章请注明,转载自: 斐斐のBlog » 同步异步、阻塞非阻塞、并发并行的理解

插入图片

  • 取消
  • 提交

目前还没有评论,快来抢沙发吧~

网站已运行2112 天 / Statistics / Sitemap / 蒙ICP备16004866号-1

  • 作词 : 任盈洁/王家杰
  • 作曲 : 王宗贤/下川和己
  • 制作人 : 王宗贤/下川和己
  • 配唱制作人 : 任寒冰/陈嬛
  • 录音 : 任寒冰@行人Studio
  • Chinatown, a world full of dreams
  • But opportunity isn’t as easy as it seems
  • You gotta rise up to the extreme and work like busy bee
  • Channel all your energy to fulfill your fantasies
    • City lights, what a sight crawling over the night
  • Shaped like bright fireflies and dragons with a bite
  • This is Chinatown nothing here is black or white
  • Fireworks ignite, this is a city that excites
    • Welcome to my world, Chinatown! (唐人街!)
  • 各个是高手, 又怎样? (唐人街!)
  • 要世界转我的方向 (唐人街!)
  • 火力全开吶喊着梦想 !向前闯
    • Working long nights but I’m acting brave
  • I am in charge of the road I pave
  • It’s time for me to complete this race
  • Finish out the day strong in first place
    • Here I go again in Chinatown doing my daily grind
  • Daily climb up to my apartment stairs I don’t mind
  • I just hope its a sign that if I try I will find
  • A place like this all the time
  • Everywhere, in all mankind
    • Welcome to my world, Chinatown! (唐人街!)
  • 各个是高手, 又怎样? (唐人街!)
  • 要世界转我的方向 (唐人街!)
  • 火力全开吶喊着梦想 (唐人街!) 向前闯
    • Chi-na-town!
    • If you feel lost or torn apart
  • If you need to depart for a fresh start,
  • If you need to move to a new city
  • If you need to find a new committee, ask
  • Chi-na-town!
    • Welcome to my world, Chinatown! (唐人街!)
  • 各个是高手, 又怎样? (唐人街!)
  • 要世界转我的方向 (唐人街!)
  • 火力全开吶喊着梦想 (唐人街!) 向前闯
    • Welcome to my world, Chinatown! (唐人街!)
  • 胆敢小看我的力量? (唐人街!)
  • 快放手一搏, 別傍徨 (唐人街!)
  • 越战越勇气魄震全场 (唐人街!) 向前闯