CPU times 与 Wall time

CPU times

进程时间也称 CPU 时间,用来度量进程使用的中央处理器资源。
进程时间以时钟计算,分为用户时间(user),系统时间(sys),总时间(total):用户时间和系统时间是特定进程使用的 CPU 时间,总时间等于用户时间与系统时间之和。

  • user:进程执行用户态代码耗费的 CPU 时间
    进程执行用户态代码耗费的 CPU 时间。仅统计该进程执行时实际使用的 CPU 时间,而不计入其他进程使用的时间片和本进程阻塞的时间
  • sys:进程在内核态运行所耗费的 CPU 时间
    该进程在内核态运行所耗费的 CPU 时间,即内核执行系统调用所使用的 CPU 时间
  • total:进程(包括线程和子进程)所使用的实际 CPU 时间
    CPU 执行用户进程操作和内核系统调用所耗时间的总和(total = user + sys),即该进程(包括线程和子进程)所使用的实际 CPU 时间。若程序循环遍历数组,则会增加用户时间;若程序执行 exec 或 fork 等系统调用,则会增加系统时间

Wall time

  • wall time:进程起止所耗墙上时钟时间,也叫 real time
    进程从开始执行到完成,所经历的墙上时钟时间(实际时间),包括其他进程使用的时间片(time slice)和本进程耗费在阻塞(如等待I/O操作完成)上的时间。

在多核处理器计算机上,若进程含有多个线程或通过 fork 调用创建子进程,则墙上时钟时间可能小于 CPU 总时间,因为不同线程或进程可并行执行,但其时间会计入主进程的 CPU 总时间;若程序在某段时间处于等待状态而并未执行,则墙上时钟时间可能大于 CPU 总时间

  • wall time < total,进程为计算密集型(CPU bound),我们可以利用多核处理器的并行执行优势
  • wall time ≈ total,进程为计算密集型,未并行执行
  • wall time > total,进程为I/O密集型?(I/O bound),多核并行执行优势并不明

线程与进程

  • 线程和进程通常都有一个 主线/进程 负责分配任务和其他 子线/进程 负责执行任务
  • 多进程的优点在于一个子进程挂了,不会影响其他进程(主进程挂了就全挂了),但是其创建的代价较大,Apache 采用的就是多进程机制
  • 而多线程一般要比多进程执行效率要高,但是由于共享内存一旦子线程挂了,就全挂了,ISS 采用的就是多线程机制

计算密集型 IO密集型

  • 计算密集型任务主要消耗大量 CPU 资源,不停进行计算。由于依靠 CPU 性能,一直占用 CPU 进行计算,也就说一般情况下能够采用多任务的数量等于 CPU 核心数。该种任务 C 语言比较胜任
  • IO 密集型任务(磁盘读取,web 服务)主要需要 IO 的读取,利用 CPU 的效率较低,大量时间花费在 IO 上。由于现在有异步 IO 技术,也就是说一个任务在 IO 等待时间时可以暂停运行,让 CPU 的空闲时间用来运行其他任务,等到 IO 读取完毕后再继续执行。从而实现单核 CPU 上运行单进程却能实现多任务的并发。该种任务 Python(执行效率相对较低)比较适合
  • 对于优化,应该通过开发的服务或是业务以在项目之初就根据需求来对资源进行预先估算,大致属于 IO 密集型还是计算密集型的业务,并进行项目前期的资源预算等工作的开展,也包括前期的设计和后期的优化

