Linux Operating System Basics

Source: Internet
Author: User

Kernel (Kernel):

Operating systems in Linux, with a focus on managing all the activities of the computer and all the hardware in the drive system

ABI (Application Binary Interface):

The application binary interface describes the low interface between an application and the operating system, between an application and its libraries, or the components of an application.

API (Application programming Interface):

Application programming interfaces are pre-defined functions that provide the ability for applications and developers to access a set of routines based on a piece of software or hardware without having to access the source code or understand the details of the internal working mechanism.

User space:

User program run space, can only perform simple operation, cannot directly invoke system resources, must pass the system call, to send instructions to the kernel

Kernel spaces (Kernel space):

The running space of the Linux kernel can execute arbitrary commands and invoke all the resources of the system.

System call:

An application running in user space requests the operating system kernel to request some services for the calling process. System calls provide an interface between the user program and the operating system. In general, system calls are performed in the kernel state. Because system calls do not account for platform differences, they are provided directly by the kernel and are therefore poorly ported (almost non-portable).

Context Switch:

Refers to the CPU switching from one process or thread to another process or thread. Will sacrifice CPU efficiency

Library functions (Libraries function):

is a set of functions developed by the user or the organization, which has a certain function, and generally has a good platform portability, providing functional calls to programmers through library files (static libraries or dynamic libraries). Programmers do not have to care about platform differences, and the library masks platform differences.

Difference
function Library calls system Calls
In all ANSI C compiler versions, the C library functions are the same. Good portability of the platform System calls are different for each operating system. Relies on the kernel, does not guarantee the portability
It calls a program (or function) in the library. It calls the service of the system kernel
Associated with the user program is an entry point for the operating system
Execute in user address space Executing in the kernel address space
Its run time is "User Time" Its run time is "system time"
is a procedure call and the call cost is small Need to switch between user space and kernel context environment, overhead is large
There are about 300 functions in the C function library libc There are about 90 system calls in Unix
Typical C function library calls: System fprintf malloc Typical system call: chdir Fork Write brk;

Example:
str = “July”     //用户空间x = x+100      //用户空间file.write(str) //切换到内核空间y = x+200  //切换回用户空间

The first and second rows are simple assignment operations that are performed in user space. The third line needs to write to the file, switch to kernel space, because the user cannot write directly to the file, must be arranged through the kernel. The row four is the assignment operation and switches back to the user space.

Linux Operating System Basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.