操作系统中的处理机调度调度_操作系统中的流程分类和调度
操作系統(tǒng)中的處理機(jī)調(diào)度調(diào)度
處理 (Process)
In the operating system, there are numerous task and application program run simultaneously. A program is stored in the hard disk or any other form of secondary storage. When the program is executed it must be loaded in the system’s memory. A process can be viewed as a program in execution. In the system, each process is assigned a unique Id when it is created and it will be referenced by the unique Id until the process completes execution and it is terminated. A process is an entity which performs the basic unit of work or one work at a time. We can say that a process is an instance of a computer program that is being executed. A process contains the program code and the activity that is going to be performed. when the computer program is in secondary memory then it is a passive entity or when a process is in main memory then it is an active entity. In the system, several processes may be associated with the same program.
在操作系統(tǒng)中,有許多任務(wù)和應(yīng)用程序同時(shí)運(yùn)行。 程序存儲(chǔ)在硬盤或任何其他形式的輔助存儲(chǔ)中。 執(zhí)行程序時(shí),必須將其加載到系統(tǒng)內(nèi)存中。 可以將進(jìn)程視為正在執(zhí)行的程序。 在系統(tǒng)中,每個(gè)進(jìn)程在創(chuàng)建時(shí)都會(huì)分配一個(gè)唯一的ID,并且唯一ID會(huì)引用該ID,直到該進(jìn)程完成執(zhí)行并終止為止。 流程是一次執(zhí)行基本工作單元或一項(xiàng)工作的實(shí)體。 我們可以說(shuō)一個(gè)進(jìn)程是一個(gè)正在執(zhí)行的計(jì)算機(jī)程序的實(shí)例。 一個(gè)過(guò)程包含程序代碼和將要執(zhí)行的活動(dòng)。 當(dāng)計(jì)算機(jī)程序位于輔助內(nèi)存中時(shí),它是一個(gè)被動(dòng)實(shí)體,或者當(dāng)進(jìn)程位于主內(nèi)存中時(shí),它是一個(gè)主動(dòng)實(shí)體。 在系統(tǒng)中,幾個(gè)進(jìn)程可能與同一程序相關(guān)聯(lián)。
A process held a number of attributes like hardware, memory, CPU, and progress.
一個(gè)進(jìn)程擁有許多屬性,例如硬件,內(nèi)存,CPU和進(jìn)度。
Craft.io分類 (Process classification)
A process can be broadly categorized into the following two types based on its execution:
根據(jù)流程的執(zhí)行情況,大致可將其分為以下兩種類型:
I/O-Bound process
I / O綁定過(guò)程
An I/O-bound process is a process whose execution time is determined mainly by the amount of time it spends completing I/O operations.
綁定到I / O的進(jìn)程是其執(zhí)行時(shí)間主要由其完成I / O操作所花費(fèi)的時(shí)間確定的進(jìn)程。
CPU-Bound process
CPU綁定進(jìn)程
A CPU-bound process is a process whose execution time is determined by the speed of the CPU it runs on. A CPU-bound process can complete its execution faster if it is running on a faster processor.
受CPU限制的進(jìn)程是其執(zhí)行時(shí)間取決于其運(yùn)行的CPU速度的進(jìn)程。 如果受CPU約束的進(jìn)程在更快的處理器上運(yùn)行,則可以更快地完成其執(zhí)行。
Note: There is a third category - Memory-bound process. However, since RAM serves as I/O for the processor, this can be considered as an instance of the I/O-bound process type.
注意:第三類-內(nèi)存綁定進(jìn)程。 但是,由于RAM用作處理器的I / O,因此可以將其視為I / O綁定進(jìn)程類型的實(shí)例。
Further a process can be broadly categorized into the following two types based on execution mode.
另外,基于執(zhí)行模式,可以將處理大致分為以下兩種。
Kernel mode: In the kernel mode, a process has unrestricted access to the system hardware it can execute privileges instruction and can access both user and kernel address space.
內(nèi)核模式:在內(nèi)核模式下,進(jìn)程可以不受限制地訪問(wèn)系統(tǒng)硬件,它可以執(zhí)行特權(quán)指令,并且可以訪問(wèn)用戶和內(nèi)核地址空間。
Example: Most of the device drivers in the system execute as kernel mode processes.
示例:系統(tǒng)中的大多數(shù)設(shè)備驅(qū)動(dòng)程序都以內(nèi)核模式進(jìn)程執(zhí)行。
User mode: In the user mode it has no direct access to the underlying system hardware it can only access its own user address space of other processes and it cannot execute privileged instructions.
用戶模式:在用戶模式下,它不能直接訪問(wèn)基礎(chǔ)系統(tǒng)硬件,只能訪問(wèn)其他進(jìn)程自己的用戶地址空間,并且不能執(zhí)行特權(quán)指令。
Example: web- browser is executed as a user- mode process.
示例: Web瀏覽器作為用戶模式進(jìn)程執(zhí)行。
Craft.io調(diào)度 (Process scheduling)
On a computer system, there are often numerous processes that need to be executed simultaneously. Furthermore, the requests for resources necessary for their execution are made asynchronously. Therefore, to handle competing requests for resources including the processor, the OS employs a process scheduler. The process scheduler assigns each process the necessary resources and its turn for execution on the CPU. The decision to schedule a process is made by a scheduling algorithm. The scheduler maintains three queues, to schedule the processes.
在計(jì)算機(jī)系統(tǒng)上,通常有許多進(jìn)程需要同時(shí)執(zhí)行。 此外,異步執(zhí)行對(duì)執(zhí)行其所需的資源的請(qǐng)求。 因此,為了處理對(duì)包括處理器在內(nèi)的資源的競(jìng)爭(zhēng)請(qǐng)求,OS使用了進(jìn)程調(diào)度程序。 進(jìn)程調(diào)度程序?yàn)槊總€(gè)進(jìn)程分配必要的資源及其輪流,以便在CPU上執(zhí)行。 調(diào)度流程的決定由調(diào)度算法做出。 調(diào)度程序維護(hù)三個(gè)隊(duì)列,以調(diào)度進(jìn)程。
Job queue: The job queue is the set of all processes on the system.
作業(yè)隊(duì)列:作業(yè)隊(duì)列是系統(tǒng)上所有進(jìn)程的集合。
Ready queue: The ready queue has all the processes that are loaded in main memory. These processes are ready and waiting for their turn to execute as soon as the CPU becomes available.
就緒隊(duì)列:就緒隊(duì)列具有所有加載到主內(nèi)存中的進(jìn)程。 這些進(jìn)程已準(zhǔn)備就緒,等待輪到CPU可用時(shí)立即執(zhí)行。
Device queue: The set of processes waiting for an I/O device to become available, such as a printer. This queue is also known as the Blocked Queue.
設(shè)備隊(duì)列:等待I / O設(shè)備變得可用的一組進(jìn)程,例如打印機(jī)。 此隊(duì)列也稱為阻塞隊(duì)列。
.minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}}流程執(zhí)行 (Process Execution)
When a program is loaded into the memory (process memory) and it becomes a process and it can be divided into four sections, stack, heap, text and data.
當(dāng)程序加載到內(nèi)存(進(jìn)程內(nèi)存)中并成為一個(gè)進(jìn)程時(shí),可以分為四個(gè)部分:堆棧,堆,文本和數(shù)據(jù)。
Stack: The stack is used for local variables when the local variables are declared in the memory of some spaces on the stack is reserved for them.
堆棧:當(dāng)局部變量在堆棧中某些空間的內(nèi)存中被保留時(shí),將堆棧用于局部變量。
Heap: The heap is used in the system for the dynamic memory allocation and it is managed by calls to new, delete, malloc, free like commands.
堆:堆在系統(tǒng)中用于動(dòng)態(tài)內(nèi)存分配,并且通過(guò)調(diào)用new,delete,malloc和free之類的命令進(jìn)行管理。
Data section: The data section is made for of the global and the static variables when it is allocated and initialized prior to executing the main function.
數(shù)據(jù)部分:數(shù)據(jù)部分是在執(zhí)行主功能之前進(jìn)行分配和初始化時(shí)由全局變量和靜態(tài)變量組成的。
Text section: The text section is made for the compiled program code when the program is launched it is read from non-volatile storage in the system.
文本部分:啟動(dòng)程序時(shí),將從系統(tǒng)中的非易失性存儲(chǔ)器中讀取已編譯的程序代碼的文本部分。
Craft.io狀態(tài) (Process states)
When a process starts its execution it changes its states or goes through the various states. We can define a process states in parts by the current activity of that process. Each process may be in one or more in the states when it is executing.
當(dāng)進(jìn)程開始執(zhí)行時(shí),它會(huì)更改其狀態(tài)或經(jīng)歷各種狀態(tài)。 我們可以通過(guò)該過(guò)程的當(dāng)前活動(dòng)來(lái)部分定義一個(gè)過(guò)程狀態(tài)。 每個(gè)進(jìn)程在執(zhí)行時(shí)可能處于一個(gè)或多個(gè)狀態(tài)。
New
新
A process is in the new states when it is newly created in the system.
在系統(tǒng)中新創(chuàng)建進(jìn)程后,該進(jìn)程將處于新狀態(tài)。
Ready
準(zhǔn)備
When the process is created it move to the ready state and in this state, the process is ready for their execution.
創(chuàng)建流程后,它將進(jìn)入就緒狀態(tài),在此狀態(tài)下,流程已準(zhǔn)備好執(zhí)行。
Run
跑
A process in the running state when it is currently running process in the CPU. At a time only one process can be under execution in a single processor.
當(dāng)前正在CPU中運(yùn)行的進(jìn)程時(shí),處于運(yùn)行狀態(tài)的進(jìn)程。 一次只能在一個(gè)處理器中執(zhí)行一個(gè)進(jìn)程。
Wait or block
等待或封鎖
When the process is executed for I/O it moves to the wait or block state.
當(dāng)為I / O執(zhí)行該過(guò)程時(shí),它將進(jìn)入等待或阻止?fàn)顟B(tài)。
Terminated or completed
終止或完成
When the process completed its execution it enters into the terminated state. In this states, all the changes made by the process permanently save on the memory.
進(jìn)程完成執(zhí)行后,將進(jìn)入終止?fàn)顟B(tài)。 在這種狀態(tài)下,該過(guò)程所做的所有更改將永久保存在內(nèi)存中。
Suspended ready
暫停準(zhǔn)備
When the ready queue is full some process move to the suspend ready state so that there is no load on the ready queue.
當(dāng)就緒隊(duì)列已滿時(shí),某些進(jìn)程將移至?xí)簰炀途w狀態(tài),以使就緒隊(duì)列上沒有負(fù)載。
Suspended block
懸浮塊
When the waiting queue is full some processes move to the suspend ready state so that there is no load on the block state.
當(dāng)?shù)却?duì)列已滿時(shí),某些進(jìn)程將移至?xí)簰炀途w狀態(tài),以便在塊狀態(tài)上沒有負(fù)載。
A process is not itself a process it is actually a passive entity so its content is stored in the hard disk whereas a running process is a passive entity so the program counter counts the next instruction to be executed. In the system, two processes may be linked with the same program and these process cannot be considered as two separate processes. For any instances, many users may be running at the main program.
一個(gè)進(jìn)程本身并不是一個(gè)進(jìn)程,它實(shí)際上是一個(gè)被動(dòng)實(shí)體,因此它的內(nèi)容存儲(chǔ)在硬盤中,而正在運(yùn)行的進(jìn)程是一個(gè)被動(dòng)實(shí)體,因此程序計(jì)數(shù)器會(huì)計(jì)算下一條要執(zhí)行的指令。 在系統(tǒng)中,兩個(gè)進(jìn)程可能與同一程序鏈接,并且這些進(jìn)程不能視為兩個(gè)單獨(dú)的進(jìn)程。 對(duì)于任何情況,許多用戶可能正在主程序上運(yùn)行。
翻譯自: https://www.includehelp.com/operating-systems/process-classification-and-scheduling.aspx
操作系統(tǒng)中的處理機(jī)調(diào)度調(diào)度
總結(jié)
以上是生活随笔為你收集整理的操作系统中的处理机调度调度_操作系统中的流程分类和调度的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 为啥感觉今年的“618”购物节格外冷清?
- 下一篇: 颐和园成人门票多少钱