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

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 閱讀(389) 評論(0)  編輯 收藏 引用 所屬分類: OS
<2010年2月>
31123456
78910111213
14151617181920
21222324252627
28123456
78910111213

常用鏈接

留言簿(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>
            亚洲精品在线看| 久久伊伊香蕉| 国产精品久久久久久久久久三级| 亚洲经典三级| 亚洲特黄一级片| 尤物yw午夜国产精品视频| 欧美电影在线| 欧美日本一道本在线视频| 欧美亚洲免费电影| 女主播福利一区| 欧美影院在线| 欧美区一区二| 欧美国产日韩一区二区| 国产亚洲福利社区一区| 亚洲精品国产系列| 在线观看日韩精品| 久久精品国产欧美激情| 亚洲欧美激情诱惑| 欧美日韩91| 欧美二区在线| 亚洲国产视频a| 久久久久国产免费免费| 久久久国产精彩视频美女艺术照福利| 欧美激情国产精品| 亚洲国产高清一区| 日韩视频在线你懂得| 欧美va亚洲va香蕉在线| 免费国产一区二区| 亚洲国产精品成人va在线观看| 亚洲日本激情| 欧美精品网站| 在线亚洲高清视频| 亚洲欧美成人综合| 夜夜精品视频| 欧美日韩一级视频| 一区二区三区波多野结衣在线观看| 日韩午夜精品视频| 国产日韩精品视频一区二区三区 | 欧美午夜影院| 亚洲午夜精品视频| 久久免费视频观看| 日韩视频免费在线| 国产一区二区黄| 久久久久青草大香线综合精品| 欧美成人嫩草网站| 亚洲女性裸体视频| 亚洲日本va午夜在线影院| 欧美涩涩网站| 久久久亚洲精品一区二区三区| 91久久精品视频| 久久久久国内| 亚洲一二三四久久| 亚洲经典自拍| 一区免费观看| 国产亚洲人成网站在线观看| 欧美激情视频在线播放| 久久久久久久久伊人| 制服丝袜亚洲播放| 亚洲激情二区| 亚洲裸体在线观看| 亚洲毛片视频| 91久久视频| 亚洲久久成人| 亚洲精品视频免费观看| 亚洲国产精品999| 亚洲欧洲综合| 99国产精品99久久久久久| 亚洲国产一区二区三区在线播| 欧美成人免费观看| 亚洲人体一区| 99视频精品全部免费在线| 欧美精品麻豆| 久热国产精品视频| 欧美精品成人在线| 欧美日韩一区二区三区高清| 欧美网站大全在线观看| 国产日韩一区二区三区| 国产一区二区三区四区三区四| 韩国成人精品a∨在线观看| 在线视频国产日韩| 日韩视频中午一区| 欧美自拍丝袜亚洲| 欧美激情综合色| 亚洲欧美日韩精品久久奇米色影视| 欧美一区二区三区视频在线观看| 欧美中文在线视频| 国产精品r级在线| 在线观看欧美精品| 欧美亚洲在线视频| 亚洲精品欧美日韩专区| 午夜日韩视频| 国产精品自拍三区| 在线亚洲欧美专区二区| 免费久久99精品国产自| 亚洲欧美成人| 国产精品免费久久久久久| 亚洲国产黄色片| 久久成人18免费观看| 一区二区三区www| 亚洲无玛一区| 亚洲人成在线影院| 欧美精品自拍| 日韩一级视频免费观看在线| 噜噜爱69成人精品| 久久久久久久一区二区三区| 国产欧美在线视频| 久久久久久高潮国产精品视| 性久久久久久久久| 久久伊伊香蕉| 久久综合狠狠| 一本色道久久综合亚洲精品不| 亚洲高清视频在线| 欧美日韩国产欧| 亚洲一区二区三区四区五区午夜| 亚洲日本成人| 国产精品亚洲аv天堂网| 久久精品动漫| 久久综合中文| 亚洲一区二区三区免费观看| 亚洲免费综合| 亚洲国产精品日韩| aa日韩免费精品视频一| 国产一区久久| 99国产成+人+综合+亚洲欧美| 国产精品免费一区豆花| 裸体歌舞表演一区二区 | 亚洲日本aⅴ片在线观看香蕉| 亚洲黄一区二区三区| 国产欧美高清| 日韩一级视频免费观看在线| 国产亚洲成av人片在线观看桃| 亚洲黄色影片| 亚洲国产婷婷| 久久久精品网| 久久精品久久99精品久久| 欧美精品1区2区3区| 欧美国产另类| 亚洲电影免费在线| 亚洲国产欧美一区二区三区久久| 亚洲欧美日韩高清| 性高湖久久久久久久久| 欧美日韩精品免费观看| 亚洲欧洲精品一区二区三区| 亚洲福利国产| 久久久在线视频| 久久久久久综合| 亚洲国产精品第一区二区三区| 久久精品亚洲精品国产欧美kt∨| 久久激情婷婷| 国产在线一区二区三区四区| 久久精品国产2020观看福利| 欧美电影在线观看完整版| 亚洲精品美女91| 小嫩嫩精品导航| 国外成人在线| 欧美成人伊人久久综合网| 亚洲美女精品一区| 欧美在线免费观看亚洲| 一区精品在线播放| 欧美人与禽猛交乱配| 在线精品视频一区二区| 欧美福利一区| 欧美在线免费播放| 亚洲免费观看在线视频| 久久综合影音| 欧美一区二区黄色| 亚洲免费电影在线观看| 国产欧美精品在线观看| 欧美女主播在线| 欧美激情视频一区二区三区在线播放 | 欧美一级日韩一级| 亚洲国产一区二区a毛片| 国产精品入口日韩视频大尺度| 欧美成人精品高清在线播放| 欧美一区二区三区在线观看 | 奶水喷射视频一区| 亚洲欧美999| 亚洲午夜精品久久| 一本久道久久久| 在线视频亚洲一区| 亚洲国产成人久久综合一区| 久久久在线视频| 久久艳片www.17c.com| 美女91精品| 99热在线精品观看| 亚洲欧美一区二区精品久久久| 国产视频亚洲精品| 亚洲第一毛片| 久久人人看视频| 日韩一级片网址| 亚洲欧美三级在线| 欧美高清在线一区二区| 国产伦精品一区二区三区照片91| 国产欧美精品| 日韩亚洲欧美一区二区三区| 亚洲中无吗在线| 欧美国产在线视频| 亚洲一区高清| 欧美高清不卡在线| 欧美日韩在线播放三区|