操作系統系統調用_操作系統中的系統調用

操作系統系統調用

系統調用簡介 (Introduction to System calls)

The interface between the operating system and the user program is defined by the set of extended instruction that the operating system provides. These extended instructions are known as system calls. User program communicates with the operating system and request services from if by making system calls. There exist a library procedure corresponding to each system call that the user program can call. System call allows user-level processes to required services of the operating system. This procedure put the parameter of the system call in a specified place, such as the machine registers, and then issue TRAP instructions to start the operating system. When the operating system gets control after TRAP it examines the parameters to see if they are valid and if so perform the work requested. When it is finished the operating system puts a status code in a register telling whether it succeed or failed and execute a RETURN FROM TRAP instructions to return control back to the library procedure. The library procedure then returns to the caller in the usual way, returning the status code as a function value.

操作系統和用戶程序之間的接口由操作系統提供的一組擴展指令定義。 這些擴展指令稱為系統調用 。 用戶程序與操作系統進行通信,并通過進行系統調用來請求服務。 存在與用戶程序可以調用的每個系統調用相對應的庫過程。 系統調用允許用戶級進程訪問操作系統所需的服務。 此過程將系統調用的參數放在指定的位置(例如,機器寄存器),然后發出TRAP指令以啟動操作系統。 當操作系統在TRAP之后獲得控制權時,它將檢查參數以查看它們是否有效,并執行所需的工作。 完成后,操作系統將狀態碼放入寄存器中以告知其成功還是失敗,然后執行RETURN FROM TRAP指令將控制權返回給庫過程。 然后,庫過程以通常的方式返回到調用者,將狀態碼作為函數值返回。

Any operation perform in the system require the system and if any error occurs in the system it needs additional system calls for solving the errors. Suppose if any program wants to open a file and the file of that name may not exist in the system, in this case, the program print a message on the console window that the file does not exists all these things done by the system calls. System calls are callable from the assembly language. We have often encountered phrase such as “ assembly language under DOS”. We should now be clear about its meaning. The assembly language programmer needs to know the assembly language instructions set for that machine. In addition, he normally needs to aware of the system calls of the operating system running on that machine. Many high-level languages such as C and also enables the system calls to be embedded explicitly in the midst of other statements. Some high-level language such as JAVA or C++ does not need the explicit use of system calls embedded in other statements. In these scenarios the compiler substitutes system calls at specific locations.

系統中執行的任何操作都需要系統,并且如果系統中發生任何錯誤,則需要其他系統調用來解決錯誤。 假設有任何程序要打開文件,而系統中可能不存在該名稱的文件,在這種情況下,該程序會在控制臺窗口上打印一條消息,指出該文件不存在系統調用完成的所有操作。 可以從匯編語言調用系統調用 。 我們經常遇到諸如“ DOS下的匯編語言”之類的短語。 現在,我們應該清楚其含義。 匯編語言程序員需要知道該機器的匯編語言指令集。 另外,他通常需要知道該計算機上運行的操作系統系統調用 。 許多高級語言(例如C)還使系統調用可以顯式地嵌入到其他語句中。 某些高級語言,例如JAVA或C ++,不需要顯式使用嵌入在其他語句中的系統調用 。 在這些情況下,編譯器在特定位置替換系統調用

The two-parameter will be substituting various sets of operations system calls for the same source's statements such a fread, fwrite or execute. Generally, the mapping between the system calls of two operating system is never straightforward. Normally before the real system calls, the compiler produces machine instructions which are preparatory instructions for that system call.

這兩個參數將用操作系統調用的各種集合替換同一源的語句,例如fread,fwrite或execute。 通常,兩個操作系統的系統調用之間的映射從來都不是簡單的。 通常,在實際系統調用之前,編譯器會生成機器指令,它們是該系統調用的準備指令。

系統調用的類型 (Types of system calls)

System calls can be grouped into five categories- process control, file management, device management, information management, and communication.

系統調用可以分為五類: 過程控制文件管理設備管理信息管理通信

