操作系統中的處理機調度調度_操作系統中的流程分類和調度

操作系統中的處理機調度調度

處理 (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.

在操作系統中,有許多任務和應用程序同時運行。 程序存儲在硬盤或任何其他形式的輔助存儲中。 執行程序時,必須將其加載到系統內存中。 可以將進程視為正在執行的程序。 在系統中,每個進程在創建時都會分配一個唯一的ID,并且唯一ID會引用該ID,直到該進程完成執行并終止為止。 流程是一次執行基本工作單元或一項工作的實體。 我們可以說一個進程是一個正在執行的計算機程序的實例。 一個過程包含程序代碼和將要執行的活動。 當計算機程序位于輔助內存中時,它是一個被動實體,或者當進程位于主內存中時,它是一個主動實體。 在系統中,幾個進程可能與同一程序相關聯。

A process held a number of attributes like hardware, memory, CPU, and progress.

一個進程擁有許多屬性,例如硬件,內存,CPU和進度。

Craft.io分類 (Process classification)

A process can be broadly categorized into the following two types based on its execution:

根據流程的執行情況,大致可將其分為以下兩種類型:

  • I/O-Bound process

    I / O綁定過程

    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的進程是其執行時間主要由其完成I / O操作所花費的時間確定的進程。

  • CPU-Bound process

    CPU綁定進程

    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限制的進程是其執行時間取決于其運行的CPU速度的進程。 如果受CPU約束的進程在更快的處理器上運行,則可以更快地完成其執行。

    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.

    注意:第三類-內存綁定進程。 但是,由于RAM用作處理器的I / O,因此可以將其視為I / O綁定進程類型的實例。

Further a process can be broadly categorized into the following two types based on execution mode.

另外,基于執行模式,可以將處理大致分為以下兩種。

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.

內核模式:在內核模式下,進程可以不受限制地訪問系統硬件,它可以執行特權指令,并且可以訪問用戶和內核地址空間。

Example: Most of the device drivers in the system execute as kernel mode processes.

示例:系統中的大多數設備驅動程序都以內核模式進程執行。

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.

用戶模式:在用戶模式下,它不能直接訪問基礎系統硬件,只能訪問其他進程自己的用戶地址空間,并且不能執行特權指令。

Example: web- browser is executed as a user- mode process.

示例: Web瀏覽器作為用戶模式進程執行。

Craft.io調度 (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.

在計算機系統上,通常有許多進程需要同時執行。 此外,異步執行對執行其所需的資源的請求。 因此,為了處理對包括處理器在內的資源的競爭請求,OS使用了進程調度程序。 進程調度程序為每個進程分配必要的資源及其輪流,以便在CPU上執行。 調度流程的決定由調度算法做出。 調度程序維護三個隊列,以調度進程。

Job queue: The job queue is the set of all processes on the system.

作業隊列:作業隊列是系統上所有進程的集合。

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.

就緒隊列:就緒隊列具有所有加載到主內存中的進程。 這些進程已準備就緒,等待輪到CPU可用時立即執行。

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.

設備隊列:等待I / O設備變得可用的一組進程,例如打印機。 此隊列也稱為阻塞隊列。

Process classification and scheduling in Operating System

流程執行 (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.

當程序加載到內存(進程內存)中并成為一個進程時,可以分為四個部分:堆棧,堆,文本和數據。

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.

堆棧:當局部變量在堆棧中某些空間的內存中被保留時,將堆棧用于局部變量。

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.

堆:堆在系統中用于動態內存分配,并且通過調用new,delete,malloc和free之類的命令進行管理。

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.

數據部分:數據部分是在執行主功能之前進行分配和初始化時由全局變量和靜態變量組成的。

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.

文本部分:啟動程序時,將從系統中的非易失性存儲器中讀取已編譯的程序代碼的文本部分。

Craft.io狀態 (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.

當進程開始執行時,它會更改其狀態或經歷各種狀態。 我們可以通過該過程的當前活動來部分定義一個過程狀態。 每個進程在執行時可能處于一個或多個狀態。

  1. New

    A process is in the new states when it is newly created in the system.

    在系統中新創建進程后,該進程將處于新狀態。

  2. Ready

    準備

    When the process is created it move to the ready state and in this state, the process is ready for their execution.

    創建流程后,它將進入就緒狀態,在此狀態下,流程已準備好執行。

  3. 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.

    當前正在CPU中運行的進程時,處于運行狀態的進程。 一次只能在一個處理器中執行一個進程。

  4. Wait or block

    等待或封鎖

    When the process is executed for I/O it moves to the wait or block state.

    當為I / O執行該過程時,它將進入等待或阻止狀態。

  5. 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.

    進程完成執行后,將進入終止狀態。 在這種狀態下,該過程所做的所有更改將永久保存在內存中。

  6. Suspended ready

    暫停準備

    When the ready queue is full some process move to the suspend ready state so that there is no load on the ready queue.

    當就緒隊列已滿時,某些進程將移至暫掛就緒狀態,以使就緒隊列上沒有負載。

  7. 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.

    當等待隊列已滿時,某些進程將移至暫掛就緒狀態,以便在塊狀態上沒有負載。

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.

一個進程本身并不是一個進程,它實際上是一個被動實體,因此它的內容存儲在硬盤中,而正在運行的進程是一個被動實體,因此程序計數器會計算下一條要執行的指令。 在系統中,兩個進程可能與同一程序鏈接,并且這些進程不能視為兩個單獨的進程。 對于任何情況,許多用戶可能正在主程序上運行。

翻譯自: https://www.includehelp.com/operating-systems/process-classification-and-scheduling.aspx

操作系統中的處理機調度調度

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/380174.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/380174.shtml
英文地址,請注明出處:http://en.pswp.cn/news/380174.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

NX機制及繞過策略-ret2libc

程序&#xff1a; 1.c #include <stdio.h> void exploit() {system("/bin/sh"); } void func() {char str[0x20];read(0,str,0x50); } int main() {func();return 0; }0x01 NX介紹 溢出攻擊的本質在于馮諾依曼計算機模型對數據和代碼沒有明確區分這一先天性缺…

網站SEO策略的制定

在對一個網站做SEO的時候&#xff0c;SEO技術水平類似的人&#xff0c;營銷效果可能天壤之別&#xff0c;這是因為網站SEO策略的制定的不同&#xff01;-----這個是最根本的。 SEO技術非常的簡單&#xff0c;因為SEO不是去尋找搜索引擎的漏洞&#xff0c;而是根據搜索引…

Python | 程序從列表中刪除范圍內的所有元素

Given a list and we have to remove elements in a range from the list in Python. 給定一個列表&#xff0c;我們必須從Python中的列表中刪除范圍內的元素。 刪除列表(開始索引&#xff0c;結束索引) (del list(start_index, end_index)) del() method is used to remove a…

面向對象 (接口 Interface)

1&#xff0c;面向對象(接口的概述及其特點) A:接口概述 從狹義的角度講就是指java中的interface從廣義的角度講對外提供規則的都是接口 B:接口特點 a:接口用關鍵字interface表示 interface 接口名 {}b:類實現接口用implements表示 class 類名 implements 接口名 {}c:接口…

android unbound prefix

少一個命名空間加上就行了&#xff1a;xmlns:android"http://schemas.android.com/apk/res/android" 轉載于:https://www.cnblogs.com/nizuimeiabc1/archive/2011/10/09/4254310.html

【競賽題解】第22次CCF計算機軟件能力認證 B

今天&#xff08;準確說是昨天&#xff0c;一下子就過12點了&#xff09;下午剛參加了CSP認證考試&#xff0c;大概是考了220&#xff08;前兩題AC&#xff0c;第三題太折磨了懶得看了&#xff0c;后面兩題各混了10分&#xff09;&#xff0c;唯一有點參與感的就是B題了&#x…

gbd調試64位程序關鍵

程序&#xff1a; 4.c&#xff1a; #include<stdio.h> void exploit() {system("/bin/sh"); } void main() {char buf[20];gets(buf); }編譯&#xff1a; gcc -no-pie -fno-stack-protector -m64 -o 4.exe 4.cNX保護&#xff0c;棧數據不可執行 使用命令&…

C#全局鼠標鍵盤Hook (備查)

using System; using System.Collections.Generic; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; namespace DCIEngine.FrameWork.Snap { /// <summary> /// 這個類可以讓你得到一個在…

fcfs調度算法_FCFS:先來先服務調度算法

fcfs調度算法The FCFS, which stands for First Come First Serve Scheduling Algorithm, is a non-preemptive scheduling algorithm, which means that if a process once starts executing in the processor, then it cannot be preempted in between the processing. Thus,…

親和數

Problem Description 古希臘數學家畢達哥拉斯在自然數研究中發現&#xff0c;220的所有真約數(即不是自身的約數)之和為&#xff1a; 1245101120224455110&#xff1d;284。 1* 220220&#xff1b;2* 110220&#xff1b;4* 55220&#xff1b;5* 44220&#xff1b;10*20220;…

轉:JNI jstring與c++字符串類型轉換函數

jstring與c字符串類型轉換函數 jstring str2jstring(JNIEnv* env,const char* pat) {//定義java String類 strClassjclass strClass (env)->FindClass("Ljava/lang/String;");//獲取String(byte[],String)的構造器,用于將本地byte[]數組轉換為一個新Stringjmetho…

python字符串轉浮點數_如何在Python中檢查字符串是否為數字(浮點數)?

python字符串轉浮點數Using python it is very to interconvert the datatypes of a variable. A string can be easily converted to an integer or a float. However, asserting a string to be a float is a task by itself. Python provides an option to assert if a stri…

nhibernate學習之三級聯(Ternary Associations)篇

1) 學習目標通過進一步學習Nhibernate基礎知識&#xff0c;掌握用Nhiberate實現對級聯的支持&#xff0c;通過一個簡單的用戶角色權限系統來體驗nhibernate對級聯的強大支持。2&#xff09;開發環境和必要準備 開發環境為:windows 2003,Visual studio .Net 2005,Sql server 200…

【競賽題解】Codeforces Round #715 (Div. 2) C

C. The Sports Festival 題意&#xff1a;對于給定的整型數組aaa&#xff0c;每次選擇其中一個元素aia_iai?&#xff08;不能重復選擇同一元素&#xff09;&#xff0c;每次計算已選擇的元素的極差&#xff08;最大元素減最小元素的差&#xff09;&#xff0c;輸出最后極差和…

C和匯編---sizeof運算符和strlen函數

sizeof sizeof是C語言的內置運算符&#xff0c;以字節為單位給出指定類型的大小。 程序&#xff1a; #include <stdio.h>int main(void) {int a8;int b sizeof(a);//printf("a占用字節%u\n",sizeof(a));printf("a占用字節%d\n",b);return 0; }反匯…

Java接口程序練習

題目&#xff1a; 編寫一個接口程序&#xff0c;其中定義一個計算體積的方法。然后&#xff0c;在設計應用程序實現這個接口&#xff0c;分別計算矩形柱面體積和圓形柱面體積。 代碼如下&#xff1a; import java.util.*;//導入掃描儀&#xff1b; public class clown {publi…

[原]Asp.net替換不同版本的Dll文件碰到的問題以及解決辦法.

情景還原: 今天一個朋友說網站不能上傳圖片,我檢查后發現一直卡住在上傳頁面,一直滾動,是個Fckeditor控件2.6.3的. 經過google以后得到的結論是圖片上傳成功,但是沒有返回結果,在服務器上可以看到上傳的圖片. 說明是上傳控件有問題,程序不能返回結果. 再google以后發現有人已經…

疊筐

Problem Description 需要的時候&#xff0c;就把一個個大小差一圈的筐疊上去&#xff0c;使得從上往下看時&#xff0c;邊筐花色交錯。這個工作現在要讓計算機來完成&#xff0c;得看你的了。 Input 輸入是一個個的三元組&#xff0c;分別是&#xff0c;外筐尺寸n&#xff…

“Visual Studio.net已檢測到指定的Web服務器運行的不是Asp.net1.1版。您將無法運行Asp.net Web應用程序或服務”問題的解決方案...

解決方案一&#xff1a; 1.確定有安裝.net framework 1.1&#xff0c;可以查看目錄&#xff0c;c:\winnt\microsoft.net\framework重啟IIS&#xff0c;重啟計算機&#xff08;常規糾錯方法&#xff09; 2.如果你的Web服務器使用了固定IP&#xff1a;確定你的“Internet信息服務…

【桶】220.存在重復元素 III 【LeetCode】

220.存在重復元素 III 【LeetCode】 給你一個整數數組 nums 和兩個整數 k 和 t。請你判斷是否存在 兩個不同下標i和j&#xff0c;使得 abs(nums[i] - nums[j]) < t&#xff0c;同時又滿足 abs(i - j) < k。 如果存在則返回 true&#xff0c;不存在返回 false。 示例 1…