347 thoughts on “CPU times 与 Wall time”

  1. Pingback: Reba Fleurantin
  2. Pingback: Beverly Bultron
  3. Pingback: Cory Chase MILFCity
  4. Pingback: Madelyn Monroe MILF
  5. Pingback: Assignment Provider
  6. Pingback: valentine pillow
  7. Pingback: Click Here
  8. Pingback: Click Here
  9. Pingback: Click Here
  10. Pingback: Click Here
  11. Pingback: Click Here
  12. Pingback: Click Here
  13. Pingback: Click Here
  14. Pingback: Click Here
  15. Pingback: Click Here
  16. Pingback: Click Here
  17. Pingback: Click Here
  18. Pingback: Click Here
  19. Pingback: Click Here
  20. Pingback: Click Here
  21. Pingback: Click Here
  22. Pingback: Click Here
  23. Pingback: Click Here
  24. Pingback: Click Here
  25. Pingback: Click Here
  26. Pingback: Click Here
  27. Pingback: Click Here
  28. Pingback: Click Here
  29. Pingback: robots remote control
  30. Pingback: no code robotics
  31. Pingback: Click Here
  32. Pingback: spaceros
  33. Pingback: Click Here
  34. Pingback: Reputation Defenders
  35. Pingback: Reputation Defenders
  36. Pingback: Click Here
  37. Pingback: Click Here
  38. Pingback: Click Here
  39. Pingback: Click Here
  40. Pingback: Click Here
  41. Pingback: Click Here
  42. Pingback: Click Here
  43. Pingback: Click Here
  44. Pingback: Click Here
  45. Pingback: Click Here
  46. Pingback: Click Here
  47. Pingback: Click Here
  48. Pingback: Click Here
  49. Pingback: Click Here
  50. Pingback: Click Here
  51. Pingback: Click Here
  52. Pingback: Click Here
  53. Pingback: Click Here
  54. Pingback: Click Here
  55. Pingback: Click Here
  56. Pingback: Click Here
  57. Pingback: Click Here
  58. Pingback: Click Here
  59. Pingback: 바카라게임
  60. Pingback: grand rapids dentist
  61. Pingback: Click Here
  62. Pingback: Click Here
  63. Pingback: Click Here
  64. Pingback: Click Here
  65. Pingback: Click Here
  66. Pingback: Click Here
  67. Pingback: Click Here
  68. Pingback: Click Here
  69. Pingback: Click Here
  70. Pingback: Click Here
  71. Pingback: Click Here
  72. Pingback: Click Here
  73. Pingback: Click Here
  74. Pingback: Click Here
  75. Pingback: Click Here
  76. Pingback: Click Here
  77. Pingback: Click Here
  78. Pingback: Click Here
  79. Pingback: Click Here
  80. Pingback: Click Here
  81. Pingback: Click Here
  82. Pingback: domain-names
  83. Pingback: website for startups
  84. Pingback: Google reviews
  85. Pingback: Aussie camgirls
  86. Pingback: reputation defenders
  87. Pingback: 2023 Books
  88. Pingback: birth records
  89. Pingback: obituaries
  90. Pingback: best university egypt
  91. Pingback: collaborations fue
  92. Pingback: Academic publications
  93. Pingback: Community engagement
  94. Pingback: Prof. Dr. Adel Sakr
  95. Pingback: Local
  96. Pingback: Economic Development
  97. Pingback: engineering training
  98. Pingback: Student Success
  99. Pingback: Grading System
  100. Pingback: fue contact
  101. Pingback: Prof. Hesham Arafat
  102. Pingback: public opinion
  103. Pingback: MBA in FUE
  104. Pingback: Biochemistry
  105. Pingback: Marketing program
  106. Pingback: Public administration
  107. Pingback: Academic departments
  108. Pingback: Dental Education
  109. Pingback: علم الاسنان
  110. Pingback: Computer Maintenance
  111. Pingback: human-development
  112. Pingback: Maillot de football
  113. Pingback: Maillot de football
  114. Pingback: Maillot de football
  115. Pingback: Maillot de football
  116. Pingback: Maillot de football
  117. Pingback: Maillot de football
  118. Pingback: Maillot de football
  119. Pingback: SEOSolutionVIP Fiverr
  120. Pingback: SEOSolutionVIP Fiverr
  121. Pingback: SEOSolutionVIP Fiverr
  122. Pingback: SEOSolutionVIP Fiverr
  123. Pingback: SEOSolutionVIP Fiverr
  124. Pingback: ninja warrior enfant
  125. Pingback: rotary torso
  126. Pingback: Fiverr Earn
  127. Pingback: Fiverr Earn
  128. Pingback: fiverrearn.com
  129. Pingback: fiverrearn.com
  130. Pingback: fiverrearn.com
  131. Pingback: Advance-Esthetic LLC
  132. Pingback: fiverrearn.com
  133. Pingback: fiverrearn.com
  134. Pingback: flatbed broker
  135. Pingback: 3pl Broker
  136. Pingback: liv pure
  137. Pingback: fiverrearn.com
  138. Pingback: fiverrearn.com
  139. Pingback: fiverrearn.com
  140. Pingback: dog breed
  141. Pingback: aussiechon
  142. Pingback: designer kennel club
  143. Pingback: Adsense approval tips
  144. Pingback: Piano Removals
  145. Pingback: boat rental cancun
  146. Pingback: bitcoin
  147. Pingback: micro frenchie
  148. Pingback: clima sarasota
  149. Pingback: Children jewellery
  150. Pingback: smartphones
  151. Pingback: FiverrEarn
  152. Pingback: lilac french bulldog
  153. Pingback: top university Egypt
  154. Pingback: Warranty
  155. Pingback: FUE
  156. Pingback: FUE
  157. Pingback: FUE
  158. Pingback: FUE
  159. Pingback: FUE
  160. Pingback: Furniture handling
  161. Pingback: Safe moving
  162. Pingback: Moving company
  163. Pingback: FiverrEarn
  164. Pingback: Media
  165. Pingback: FiverrEarn
  166. Pingback: FiverrEarn
  167. Pingback: partners
  168. Pingback: Development Studies
  169. Pingback: red boost
  170. Pingback: Tips
  171. Pingback: FiverrEarn
  172. Pingback: FiverrEarn
  173. Pingback: FiverrEarn
  174. Pingback: live sex cams
  175. Pingback: live sex cams
  176. Pingback: live sex cams
  177. Pingback: FiverrEarn
  178. Pingback: FiverrEarn
  179. Pingback: FiverrEarn
  180. Pingback: FiverrEarn
  181. Pingback: FiverrEarn
  182. Pingback: FiverrEarn
  183. Pingback: FiverrEarn
  184. Pingback: FiverrEarn
  185. Pingback: FiverrEarn
  186. Pingback: FiverrEarn
  187. Pingback: FiverrEarn
  188. Pingback: FiverrEarn
  189. Pingback: FiverrEarn
  190. Pingback: Paneer
  191. Pingback: wix login
  192. Pingback: web design
  193. Pingback: web design
  194. Pingback: Queen Arwa University
  195. Pingback: Scientific Research
  196. Pingback: Kampus Islam Terbaik
  197. Pingback: FiverrEarn
  198. Pingback: FiverrEarn
  199. Pingback: FiverrEarn
  200. Pingback: prodentim scam
  201. Pingback: cheap sex cams
  202. Pingback: fullersears.com
  203. Pingback: french bulldog buy
  204. Pingback: live sex cams
  205. Pingback: live sex cams
  206. Pingback: live sex cams
  207. Pingback: Freeze dried water
  208. Pingback: rare breed-trigger
  209. Pingback: OnOverseas.Com
  210. Pingback: 늑대닷컴
  211. Pingback: Slot Fantasi
  212. Pingback: allgame
  213. Pingback: 918kiss
  214. Pingback: หวย24
  215. Pingback: Hair care
  216. Pingback: pg slot
  217. Pingback: leak detection london
  218. Pingback: la bonne paye règle
  219. Pingback: cybersécurité
  220. Pingback: menang slot
  221. Pingback: Dating Classes
  222. Pingback: upstate hotels
  223. Pingback: dietary supplements
  224. Pingback: megagame
  225. Pingback: 300 wsm ammo
  226. Pingback: duromine
  227. Pingback: sicarios madrid
  228. Pingback: SaaS Law Firm
  229. Pingback: itsMasum.Com
  230. Pingback: FÜHRERSCHEIN KAUFEN
  231. Pingback: Nangs delivery 24/7
  232. Pingback: nangs Sydney
  233. Pingback: read more
  234. Pingback: itsmasum.com
  235. Pingback: omegle kids
  236. Pingback: chatave
  237. Pingback: boy chat
  238. Pingback: itsmasum.com
  239. Pingback: joker gaming
  240. Pingback: jakarta jobs
  241. Pingback: oslo jobs
  242. Pingback: toronto jobs
  243. Pingback: warsaw jobs
  244. Pingback: webcam girls
  245. Pingback: free cam sex
  246. Pingback: Kampus Ternama
  247. Pingback: 918kiss
  248. Pingback: pg slot
  249. Pingback: 918kiss
  250. Pingback: ItMe.Xyz
  251. Pingback: itme.xyz
  252. Pingback: ItMe.Xyz
  253. Pingback: ItMe.Xyz
  254. Pingback: Bulk URL Shortener
  255. Pingback: ItMe.Xyz
  256. Pingback: ItMe.Xyz

发表评论