1.過程控制 (1. Process control)

A process or the job which is currently run in the system always want to load and execute another program. The command interpreter executes a program for example when the user clicks on the mouse button. Now the question arises that when the loaded program terminates when the control return. When any new program terminates in the system the memory the currently running program must be saved. So in this way we can efficiently create a program which calls another program and both are running concurrently. For the multiprogramming, we have created jobs or process. So the system calls for this purpose is called create a process or submit the job. When a new job, process or the group of the process is created then we have to manage the execution of these process.

當前在系統中運行的進程或作業總是要加載并執行另一個程序。 例如,當用戶單擊鼠標按鈕時,命令解釋器將執行程序。 現在出現的問題是,當加載的程序在控件返回時終止。 當任何新程序在系統中終止時,必須保存當前正在運行的程序。 因此,通過這種方式,我們可以有效地創建一個程序,該程序調用另一個程序,并且兩個程序同時運行。 對于多程序,我們創建了作業或過程。 因此,為此目的而進行的系統調用稱為創建流程或提交作業。 創建新作業,流程或流程組時,我們必須管理這些流程的執行。

2.文件管理 (2. File management)

In the file management system, we should be able to create or delete the files. For creating a file the system call requires the names of the file and some attribute of the files. When the file is created we should be able to open and use these files. We can also read-write or reposition the files. After all the work is done we need to close the file which indicates that the file is no longer need. We can also use these operations for directories also. In the file management system, we should be able to determine the values of various attributes for the file and directories. There are various file attributes like name, types, size, location, accounting information and so on. The two important system calls get attribute and file set attribute is required for this function.

在文件管理系統中,我們應該能夠創建或刪除文件。 為了創建文件,系統調用需要文件名和文件的某些屬性。 創建文件后,我們應該能夠打開和使用這些文件。 我們還可以讀寫文件或重新放置文件。 完成所有工作后,我們需要關閉文件,這表明不再需要該文件。 我們也可以將這些操作用于目錄。 在文件管理系統中,我們應該能夠確定文件和目錄的各種屬性的值。 有各種文件屬性,例如名稱,類型,大小,位置,記帳信息等。 此功能需要兩個重要的系統調用get屬性和file set屬性。

3.設備管理 (3. Device management)

When the program is running in the system it needs some resources such as memory, input, output, and so on. The resources are only granted when they are available and not held by another process. If the resources are not free the program has to wait for the resources. Files are the abstract or virtual devices. So there are many system calls which are needed for the files and also for the devices. If there are multiple users then first it requests for the devices and after finishing the work with these devices we should release it. When the devices are allocated to the user then we can perform different operations like reading, write and execute.

當程序在系統中運行時,它需要一些資源,例如內存,輸入,輸出等。 僅當資源可用且不由另一個進程持有時才授予資源。 如果沒有釋放資源,則程序必須等待資源。 文件是抽象或虛擬設備。 因此,文件和設備都需要許多系統調用。 如果有多個用戶,則首先請求設備,完成這些設備的工作后,我們應該釋放它。 將設備分配給用戶后,我們可以執行不同的操作,例如讀取,寫入和執行。

4.信息管理 (4. Information management)

In information management, various system calls are used to communicate the information between the operating system and user program. For example, some system has a system call forget the current time or date. There are many another system call like for the number of the user, different versions of operating system., free space in memory etc.

在信息管理中,各種系統調用用于在操作系統和用戶程序之間傳遞信息。 例如,某些系統有一個系統調用會忘記當前時間或日期。 還有許多其他系統調用,例如用戶數量,操作系統的不同版本,內存中的可用空間等。

5.溝通 (5. Communication)

There are mainly two models for communication. First is the message passing model in this the information is exchanged between the process and this communication facility is provided by the operating system. When the process wants to communicate first the other communicator should be know so that the communication is established and they can communicate. Second is the shared memory model in this model different process shared memory and communicate with each other.

