Skip to content

Chapter 2: Operating-System Structures

:material-circle-edit-outline: 约 295 个字 :material-clock-time-two-outline: 预计阅读时间 1 分钟

2.1 Operating System Services

image-20240924144439371

  • User interface
    • CLI, GUI
  • Program execution
    • load a program into memory and to run that program, end execution
  • I/O operations
  • File-system manipulation
  • ......

2.2 User and Operating System Interface

Operating System Interface

Command Interface (命令接口)

Program Interface (程序接口,system call)

User interface

CLI, GUI, ...

2.3 System Calls

系统调用、程序接口

System calls are the programming interface between processes and the OS kernel, programming interface to the services provided by the OS

比如 C 刚学的 fork()

Informally, a system call is similar to a function call, but the function implementation is inside the OS, or we name it the OS kernel

image-20240924150205944

API

Syscall are mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use.

应用编程接口(API)其实是一组函数定义这些函数说明了如何获得一个给定的服务

而系统调用是通过软中断向内核发出一个明确的请求,每个系统调用对应一个封装例程(wrapper routine,唯一目的就是发布系统调用)。

系统调用的实现是在内核完成的,而用户态的函数是在函数库中实现的

image-20240924150027952

系统调用与库函数的区别

If they are not system calls, then they are function calls!

image-20240924150444853

Those functions are usually packed inside an object called the library file

image-20240924150546382

后面还没看