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

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
<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>
            一区二区不卡在线视频 午夜欧美不卡在| 亚洲一区二区三区中文字幕| 欧美日本在线看| 国产精品99久久99久久久二8| 亚洲精选视频免费看| 欧美亚洲第一页| 欧美在线观看视频一区二区三区| 午夜亚洲福利| 国内一区二区在线视频观看| 欧美福利在线观看| 欧美日韩国产电影| 欧美一区二区三区久久精品| 久久久久久网站| 亚洲精选91| 亚洲一区二区三| 影音先锋日韩有码| 亚洲日本aⅴ片在线观看香蕉| 美女精品一区| 亚洲免费视频在线观看| 欧美一区二区三区免费大片| 亚洲激情视频网站| aa亚洲婷婷| 一区二区在线观看视频| 亚洲高清免费视频| 国产精品免费观看在线| 久久综合五月天婷婷伊人| 欧美精品一区二区三区在线看午夜| 午夜激情综合网| 狂野欧美激情性xxxx| 亚洲无吗在线| 久久嫩草精品久久久精品| 一区二区三区四区在线| 欧美在线亚洲综合一区| 亚洲精品一二| 亚洲欧美综合网| 亚洲国产裸拍裸体视频在线观看乱了中文 | 在线观看成人av电影| 日韩视频免费观看| 国内精品写真在线观看| 亚洲毛片视频| 黄色日韩网站| 一区二区欧美国产| 在线观看成人一级片| 一区二区三区免费在线观看| 伊甸园精品99久久久久久| 日韩亚洲欧美在线观看| 怡红院av一区二区三区| 99综合电影在线视频| 黄色国产精品| 亚洲久久一区二区| 国语自产精品视频在线看抢先版结局 | 国产一区在线播放| 日韩亚洲欧美精品| 亚洲国产mv| 午夜欧美精品| 中文成人激情娱乐网| 久久天天躁狠狠躁夜夜爽蜜月| 亚洲欧美国产77777| 免费中文日韩| 久久视频一区二区| 国产精品视频专区| 亚洲精品美女在线| ●精品国产综合乱码久久久久| 亚洲在线中文字幕| 一本色道久久综合亚洲精品小说| 久久久久亚洲综合| 久久国产婷婷国产香蕉| 欧美色大人视频| 亚洲高清自拍| 在线欧美不卡| 欧美一区二区黄色| 香蕉成人伊视频在线观看 | 久久一区二区三区国产精品| 国产精品久久久久影院色老大| 91久久国产综合久久蜜月精品 | 欧美综合77777色婷婷| 欧美日韩亚洲综合在线| 亚洲国产精品一区制服丝袜| 精品99视频| 欧美在线看片| 欧美在线看片a免费观看| 欧美视频一区在线观看| 亚洲精品日韩久久| 亚洲精品乱码久久久久久蜜桃麻豆 | 亚洲国产国产亚洲一二三| 国产亚洲欧美日韩一区二区| 亚洲免费人成在线视频观看| 亚洲综合好骚| 欧美午夜电影网| 99re6这里只有精品| 野花国产精品入口| 欧美精品入口| 亚洲欧洲在线观看| 日韩一级欧洲| 欧美精品videossex性护士| 亚洲国产精品精华液2区45| 一区二区三区在线免费播放| 欧美尤物一区| 久久久福利视频| 国产一区香蕉久久| 久久精品二区亚洲w码| 久久精品官网| 国产在线观看一区| 欧美影院久久久| 亚洲一区二区在线播放| 欧美特黄一级| 亚洲一二三四久久| 欧美一区二区三区四区在线观看 | 亚洲精品黄网在线观看| 欧美激情区在线播放| 91久久夜色精品国产网站| 亚洲乱码久久| 欧美日韩免费精品| 亚洲少妇最新在线视频| 亚洲一区免费视频| 国产伦精品一区二区三区高清| 亚洲综合视频1区| 久久久久久一区二区| 影音先锋亚洲精品| 欧美aⅴ一区二区三区视频| 亚洲经典视频在线观看| 亚洲亚洲精品在线观看| 国产精品蜜臀在线观看| 欧美一区二区黄| 免费av成人在线| 亚洲精品女人| 国产精品r级在线| 亚洲欧美日本日韩| 久久国产日韩欧美| 黄网站色欧美视频| 欧美福利在线观看| 一区二区av在线| 久久精品亚洲一区二区三区浴池| 伊人狠狠色j香婷婷综合| 嫩草国产精品入口| 日韩亚洲欧美一区二区三区| 先锋a资源在线看亚洲| 一区在线视频| 欧美精品18| 亚洲一区二区三区高清不卡| 久久美女性网| 亚洲乱码国产乱码精品精天堂| 欧美色图一区二区三区| 羞羞视频在线观看欧美| 亚洲第一精品久久忘忧草社区| 亚洲视频免费在线| 国产一区二区高清不卡| 欧美大色视频| 亚洲一区中文| 欧美黄色成人网| 亚洲欧美在线一区| 曰韩精品一区二区| 欧美色图五月天| 久久免费国产| 日韩一区二区免费看| 久久久综合激的五月天| 亚洲国产精品第一区二区| 欧美日韩国产成人在线91| 欧美一区二区三区四区视频| 亚洲国产高清视频| 欧美伊人久久久久久午夜久久久久| 亚洲成人在线| 欧美亚日韩国产aⅴ精品中极品| 欧美一区二区三区视频免费| 亚洲国产精品一区制服丝袜| 欧美一区二区在线播放| 最新亚洲电影| 国产日韩欧美在线一区| 欧美精品国产精品| 亚洲视频自拍偷拍| 亚洲成色最大综合在线| 欧美自拍偷拍午夜视频| 99re亚洲国产精品| 国产最新精品精品你懂的| 欧美日韩一二三四五区| 久久一区二区视频| 亚洲精品久久久久| 久久精品视频99| 99伊人成综合| 在线精品福利| 国产麻豆精品在线观看| 久久综合伊人77777| 午夜精品福利视频| 亚洲精品老司机| 久久久久久久国产| 亚洲女人小视频在线观看| 亚洲欧洲中文日韩久久av乱码| 国产精品毛片高清在线完整版| 欧美成人激情视频| 久久精品国产综合| 亚洲在线播放| 91久久久在线| 免费一级欧美片在线观看| 欧美亚洲自偷自偷| 99国产精品久久久久久久| 尤物99国产成人精品视频| 国产精品色在线| 欧美精品三区| 欧美大片免费观看在线观看网站推荐 | 亚洲专区在线视频|