主要有兩種通信模型。 首先是消息傳遞模型,其中信息在進程之間交換,并且該通信工具由操作系統提供。 當該過程首先要進行通信時,應該知道其他通信者,以便建立通信并可以進行通信。 其次是共享內存模型,在此模型中不同進程共享內存并相互通信。

翻譯自: https://www.includehelp.com/operating-systems/system-calls-in-operating-system.aspx

操作系統系統調用

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

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

相關文章

java分數表示_表示Java分數的最佳方法?

小編典典碰巧的是不久前我寫了一個BigFraction類,用于解決Euler項目問題。它保留了BigInteger分子和分母,因此它將永遠不會溢出。但是,對于許多你永遠不會溢出的操作來說,這會有點慢。無論如何,請根據需要使用它。我一…

《OpenStack云計算實戰手冊(第2版)》——1.7 添加用戶

本節書摘來自異步社區《OpenStack云計算實戰手冊(第2版)》一書中的第1章,第1.7節,作者: 【英】Kevin Jackson , 【美】Cody Bunch 更多章節內容可以訪問云棲社區“異步社區”公眾號查看。 1.7 添加用戶 在OpenStack身份認證服務中…

開源軟件和自由軟件_自由和開源軟件的經濟學

開源軟件和自由軟件零邊際成本 (Zero Marginal Cost) At the core of the financial aspects of Free and Open Source is the zero negligible expense of merchandise in an environment that is digital. Right now, the rise of Free and Open Source speaks to an affirma…

java外部類_Java里什么叫內部類什么叫外部類

展開全部對普通類(沒有內部類的類)來說,62616964757a686964616fe78988e69d8331333337396234內部類和外部類都與他無關;對有內部類的類來說,它們就是其內部類的外部類,外部類是個相對的說法,其實就是有內部類的類。所以…

《精通Matlab數字圖像處理與識別》一6.2 傅立葉變換基礎知識

本節書摘來自異步社區《精通Matlab數字圖像處理與識別》一書中的第6章,第6.2節,作者 張錚 , 倪紅霞 , 苑春苗 , 楊立紅,更多章節內容可以訪問云棲社區“異步社區”公眾號查看 6.2 傅立葉變換基礎知識 精通Matlab數字圖像處理與識別要理解傅立…

多線程循環輸出abcc++_C ++循環| 查找輸出程序| 套裝5

多線程循環輸出abccProgram 1: 程序1&#xff1a; #include <iostream>using namespace std;int main(){int num 15673;int R1 0, R2 0;do {R1 num % 10;R2 R2 * 10 R1;num num / 10;} while (num > 0);cout << R2 << " ";return 0;}Ou…

java oql_深入理解java虛擬機(八):java內存分析工具-MAT和OQL

以下內容翻譯自MAT幫助文檔。一、Class HistogramClass Histogram shows the classes found in the snapshot, the number of objects for each class, the heap memory consumption of these objects, and the minimum retained size of the objects二、Dominator treeDomina…

《Python數據分析與挖掘實戰》一1.2 從餐飲服務到數據挖掘

本節書摘來自華章出版社《Python數據分析與挖掘實戰》一書中的第1章&#xff0c;第1.2節&#xff0c;作者 張良均 王路 譚立云 蘇劍林&#xff0c;更多章節內容可以訪問云棲社區“華章計算機”公眾號查看 1.2 從餐飲服務到數據挖掘 企業經營最大的目的就是盈利&#xff0c;而餐…

obj[]與obj._Ruby中帶有示例的Array.include?(obj)方法

obj[]與obj.Ruby Array.include&#xff1f;(obj)方法 (Ruby Array.include?(obj) Method) In the previous articles, we have seen how we can check whether two Array instances are identical or not with the help of <> operator, operator, and .eql? method?…

java javah_Java開發網 - 一個javah的問題

Posted by:jerry_xuPosted on:2006-03-13 15:39我在環境變量中已經設置了path為D:\Program Files\Java\jdk1.5.0_06&#xff0c;ClassPath設置為.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;class的路徑為&#xff1a;D:\JNItest\bin\jni\Hello.class &#xff0c;但是…

