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

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 閱讀(400) 評論(0)  編輯 收藏 引用 所屬分類: OS
<2025年12月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

常用鏈接

留言簿(10)

隨筆分類(307)

隨筆檔案(297)

algorithm

Books_Free_Online

C++

database

Linux

Linux shell

linux socket

misce

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

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>
            乱中年女人伦av一区二区| 亚洲精品永久免费精品| 最新成人在线| 国产自产在线视频一区| 一本色道久久综合狠狠躁篇的优点| 国产午夜久久久久| 亚洲亚洲精品三区日韩精品在线视频| 亚洲国产一区二区精品专区| 欧美伊人久久| 久久精品中文字幕一区二区三区 | 亚洲成色精品| 亚洲精品一区二区三区四区高清| 国产一区二区三区av电影| 亚洲午夜羞羞片| 亚洲免费在线电影| 欧美日韩精品伦理作品在线免费观看| 欧美高清在线观看| 亚洲人成人一区二区在线观看| 久久精品国产清高在天天线| 久久精品国产99精品国产亚洲性色 | 国产亚洲欧美aaaa| 亚洲尤物在线视频观看| 亚洲欧美日韩成人高清在线一区| 欧美性开放视频| 在线一区二区日韩| 亚洲欧美卡通另类91av| 国产精品外国| 亚洲欧美一区二区三区在线| 欧美一区二区福利在线| 国产精品综合av一区二区国产馆| 亚洲一区国产视频| 久久免费视频网站| 一区免费观看| 欧美另类高清视频在线| 99riav国产精品| 欧美一二三视频| 激情久久久久久久| 欧美.日韩.国产.一区.二区| 亚洲品质自拍| 午夜一级久久| 尤物九九久久国产精品的特点| 久久久久久久综合| 亚洲欧洲久久| 午夜性色一区二区三区免费视频| 国产噜噜噜噜噜久久久久久久久| 午夜精品视频在线| 免费在线视频一区| 日韩午夜在线电影| 国产精品永久| 美女脱光内衣内裤视频久久网站| 亚洲精品国产日韩| 亚洲欧美在线一区| 在线免费不卡视频| 欧美性猛片xxxx免费看久爱 | 久久综合久色欧美综合狠狠 | 国产精品无码永久免费888| 久久精品一区二区三区不卡| 亚洲激情第一页| 午夜亚洲影视| 亚洲日本中文字幕免费在线不卡| 欧美视频精品在线观看| 久久久国产视频91| 亚洲美女诱惑| 久久综合色影院| 亚洲一区视频在线| 亚洲高清视频在线| 国产欧美日韩视频在线观看| 欧美成黄导航| 久久精品视频网| 亚洲小说区图片区| 亚洲高清视频在线观看| 欧美一级久久久久久久大片| 亚洲美女av网站| 国产亚洲精品自拍| 国产精品高潮久久| 欧美激情小视频| 久久丁香综合五月国产三级网站| 最新中文字幕一区二区三区| 久久亚洲风情| 性18欧美另类| 亚洲综合色婷婷| av不卡在线看| 亚洲人成网站777色婷婷| 国产自产v一区二区三区c| 国产精品福利片| 欧美日韩免费网站| 欧美福利一区二区三区| 久久久久久久波多野高潮日日| 亚洲一区精品电影| 亚洲视频一二三| 夜夜嗨av一区二区三区网页| 亚洲人成啪啪网站| 亚洲国产精彩中文乱码av在线播放| 欧美极品在线播放| 久久精品中文字幕免费mv| 亚洲图色在线| 久久精品99| 亚洲综合日韩| 亚洲一级黄色片| 亚洲精品免费在线观看| 亚洲精品国精品久久99热一| 欧美国产一区二区| 欧美福利视频网站| 亚洲高清一区二区三区| 欧美大尺度在线观看| 欧美+日本+国产+在线a∨观看| 麻豆亚洲精品| 欧美大尺度在线观看| 欧美.www| 亚洲人体影院| aa级大片欧美三级| 在线一区二区日韩| 亚洲欧美综合v| 欧美在线免费一级片| 久久免费黄色| 欧美大胆成人| 欧美三区在线视频| 国产精品亚洲不卡a| 国产亚洲精品aa| 在线观看一区| 日韩视频二区| 亚洲午夜极品| 久久精品av麻豆的观看方式| 麻豆av一区二区三区| 亚洲二区在线观看| 一区二区三区精品| 先锋影音久久久| 久久综合久久美利坚合众国| 欧美精品激情blacked18| 欧美日韩中文| 激情综合网激情| 日韩午夜在线电影| 欧美亚洲在线播放| 欧美a级片网| aa级大片欧美三级| 欧美在线视频日韩| 欧美高清在线一区二区| 欧美性猛交xxxx乱大交蜜桃| 国产亚洲午夜高清国产拍精品| 亚洲福利一区| 亚洲欧美成aⅴ人在线观看| 久久综合伊人77777麻豆| 亚洲国产精品999| 亚洲一区中文| 欧美激情一区二区三级高清视频| 国产精品www色诱视频| 一区福利视频| 亚洲欧美日韩一区| 欧美激情在线狂野欧美精品| 在线亚洲精品| 蜜臀91精品一区二区三区| 国产精品亚洲欧美| 亚洲精品一二区| 久久国产高清| 一个人看的www久久| 久久久爽爽爽美女图片| 国产精品久久夜| 亚洲乱码精品一二三四区日韩在线| 欧美一区亚洲一区| 亚洲免费av电影| 免费久久99精品国产自| 国产视频丨精品|在线观看| 亚洲精品视频中文字幕| 久久综合久久久| 亚洲男人的天堂在线| 欧美激情视频一区二区三区免费 | 亚洲精选久久| 美日韩精品视频| 欧美一区二区三区视频免费| 欧美三级欧美一级| 亚洲精品字幕| 欧美高清免费| 久久亚洲视频| 国内伊人久久久久久网站视频| 亚洲欧美成人一区二区在线电影| 亚洲国产精品va在线观看黑人| 欧美在线啊v| 国产亚洲一区二区三区在线播放| 午夜视频久久久| 夜夜嗨一区二区三区| 欧美精品一区二区三区在线看午夜| 伊人婷婷欧美激情| 久久伊人精品天天| 久久精品国产清自在天天线 | 尤物在线观看一区| 久久精品国产精品亚洲综合| 宅男噜噜噜66一区二区| 欧美天天在线| 亚洲图片欧美日产| 一区二区动漫| 国产精品免费电影| 性欧美video另类hd性玩具| 亚洲一区精品视频| 国产日韩精品入口| 欧美专区一区二区三区| 欧美一区二区三区在线看| 国产偷自视频区视频一区二区| 久久精品国产96久久久香蕉| 久久国产精品一区二区三区四区| 激情久久久久久久|