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

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
<2012年6月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

常用鏈接

留言簿(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>
            亚洲一区二区成人| 亚洲麻豆国产自偷在线| 欧美成人免费va影院高清| 久久99在线观看| 久久久久高清| 欧美成人免费观看| 欧美色精品天天在线观看视频| 欧美日本中文字幕| 国产美女诱惑一区二区| 极品尤物一区二区三区| 亚洲人午夜精品免费| 在线一区二区三区做爰视频网站| 香蕉国产精品偷在线观看不卡| 欧美在线视频a| 欧美a一区二区| 一本色道婷婷久久欧美| 欧美在线视频观看| 欧美日韩中文字幕在线视频| 国产亚洲人成网站在线观看| 日韩一级成人av| 久久久免费精品| 亚洲成色最大综合在线| 亚洲精选视频免费看| 欧美在线观看www| 欧美日韩一区二区三区在线视频 | 欧美成年人视频| 亚洲国产高清自拍| 新67194成人永久网站| 欧美大色视频| 国产一区二区在线观看免费播放| 亚洲人成网站影音先锋播放| 久久爱91午夜羞羞| 亚洲精品乱码| 久久天天躁狠狠躁夜夜爽蜜月| 欧美日韩国产探花| 亚洲高清激情| 久久综合网色—综合色88| 日韩一级成人av| 欧美va亚洲va国产综合| 亚洲欧美日韩国产综合在线| 麻豆av一区二区三区| 欧美天天影院| 亚洲第一视频| 久久久欧美精品| 亚洲一区二区免费| 欧美另类视频在线| 亚洲国产成人av| 久久久九九九九| 这里只有精品在线播放| 欧美大片一区二区| 亚洲欧洲一二三| 欧美大片免费看| 久久久一区二区| 尤物九九久久国产精品的特点| 欧美在线3区| 亚洲在线网站| 国产精品久久网站| 午夜天堂精品久久久久| 亚洲美女av网站| 欧美日韩大片一区二区三区| 亚洲精品午夜| 亚洲国产视频一区二区| 免费视频久久| 日韩视频免费观看| 亚洲久久在线| 欧美婷婷久久| 欧美一级大片在线免费观看| 亚洲主播在线播放| 国产无遮挡一区二区三区毛片日本| 亚洲欧美综合国产精品一区| 亚洲综合色激情五月| 国产午夜精品理论片a级大结局| 久久精品论坛| 蜜桃av久久久亚洲精品| 日韩一级不卡| 亚洲欧美日产图| 极品少妇一区二区| 亚洲国产日韩欧美在线图片 | 亚洲人成人99网站| 欧美日韩在线精品| 欧美一区二区视频免费观看| 欧美亚洲网站| 亚洲日本免费| 亚洲午夜国产成人av电影男同| 国产亚洲人成网站在线观看| 欧美高清视频在线| 欧美天堂在线观看| 久久综合九色综合欧美狠狠| 蜜臀a∨国产成人精品| 亚洲一区二区免费看| 欧美亚洲在线播放| 亚洲伦理精品| 欧美中文字幕在线| av成人激情| 久久国产精品网站| 制服丝袜亚洲播放| 久久久久久久欧美精品| 一本一道久久综合狠狠老精东影业 | 久久资源在线| 欧美福利专区| 欧美一区二区大片| 老色批av在线精品| 亚洲欧美日韩系列| 欧美 日韩 国产一区二区在线视频| 亚洲午夜国产一区99re久久| 久久精品国产欧美激情| 亚洲视频高清| 欧美大片免费观看| 麻豆精品网站| 国产精品亚洲人在线观看| 亚洲国产成人porn| 韩国精品在线观看| 亚洲深夜福利在线| 99天天综合性| 麻豆av一区二区三区| 久久久精品国产免费观看同学| 欧美日韩国产不卡| 亚洲国产视频直播| 亚洲国产cao| 久久久人成影片一区二区三区 | 中文成人激情娱乐网| 亚洲人成人一区二区三区| 久久久国产精品一区| 欧美一区二区三区久久精品| 欧美色另类天堂2015| 亚洲日本无吗高清不卡| 亚洲靠逼com| 欧美成人一二三| 欧美黄网免费在线观看| 1024成人| 久久免费少妇高潮久久精品99| 久久久av毛片精品| 国产自产女人91一区在线观看| 亚洲性感美女99在线| 亚洲无线一线二线三线区别av| 欧美日韩国产不卡| 亚洲美洲欧洲综合国产一区| 亚洲日本一区二区三区| 看片网站欧美日韩| 欧美激情一区二区三区高清视频| 亚洲国产高清在线| 欧美华人在线视频| 亚洲区一区二| 亚洲一区精品在线| 国产麻豆综合| 久久久www| 亚洲人成精品久久久久| 亚洲一区二区三区视频播放| 国产精品爽黄69| 久久久99国产精品免费| 亚洲国产欧美精品| 亚洲女人小视频在线观看| 国产亚洲精品久久久久婷婷瑜伽| 久久高清福利视频| 亚洲国产精品一区二区第四页av| 一区二区电影免费在线观看| 国产精品视频久久| 欧美另类变人与禽xxxxx| 国产日韩视频| 欧美一区二区三区日韩| 女女同性精品视频| 99在线精品视频| 国产精品嫩草影院一区二区| 性欧美xxxx大乳国产app| 米奇777在线欧美播放| 99精品视频一区| 国产麻豆9l精品三级站| 久久婷婷国产麻豆91天堂| 最新国产精品拍自在线播放| 亚洲一区二区三区中文字幕在线 | 久久精品伊人| 亚洲精品视频一区| 久久久久久穴| 中日韩午夜理伦电影免费| 国产在线视频欧美一区二区三区| 麻豆精品在线视频| 亚洲欧美另类久久久精品2019| 欧美激情精品久久久久久蜜臀| 欧美一级视频精品观看| 99www免费人成精品| 狠狠色综合网| 国产精品亚发布| 欧美日韩ab| 免费看黄裸体一级大秀欧美| 亚洲嫩草精品久久| 亚洲激情在线播放| 美脚丝袜一区二区三区在线观看| 亚洲欧美大片| 一本到高清视频免费精品| 影音先锋在线一区| 国产日韩欧美日韩大片| 欧美日韩一区二区视频在线| 免费成人av| 久久久久久国产精品mv| 性欧美大战久久久久久久免费观看| 99国内精品久久| 亚洲激情欧美激情| 欧美激情免费观看| 欧美v日韩v国产v| 久久字幕精品一区|