操作系统系统调用_操作系统中的系统调用

操作系统系统调用

系统调用简介 (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.mzph.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…