OS-02 Functions and Structures

Overview

Operating systems provide an environment for program executions and services to programs/users

overview

Functions

User Interface

Shell: A computer program that exposes an OS’s services to a human user or other programs. OS shells use either a command-line interface (CLI) or a graphical user interface (GUI)
An interpreter

CLI

Shell:

  • Built-in commands: The interpreter contains the code to execute the command.
    • Executed directly, e.g. cd
  • System program commands: The command is a program name.
    • Looks up the system file and executes it, e.g. ls

System Calls

Mode

  • User
  • Kernel
    Transitions: system calls, interrupts, exceptions

API

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

  • Easy to use: no need to understand the underlying implementation, just call it
  • Portable: the API is compatible across platforms
  • Secure: direct calls interact with the kernel

Parameter Passing

  • Registers: fast, but few
  • Memory table
  • Stack

The last two methods do not limit the number or length of parameters being passed, at a performance cost

Types

Type 1: Process control
  • Control the current process: end, abort, execute, load…
  • Control a different process
  • Allocate memory and release memory
  • Debugger
  • Locks for managing access to shared data between processes
Type 2: File management
Type 3: Device management
Type 4: Information maintenance
Type 5: Communications
  • message passing model: relayed through the kernel, discrete
  • shared-memory model: shares physical memory
Type 6: Protection

System Services

In computer hierarchy, system services are higher than system calls.

System services use system calls to interact with the OS kernel

Programs

  • System Programs: Login program, shell, window manager
  • Application Programs: Email, web browsers, gaming software, word processors

Why Applications are Operating System Specific:

Reason: Each operating system provides its own unique system calls

e.g. file format

Services

  • File management
  • Status information
    • Some systems implement a registry - used to store and retrieve configuration information
  • File modification
  • Programming-language support
  • Program loading and execution
  • Communications
  • Background Services
    • Known as services, subsystems, daemons

Operating System Structures

  • Simple Structure – MS-DOS
  • Monolithic Structure – Original UNIX
  • Layered Approach
  • Microkernel System Structure - Mach
  • Hybrid Systems - windows, macOS, Android

Virtual Machines

visulization

Summary

topics


Translated from the Chinese original.

Welcome to my other publishing channels

中文