《Python面向對象編程指南》——2.7 __del__()方法

本節書摘來自異步社區《Python面向對象編程指南》一書中的第2章&#xff0c;第2.7節&#xff0c;作者&#xff3b;美&#xff3d;Steven F. Lott&#xff0c; 張心韜 蘭亮 譯&#xff0c;更多章節內容可以訪問云棲社區“異步社區”公眾號查看。 2.7 __del__()方法 __del__()方…

NullReferenceException C#中的異常

什么是NullReferenceException&#xff1f; (What is NullReferenceException?) NullReferenceException is an exception and it throws when the code is trying to access a reference that is not referencing to any object. If a reference variable/object is not refe…

java map key 大寫轉小寫_Spring JdbcTemplate 查詢出的Map,是如何產生大小寫忽略的Key的?(轉)...

Java 是區分大小寫的&#xff0c;普通的Map例如HashMap如果其中的key"ABC" value"XXX"那么map.get("Abc") 或 map.get("abc")是獲取不到值得。但Spring中產生了一個忽略大小寫的map使我產生了好奇例如 jdbcTemplate.queryForList(sql)…

《iOS 6核心開發手冊(第4版)》——2.11節秘訣:構建星星滑塊

本節書摘來自異步社區《iOS 6核心開發手冊&#xff08;第4版&#xff09;》一書中的第2章&#xff0c;第2.11節秘訣&#xff1a;構建星星滑塊&#xff0c;作者 【美】Erica Sadun&#xff0c;更多章節內容可以訪問云棲社區“異步社區”公眾號查看 2.11 秘訣&#xff1a;構建星星…

css框架和js框架_優雅設計的頂級CSS框架

css框架和js框架Brief discussion: 簡要討論&#xff1a; Well, who doesnt want their website or web page to look attractive, stylish and be responsive? 那么&#xff0c;誰不希望自己的網站或網頁看起來有吸引力&#xff0c;時尚并且ReactSwift&#xff1f; We put …

軟考下午題具體解釋---數據流圖設計

在歷年的軟考下午題其中&#xff0c;有五道大題。各自是數據流圖的設計&#xff0c;數據庫設計&#xff0c;uml圖&#xff0c;算法和設計模式&#xff0c;從今天這篇博文開始&#xff0c;小編就跟大家來一起學習軟考下午題的相關內容。包含理論上的知識以及典型例題的解說&…

基本程序 打印Scala的Hello World

Scala中的基本程序 (Basic program in Scala) As your first Scala program, we will see a basic output program that just prints "Hello World" or any other similar type of string. With this example, we will see what are the part of the code that is im…

java treemap lastkey_Java TreeMap lastKey()用法及代碼示例

java.util.TreeMap.lastKey()用于檢索Map中存在的最后一個或最高鍵。用法:tree_map.lastKey()參數&#xff1a;該方法不帶任何參數。返回值&#xff1a;該方法返回映射中存在的最后一個鍵。異常&#xff1a;如果映射為空&#xff0c;則該方法將引發NoSuchElementException。以下…

mysql屬于數據庫三級模式_數據庫系統的三級模式指的是什么

數據庫系統的三級模式指的是什么發布時間&#xff1a;2020-10-26 10:11:21來源&#xff1a;億速云閱讀&#xff1a;52作者&#xff1a;小新小編給大家分享一下數據庫系統的三級模式指的是什么&#xff0c;希望大家閱讀完這篇文章后大所收獲&#xff0c;下面讓我們一起去探討吧&…

《自頂向下網絡設計(第3版)》——導讀

目錄 第1部分 辨明客戶的需求和目標 第1章 分析商業目標和制約 1.1 采用自頂向下的網絡設計方法 1.2 分析商業目標 1.3 分析商業制約 1.4 商業目標檢查表 1.5 小結 1.6 復習題 1.7 設計環境 第2章 分析技術目標與折衷措施 2.1 可擴展性 2.2 可用性 2.3 網絡性能 2.4 安全性 2…