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

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
<2025年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用鏈接

留言簿(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精品欧美一区二区三区综合在线| 欧美精品91| 亚洲欧美福利一区二区| 欧美一级网站| 91久久国产综合久久91精品网站| 亚洲激情校园春色| 欧美图区在线视频| 久久亚洲综合网| 欧美www在线| 亚洲欧美日韩久久精品| 欧美在线播放高清精品| 日韩亚洲欧美一区| 亚洲一区二区三区免费在线观看| 影音欧美亚洲| 99精品欧美一区二区蜜桃免费| 国产日韩精品在线| 亚洲国产视频直播| 国产日韩精品在线播放| 亚洲黄色成人网| 国产麻豆午夜三级精品| 欧美粗暴jizz性欧美20| 国产精品v亚洲精品v日韩精品 | 午夜在线观看欧美| 日韩视频中午一区| 欧美亚洲一区| 亚洲天堂免费在线观看视频| 久久久激情视频| 欧美一区二区免费观在线| 欧美大片在线观看| 久久久精品999| 欧美日韩精品福利| 麻豆精品视频| 国产亚洲福利一区| 99在线精品观看| 亚洲精品1区2区| 欧美中文字幕第一页| 亚洲婷婷在线| 欧美激情网友自拍| 美脚丝袜一区二区三区在线观看| 国产精品日本欧美一区二区三区| 亚洲国产精品一区二区www| 国语自产偷拍精品视频偷| av成人免费在线| 宅男在线国产精品| 欧美va天堂在线| 麻豆精品视频在线| 禁久久精品乱码| 欧美在线视频免费| 欧美伊人久久久久久午夜久久久久| 欧美精品久久一区二区| 亚洲第一区在线观看| 精品av久久707| 久久九九久精品国产免费直播| 欧美一级日韩一级| 国产精品毛片va一区二区三区| 亚洲精品欧美日韩专区| 99精品视频免费观看视频| 欧美大片免费| 亚洲毛片在线| 亚洲一级黄色av| 国产精品激情| 亚洲一区三区电影在线观看| 欧美一区二区免费观在线| 国产欧美精品va在线观看| 亚洲免费网站| 久久se精品一区二区| 国内精品视频一区| 久久综合一区二区| 亚洲三级性片| 亚洲一区二区在线观看视频| 国产精品视区| 欧美在线视频二区| 亚洲国产精品99久久久久久久久| 亚洲理论电影网| 欧美日韩一区二区在线观看| 亚洲自拍偷拍色片视频| 久久久久国产成人精品亚洲午夜| 永久免费视频成人| 欧美日韩1234| 亚洲欧美激情一区| 免费看亚洲片| 中文精品视频| 国产欧美精品xxxx另类| 麻豆精品网站| 亚洲一区二区毛片| 久久综合久久综合久久| 亚洲乱码国产乱码精品精可以看| 欧美系列一区| 久久久久久久一区| 亚洲开发第一视频在线播放| 欧美一二三区精品| 亚洲精品一区中文| 国产精品综合不卡av| 麻豆9191精品国产| 亚洲一区视频在线| 亚洲国产精品久久久久久女王| 亚洲综合色丁香婷婷六月图片| 国产视频精品网| 欧美日韩一区二区免费视频| 欧美一级免费视频| 亚洲精品在线一区二区| 久久久精品国产免大香伊 | 亚洲午夜电影| 樱花yy私人影院亚洲| 国产精品久久久久久久午夜| 美女成人午夜| 欧美一乱一性一交一视频| 亚洲欧洲精品一区二区| 久久婷婷影院| 亚洲欧美日产图| 亚洲美女网站| 一区二区三区在线不卡| 国产精品成人免费视频| 欧美黄色一级视频| 久久久久99| 亚洲欧美在线网| 亚洲视频一区二区在线观看| 欧美国产三区| 久久噜噜噜精品国产亚洲综合| 亚洲欧美日产图| 亚洲午夜激情网页| 亚洲精品在线免费| 亚洲国产精品黑人久久久| 国产日韩欧美日韩| 国产精品网站在线播放| 欧美日韩一二区| 欧美日韩精品综合在线| 欧美黑人多人双交| 久久亚洲图片| 久久夜精品va视频免费观看| 久久精品一区蜜桃臀影院| 欧美一区二区三区视频在线| 亚洲一二三区在线观看| 99精品国产热久久91蜜凸| 亚洲精品乱码久久久久久久久 | 免费高清在线视频一区·| 久久米奇亚洲| 久久在线免费观看视频| 久久影院午夜论| 久久手机免费观看| 巨乳诱惑日韩免费av| 久久人人爽国产| 美女主播视频一区| 欧美电影电视剧在线观看| 欧美高清你懂得| 亚洲欧洲一区| 一本久久综合亚洲鲁鲁| 亚洲制服少妇| 欧美一区二区三区免费在线看| 欧美一区二区三区在线播放| 久久精品国产精品| 久久中文字幕一区| 免费试看一区| 欧美日韩在线视频一区二区| 国产精品第2页| 国产亚洲精品7777| 欲色影视综合吧| 9色porny自拍视频一区二区| 亚洲一区二区网站| 久久蜜桃香蕉精品一区二区三区| 免费在线日韩av| 亚洲精品视频免费在线观看| 亚洲一品av免费观看| 久久精品亚洲精品| 欧美人妖另类| 国产日韩精品一区观看| 亚洲黑丝在线| 午夜激情综合网| 麻豆av福利av久久av| 一本大道久久a久久综合婷婷| 欧美一区二区高清| 欧美精品91| 国内偷自视频区视频综合| 亚洲精品影视| 久久久综合激的五月天| 99国产一区二区三精品乱码| 欧美一级片在线播放| 欧美人牲a欧美精品| 狠狠久久亚洲欧美专区| 一区二区三区福利| 久久激情一区| 亚洲视频在线观看免费| 欧美波霸影院| 国产亚洲午夜| 亚洲欧洲av一区二区三区久久| 欧美14一18处毛片| 亚洲免费一在线| 欧美理论大片| 最新日韩欧美| 久久久一区二区| 亚洲一区免费网站| 欧美日韩免费观看一区三区| 亚洲国产天堂久久综合| 久久九九国产精品怡红院| 99人久久精品视频最新地址| 免费观看成人|