接口?(Interface)
Interface: electrical circuit linking one device with
another and enabling data coded in one format to
be transmitted in another
什么是操作系统接口
- 连接上层用户和操作系统软件,使用操作系统
用户如何使用计算机
命令行
在Linux下使用命令行很常见,如:
#include <stdio.h>
int main(int argc, char * argv[])
{ printf(“ECHO:%s\n”, argv[1]); }
在Linux中,shell 也是一段程序,在系统启动到最后就会调用一段shell程序,即:/bin/sh
shell的主程序:
int main(int argc, char * argv[])
{ char cmd[20];
while(1) { scanf(“%s”, cmd);
if(!fork()) {exec(cmd);}
else {wait();} } //while(1)
}
图形按钮
在windows系统下更多的是使用图形按钮和应用程序。其实也可以在Linux0.11上也可以实现图形界面。所谓图形化界面主要实现消息队列,在应用程序中通过一个函数再从内核中调出消息执行。
系统调用
操作系统的接口重点在于调用一些C代码+重要函数,实现对硬件、OS的使用。一旦调用这些函数就进入到操作系统内部(system_call)。
POSIX( Portable Operating System Interface of Unix(IEEE制定的一个标准族)定义了常用的系统调用函数,如下图所示: