三八资料网

 找回密码
 注册

QQ登录

只需一步,快速开始

手机号码,快捷登录

三八资料网 门户首页 电脑维修 查看内容

为什么Windows/iOS操作很流畅而Linux/Android却很卡顿呢

2019-8-8 20:38| 发布者: 南召修电视| 查看: 994| 评论: 0

摘要: 先说是不是,再问为什么。我就知道有人会这么说,然而那样就成了一篇议论文了,而我只是想写一篇随笔。所以,不管事实是不是那样,反正我就是觉得Windows,MacOS,iOS都很流畅,而Linux,Android却很卡。当然了,这 ...
为什么Windows/iOS操作很流畅而Linux/Android却很卡顿呢


Windows与众不同,其弱化了进程(其实应该是线程,但是我就统一写成进程吧,为了照顾不懂Windows内核原理的读者)的初始基优先级

,而强化了动态优先级

,更重要的是,动态优先级的值并非来自预测,而是来自于 事件 ,事件本身的紧急性反馈到了动态优先级的值,而事件本身的重要性则反馈到了时间片:



可以看出,Windows对于不同的事件定义了不同的优先级提升的具体数值, 将动态优先级的值和具体的事件做了精确的关联。

这些数值的定义上,甚至精细而贴心,详细的数值参见ntddk.h:

//
// Priority increment definitions.  The comment for each definition gives
// the names of the system services that use the definition when satisfying
// a wait.
//

//
// Priority increment used when satisfying a wait on an executive event
// (NtPulseEvent and NtSetEvent)
//

#define EVENT_INCREMENT                 1

//
// Priority increment when no I/O has been done.  This is used by device
// and file system drivers when completing an IRP (IoCompleteRequest).
//

#define IO_NO_INCREMENT                 0


//
// Priority increment for completing CD-ROM I/O.  This is used by CD-ROM device
// and file system drivers when completing an IRP (IoCompleteRequest)
//

#define IO_CD_ROM_INCREMENT             1

//
// Priority increment for completing disk I/O.  This is used by disk device
// and file system drivers when completing an IRP (IoCompleteRequest)
//

#define IO_DISK_INCREMENT               1



//
// Priority increment for completing keyboard I/O.  This is used by keyboard
// device drivers when completing an IRP (IoCompleteRequest)
//

#define IO_KEYBOARD_INCREMENT           6


//
// Priority increment for completing mailslot I/O.  This is used by the mail-
// slot file system driver when completing an IRP (IoCompleteRequest).
//

#define IO_MAILSLOT_INCREMENT           2


//
// Priority increment for completing mouse I/O.  This is used by mouse device
// drivers when completing an IRP (IoCompleteRequest)
//

#define IO_MOUSE_INCREMENT              6


//
// Priority increment for completing named pipe I/O.  This is used by the
// named pipe file system driver when completing an IRP (IoCompleteRequest).
//

#define IO_NAMED_PIPE_INCREMENT         2

//
// Priority increment for completing network I/O.  This is used by network
// device and network file system drivers when completing an IRP
// (IoCompleteRequest).
//
// 网卡IO之所以优先级提升并不是很多,是因为首先网卡是有队列缓存的,而大多数的报文都是burst而来的,队列缓存可以平滑掉首包延迟,其次,由于光速极限,相比于网络延迟,主机调度延迟真的可以忽略不计。
#define IO_NETWORK_INCREMENT            2


//
// Priority increment for completing parallel I/O.  This is used by parallel
// device drivers when completing an IRP (IoCompleteRequest)
//

#define IO_PARALLEL_INCREMENT           1

//
// Priority increment for completing serial I/O.  This is used by serial device
// drivers when completing an IRP (IoCompleteRequest)
//

#define IO_SERIAL_INCREMENT             2

//
// Priority increment for completing sound I/O.  This is used by sound device
// drivers when completing an IRP (IoCompleteRequest)
//

#define IO_SOUND_INCREMENT              8

//
// Priority increment for completing video I/O.  This is used by video device
// drivers when completing an IRP (IoCompleteRequest)
//

#define IO_VIDEO_INCREMENT              1

//
// Priority increment used when satisfying a wait on an executive semaphore
// (NtReleaseSemaphore)
//

#define SEMAPHORE_INCREMENT             1
--------------------- 



路过

雷人

握手

鲜花

鸡蛋

最新评论

论坛最新帖
  • 一种绕制微型变压器的方法
  • 自制修电磁炉的好工具机内假负载
  • 十个家电维修技巧一定要看
  • 真诚求助!!!
  • 电脑开机进不了系统
  • 小米65寸电视背光黑屏故障的维修
  • 资料分享
  • 三菱变频器A540电路图(包含电源,驱动 保
  • 户户通电源板应急修复的方法
  • 洗衣机上盖门轴断裂的修复,修制冷有焊炬的
门户最新文章
  • 三相电源断零线,为什么会接二连三烧坏电器
  • 又是推架子,工人被活活电死,直到化成灰烬,
  • 故障修的快是我的本事,凭什么不给钱?
  • 配电房是如何送电的?送电方式是什么?看完
  • 电工接的电缆头,能找到5个错误以上的,都
  • 防雷接地地焊怎么做?单面焊还是双面焊
  • 电线都燃了为什么空开不跳闸?80%的电工不
  • 配电箱14大禁忌,千万要注意!
  • 惨烈!配电室爆炸,3人瞬间变成渣!
  • 你知道避雷器和浪涌保护器的区别吗?

QQ|门户地图|手机版|小黑屋|家电维修论坛 ( 蜀ICP备14030498号 )

GMT+8, 2024-5-6 16:38

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部