青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

posts - 297,  comments - 15,  trackbacks - 0

A context switch (also sometimes referred to as a process switch or a task switch ) is the switching of the CPU (central processing unit) from one process or thread to another.

A process (also sometimes referred to as a task ) is an executing (i.e., running) instance of a program. In Linux, threads are lightweight processes that can run in parallel and share an address space (i.e., a range of memory locations) and other resources with their parent processes (i.e., the processes that created them).

A context is the contents of a CPU's registers and program counter at any point in time. A register is a small amount of very fast memory inside of a CPU (as opposed to the slower RAM main memory outside of the CPU) that is used to speed the execution of computer programs by providing quick access to commonly used values, generally those in the midst of a calculation. A program counter is a specialized register that indicates the position of the CPU in its instruction sequence and which holds either the address of the instruction being executed or the address of the next instruction to be executed, depending on the specific system.

Context switching can be described in slightly more detail as the kernel operating system) performing the following activities with regard to processes (including threads) on the CPU: (1) suspending the progression of one process and storing the CPU's state (i.e., the context) for that process somewhere in memory, (2) retrieving the context of the next process from memory and restoring it in the CPU's registers and (3) returning to the location indicated by the program counter (i.e., returning to the line of code at which the process was interrupted) in order to resume the process. (i.e., the core of the

A context switch is sometimes described as the kernel suspending execution of one process on the CPU and resuming execution of some other process that had previously been suspended. Although this wording can help clarify the concept, it can be confusing in itself because a process is , by definition, an executing instance of a program. Thus the wording suspending progression of a process might be preferable.

Context Switches and Mode Switches

Context switches can occur only in kernel mode . Kernel mode is a privileged mode of the CPU in which only the kernel runs and which provides access to all memory locations and all other system resources. Other programs, including applications, initially operate in user mode , but they can run portions of the kernel code via system calls . A system call is a request in a Unix-like operating system by an active process (i.e., a process currently progressing in the CPU) for a service performed by the kernel, such as input/output (I/O) or process creation (i.e., creation of a new process). I/O can be defined as any movement of information to or from the combination of the CPU and main memory (i.e. RAM), that is, communication between this combination and the computer's users (e.g., via the keyboard or mouse), its storage devices (e.g., disk or tape drives), or other computers.

The existence of these two modes in Unix-like operating systems means that a similar, but simpler, operation is necessary when a system call causes the CPU to shift to kernel mode. This is referred to as a mode switch rather than a context switch, because it does not change the current process.

Context switching is an essential feature of multitasking operating systems. A multitasking operating system is one in which multiple processes execute on a single CPU seemingly simultaneously and without interfering with each other. This illusion of concurrency is achieved by means of context switches that are occurring in rapid succession (tens or hundreds of times per second). These context switches occur as a result of processes voluntarily relinquishing their time in the CPU or as a result of the scheduler making the switch when a process has used up its CPU time slice .

A context switch can also occur as a result of a hardware interrupt , which is a signal from a hardware device (such as a keyboard, mouse, modem or system clock) to the kernel that an event (e.g., a key press, mouse movement or arrival of data from a network connection) has occurred.

Intel 80386 and higher CPUs contain hardware support for context switches. However, most modern operating systems perform software context switching , which can be used on any CPU, rather than hardware context switching in an attempt to obtain improved performance. Software context switching was first implemented in Linux for Intel-compatible processors with the 2.4 kernel.

One major advantage claimed for software context switching is that, whereas the hardware mechanism saves almost all of the CPU state, software can be more selective and save only that portion that actually needs to be saved and reloaded. However, there is some question as to how important this really is in increasing the efficiency of context switching. Its advocates also claim that software context switching allows for the possibility of improving the switching code, thereby further enhancing efficiency, and that it permits better control over the validity of the data that is being loaded.

The Cost of Context Switching

Context switching is generally computationally intensive. That is, it requires considerable processor time, which can be on the order of nanoseconds for each of the tens or hundreds of switches per second. Thus, context switching represents a substantial cost to the system in terms of CPU time and can, in fact, be the most costly operation on an operating system.

Consequently, a major focus in the design of operating systems has been to avoid unnecessary context switching to the extent possible. However, this has not been easy to accomplish in practice. In fact, although the cost of context switching has been declining when measured in terms of the absolute amount of CPU time consumed, this appears to be due mainly to increases in CPU clock speeds rather than to improvements in the efficiency of context switching itself.

One of the many advantages claimed for Linux as compared with other operating systems, including some other Unix-like systems, is its extremely low cost of context switching and mode switching.


from:
http://blog.csdn.net/wave_1102/archive/2007/09/04/1771745.aspx

posted on 2010-02-25 23:09 chatler 閱讀(396) 評論(0)  編輯 收藏 引用 所屬分類: OS
<2009年5月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

常用鏈接

留言簿(10)

隨筆分類(307)

隨筆檔案(297)

algorithm

Books_Free_Online

C++

database

Linux

Linux shell

linux socket

misce

  • cloudward
  • 感覺這個博客還是不錯,雖然做的東西和我不大相關,覺得看看還是有好處的

network

OSS

  • Google Android
  • Android is a software stack for mobile devices that includes an operating system, middleware and key applications. This early look at the Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.
  • os161 file list

overall

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲人成绝费网站色www| 亚洲黄色在线| 久久久久久久一区二区三区| 国产精品视频午夜| 亚洲精品国产品国语在线app| 蜜臀av一级做a爰片久久| 久久亚洲国产成人| 亚洲国产精品专区久久| 毛片一区二区| 黄色日韩网站视频| 美日韩精品视频免费看| 午夜久久久久| 欧美在线亚洲综合一区| 久久综合五月| 欧美天天视频| 国产一区二区黄| 亚洲韩国青草视频| 亚洲午夜在线| 久久亚洲风情| 亚洲视频视频在线| 久久乐国产精品| 欧美亚洲成人免费| 亚洲第一中文字幕在线观看| 亚洲视频一区二区| 免费国产自线拍一欧美视频| 日韩天堂av| 久久久久久婷| 国产精品一区免费在线观看| 最新中文字幕一区二区三区| 午夜精品美女自拍福到在线| 欧美插天视频在线播放| 亚洲一区www| 免费亚洲电影| 国产在线拍揄自揄视频不卡99 | 亚洲精品一区二区三区不| 欧美国产欧美亚州国产日韩mv天天看完整| 亚洲国产精品一区二区第一页| 一区二区三区免费在线观看| 久久米奇亚洲| 国产午夜精品理论片a级大结局| 亚洲伦伦在线| 欧美电影美腿模特1979在线看| 亚洲曰本av电影| 欧美日韩一区二区在线观看| 亚洲福利视频三区| 久久久噜噜噜久久久| 亚洲视频在线观看视频| 欧美日韩国语| 一区二区三区**美女毛片 | 亚洲影院高清在线| 欧美一区国产二区| 久久久精品日韩| 中文精品视频| 欧美日韩国产一区二区三区| 国产乱码精品1区2区3区| 国产精品视频福利| 一区二区精品在线| 免费久久精品视频| 亚洲图片你懂的| 亚洲小说区图片区| 欧美日韩精品不卡| 一本色道久久综合亚洲精品不| 久久精品国亚洲| 午夜在线视频观看日韩17c| 国产精品国产三级国产aⅴ入口| 亚洲欧洲精品天堂一级| 欧美高清视频www夜色资源网| 久久久久国产精品一区二区| 国内久久精品视频| 久久伊伊香蕉| 免费观看久久久4p| 亚洲精品四区| 日韩一区二区精品视频| 欧美午夜精品久久久久久浪潮| 国产精品99久久久久久有的能看| 日韩一本二本av| 欧美性大战久久久久| 亚洲欧美一区二区三区极速播放| 亚洲一区二区少妇| 国内成人精品视频| 欧美激情国产日韩精品一区18| 欧美顶级少妇做爰| 亚洲一级黄色片| 欧美亚洲尤物久久| 亚洲国产婷婷香蕉久久久久久99 | 国产精品夜夜夜一区二区三区尤| 亚洲一级网站| 亚洲综合日本| 欧美日韩卡一卡二| 欧美尤物一区| 免费影视亚洲| 午夜亚洲影视| 免费中文日韩| 亚洲一区二区伦理| 久久精品国产亚洲a| 在线观看日韩www视频免费 | 亚洲欧美在线免费观看| 在线高清一区| 在线视频你懂得一区| 久久精品91久久久久久再现| 免费h精品视频在线播放| 欧美一二三视频| 国产精品欧美激情| 欧美v国产在线一区二区三区| 欧美激情一区二区三区不卡| 午夜宅男欧美| 一区二区三欧美| 亚洲免费成人av| 在线观看不卡| 国内精品伊人久久久久av影院 | 欧美日韩在线电影| 亚洲人成人99网站| 久久久亚洲人| 午夜影院日韩| 先锋影音国产一区| 午夜亚洲福利| 午夜精品久久久久久久久久久久| 亚洲国产日韩欧美在线99| 国产精品黄色在线观看| 欧美日韩综合精品| 国产精品美女一区二区| 欧美私人啪啪vps| 国产伦一区二区三区色一情| 国产精品成人在线| 欧美视频观看一区| 国产免费成人在线视频| 国产精品久久福利| 一区在线免费观看| 99国产精品久久久| 亚洲免费影视| 亚洲综合国产激情另类一区| 亚洲欧美在线高清| 欧美电影免费观看高清完整版| 亚洲六月丁香色婷婷综合久久| 亚洲永久精品国产| 欧美亚洲网站| 一本一本久久| 久久综合精品国产一区二区三区| 欧美日韩一区二区三区四区五区| 国产视频一区在线| 性亚洲最疯狂xxxx高清| 亚洲国产精品久久久久| 在线观看亚洲精品| 欧美激情久久久久| 国产目拍亚洲精品99久久精品| 黄色av日韩| 欧美一区二区三区在线视频| 欧美福利一区二区| 久久国产精品久久久久久| 国产精品视频一二三| 麻豆精品视频在线| 亚洲婷婷在线| 欧美日本簧片| 亚洲久久一区二区| 亚洲精品自在在线观看| 午夜欧美大片免费观看| 欧美中文字幕在线播放| 久久免费99精品久久久久久| 亚洲一区视频| 国内久久婷婷综合| 欧美成人a∨高清免费观看| 久久美女艺术照精彩视频福利播放| 国产亚洲精品bt天堂精选| 久久久av毛片精品| 亚洲黄网站黄| 亚洲综合日韩| 伊人久久大香线蕉综合热线| 亚洲国产欧美一区二区三区久久| 欧美高清视频www夜色资源网| 一本色道**综合亚洲精品蜜桃冫 | 久久xxxx| 久久av一区二区三区漫画| 欧美一级在线播放| 亚洲一区二区在线观看视频| 久久精品亚洲精品| 亚洲一区二区黄色| 欧美成年视频| 久久久久九九视频| 国产精品看片你懂得| 亚洲成在线观看| 亚洲国产精品成人精品| 亚洲男人的天堂在线| 亚洲香蕉网站| 欧美国产专区| 亚洲国产经典视频| 韩国三级在线一区| 久久综合999| 免费亚洲网站| 91久久极品少妇xxxxⅹ软件| 久久人人97超碰精品888| 免费一级欧美片在线播放| 国产综合精品| 免费不卡中文字幕视频| 欧美大片免费观看在线观看网站推荐| 激情婷婷久久| 欧美国产欧美亚州国产日韩mv天天看完整| 欧美电影在线| 一本久久综合亚洲鲁鲁五月天| 欧美日韩成人| 久久精品在这里|