"Advanced Programming for UNIX environment" learning experience

Source: Internet
Author: User

Most of this article is from the UNIX environment advanced programming, with some personal experience.


1. UNIX Architecture

In a strict sense, the operating system can be defined as a software that controls computer hardware resources and provides a program run environment.
We often refer to this software as the kernel (kernel) because it is relatively small and is located at the core of the environment. Displays the UNIX architecture.


The kernel interface is called system call. The Public function library is built on top of the system invocation interface, where the application can consume both a common function library or a system call.
The shell is a special application that provides an interface for running other applications.

Broadly speaking, the operating system includes kernels and other software.

2. Login

When a user logs on to a UNIX system, type the login name, and then type the login password. The system views the login name in its password file (usually the/etc/passwd file).
The login entry in the password file consists of seven fields separated by a colon, followed by: login, encrypted password, numeric user ID, number group ID, comment field, start directory, and Shell program (which I understand as permissions for system calls)

Root:*:0:0:system administrator:/var/root:/bin/sh
Name: Secret: User: Group: note: Eye: Shell

Inventions: Ming confused rental wooden shoes

3. Files and directories

3.1 File system
The Unix file system is a hierarchical structure (tree structure) of directories and files, where everything starts with the root (root) directory and the root directory is the name "/".
3.2 File name
Each name in the directory is called the file name (filename). Only the slash (/) and null characters cannot appear in the file name. A slash is used to split a path, and a space is used to terminate a path name.
3.3 Path name
A sequence of one or more filenames separated by a slash (which can begin with a slash) to form the path name (pathname), the path with a slash to the name of the absolute path (absolute pathname), otherwise known as the relative pathname (relative pathname).

4. Procedures and processes

4.1. Procedure:

Program is an executable file stored in a directory on disk. The kernel uses the Exec book to read the program into memory and execute the program.

4.2. Process and Process ID

A program execution instance is called a process. The UNIX system ensures that each process has a unique numeric identifier, a process ID, and that the process ID is always a non-negative integer.

4.2.1, Process Control

There are three main functions for controlling the process: fork, exec, Waitpid.

4.3. Thread and thread ID

Thread: The basic unit of resource execution

Thread ID: Uniquely identifies a thread in a process that is only valid in the owning process, and the thread ID of one process is meaningless in another process.

Note: Threads can share the same address space, file descriptors, stacks, and process-related properties.

"Advanced Programming for UNIX environment" learning experience

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.