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

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>
            9久草视频在线视频精品| 欧美在线1区| 欧美伊人久久| 欧美专区在线观看一区| 久久精品国产一区二区三区| 欧美一区1区三区3区公司| 欧美在线3区| 欧美成人午夜激情在线| 亚洲精品日本| 亚洲影院污污.| 久久青青草综合| 欧美精品网站| 国产欧美精品在线播放| 亚洲国产精品成人一区二区| 99视频超级精品| 久久成人国产精品| 最近看过的日韩成人| 一本色道久久综合亚洲91| 欧美一区二视频| 欧美精品一线| 激情成人中文字幕| 亚洲综合成人婷婷小说| 美女精品自拍一二三四| 99在线视频精品| 久久亚洲精品视频| 欧美性做爰毛片| 亚洲风情亚aⅴ在线发布| 亚洲欧美日韩一区二区| 欧美黄色影院| 欧美一级黄色网| 欧美视频在线一区| 亚洲欧洲在线视频| 久久在线免费观看| 亚洲一区二区毛片| 欧美伦理影院| 亚洲第一精品夜夜躁人人躁| 欧美一区二区黄| 夜夜夜久久久| 欧美日韩国产黄| 欧美天堂亚洲电影院在线播放| 国产视频亚洲精品| 亚洲一区二区三区中文字幕在线| 免费在线观看日韩欧美| 欧美一级播放| 国产毛片一区| 亚洲摸下面视频| 一区二区三区欧美| 欧美日韩国产综合网| 亚洲精品在线一区二区| 欧美电影在线观看| 美国十次成人| 亚洲国产精品成人一区二区| 久久免费视频网站| 欧美专区第一页| 国产日韩欧美综合| 久久成人免费日本黄色| 欧美一区日韩一区| 国产一区二区| 久久午夜视频| 久热精品视频在线| 亚洲破处大片| 亚洲美女黄网| 国产精品久久久久久久一区探花 | 亚洲欧洲一区二区天堂久久| 老司机67194精品线观看| 激情久久婷婷| 欧美激情视频在线播放 | 一区在线观看| 玖玖玖国产精品| 老司机午夜免费精品视频| 在线免费观看视频一区| 亚洲国产精品尤物yw在线观看 | 欧美高清在线视频观看不卡| 狼人社综合社区| 亚洲美女视频在线观看| 亚洲日本激情| 国产精品视频久久| 久久久精品一区| 免费毛片一区二区三区久久久| 亚洲高清在线观看一区| 亚洲国产三级网| 国产精品久久久久久久久久三级| 欧美一区二区三区在线视频| 久久成人精品电影| 99国产精品| 午夜精品视频在线| 亚洲经典三级| 亚洲影音一区| 亚洲欧洲视频| 亚洲欧美成人一区二区在线电影| 激情六月婷婷综合| 一区二区三欧美| 136国产福利精品导航| 最新中文字幕一区二区三区| 亚洲国产精品ⅴa在线观看 | 亚洲免费av片| 亚洲午夜在线观看视频在线| 国产欧美日韩在线| 欧美成人一区二免费视频软件| 欧美日韩美女在线| 久久亚洲精品中文字幕冲田杏梨| 欧美激情一区二区三级高清视频| 香蕉久久夜色精品国产| 另类春色校园亚洲| 欧美亚洲一级| 欧美精品在线观看91| 久久青草欧美一区二区三区| 欧美人成免费网站| 麻豆精品视频在线观看| 国产精品第13页| 亚洲高清视频在线观看| 韩国欧美一区| 欧美在线观看日本一区| 亚洲欧美国产一区二区三区| 嫩草成人www欧美| 欧美综合77777色婷婷| 欧美激情精品久久久久久免费印度| 久久精品国产亚洲高清剧情介绍| 欧美日韩一区二| 91久久精品日日躁夜夜躁国产| 韩国在线一区| 亚洲伊人网站| 亚洲欧美综合精品久久成人| 欧美日韩在线播放三区| 亚洲精品久久久久久久久久久久 | 欧美性大战久久久久久久| 亚洲国产欧美不卡在线观看| 尤物在线观看一区| 久久精品一区| 久久婷婷国产麻豆91天堂| 国产模特精品视频久久久久| 亚洲一级特黄| 午夜精品久久久久久久99樱桃| 欧美日韩综合不卡| 亚洲精品国产欧美| 亚洲人成人一区二区三区| 老司机久久99久久精品播放免费| 浪潮色综合久久天堂| 加勒比av一区二区| 猛干欧美女孩| 亚洲国产精品99久久久久久久久| 亚洲大片在线观看| 欧美sm视频| 日韩一本二本av| 欧美一区二区三区啪啪| 狠狠色狠狠色综合人人| 牛夜精品久久久久久久99黑人| 欧美成人自拍| 一区二区三区久久| 国产精品亚洲产品| 久久久中精品2020中文| 亚洲成人资源| 亚洲综合大片69999| 国语自产精品视频在线看| 麻豆亚洲精品| 中日韩视频在线观看| 欧美在线一区二区| 久久综合给合久久狠狠色 | 性欧美videos另类喷潮| 免费成人性网站| 在线视频精品| 国产视频精品免费播放| 久久只精品国产| 亚洲精品永久免费精品| 亚洲欧美激情在线视频| 韩国美女久久| 欧美日韩亚洲高清| 久久国产主播| 99精品热6080yy久久| 午夜在线视频观看日韩17c| 国产一区二区成人| 欧美久久精品午夜青青大伊人| 亚洲小说欧美另类社区| 美女视频一区免费观看| 亚洲婷婷综合色高清在线| 国产三级精品三级| 欧美国产先锋| 欧美在线一级va免费观看| 日韩天堂在线视频| 蜜臀91精品一区二区三区| 亚洲性线免费观看视频成熟| 伊人久久综合97精品| 国产精品成人一区二区三区夜夜夜| 久久久久国色av免费观看性色| 一本一本大道香蕉久在线精品| 免费的成人av| 久久国产黑丝| 午夜精品福利在线| 亚洲最黄网站| 亚洲精品美女在线观看| 黄色成人片子| 国产一区二区三区电影在线观看 | 欧美国产日韩二区| 久久精品中文字幕一区| 亚洲一区二区三区色| 日韩视频在线永久播放| 最新日韩在线| 亚洲国产综合视频在线观看| 欧美高清在线播放| 欧美mv日韩mv国产网站|