4

我只是在阅读有关系统程序(有时称为系统实用程序)的信息。然后我心里有个疑问,系统调用和系统程序有什么区别??

4

4 回答 4

4

A system call looks like a function that is called from a program. Examples of system calls include:

A system utility is a complete program that you execute from a shell prompt, from within a shell script, or (possibly confusingly) via the system() function in C (which in turn uses, amongst other system calls, fork() and execv()).

Example commands (system utilities) include:

Thus, system calls are used within programs; system utilities are programs.

于 2013-08-17T02:22:56.893 回答
1

System programs are executable files while system calls are C routines which interact with operating system features and can be compiled into system programs.

For example 'ls' and '/bin/hostname' are executable system programs:

sh-3.2$ ls -l /bin/hostname
-rwxr-xr-x  1 root  wheel  14304 Jul 14 11:03 /bin/hostname
sh-3.2$ /bin/hostname
mycomputer

If you look at the man page for hostname it will refer you to 'gethostname(3)' which is a C system call, and in fact the same call used to provide the output for the hostname program.

于 2013-08-17T02:24:54.937 回答
0

系统调用是将在用户和内核之间调用的函数列表。但系统程序是可以做系统工作的程序,例如:更改系统设置。访问注册表。访问内存。访问磁盘等。

于 2015-10-25T23:05:18.053 回答
0

系统调用提供了进程和操作系统之间的接口。系统调用允许用户级进程向操作系统请求一些服务,而这些服务本身是不允许的。在处理陷阱时,操作系统会进入内核模式,在这里它可以访问特权指令,可以代表用户级进程执行所需的服务。

于 2019-06-02T06:34:56.447 回答