Linux: Pre-summary

Source: Internet
Author: User

1. Common instructions and permission comprehension

One.

Computer architecture

Von Neumann architecture: Input device, memory (controller, operator). Output device.

Environment variables:

Path,home,logname,shell,hostname (environmental Directive)

ECHO,EXPORT,ENV,SET,UNSET,READONLY (environment variable setting)

Linux File types:

Normal file [-], directory file [d], connection file [L], device and device file [b], socket [s], pipe file [P].

Concept: Super users and ordinary users, Shelle how to run the program.


Two. Linux Rights Management:

chmod, Chgrp, Chown, Umask. Sudo

Various directives:

LS, CD, date, Cal, Touch, mkdir, PS, Jobs, IPC, RMDIR, CP, MV, BaseName,

DirName (processing path, returning parent), more, less, head, tall, file.

To find a file:

Which,find,whereis,grep

Gzip,zcat,tar,pwd,cat, sort, uniq, who, TTY, Kill,diff.

2.Linux Environment Construction

Vim Editor:

Vim has the mode, vim common operation keys, VIMRC configuration.

The use of gcc,g++,gdb, the use of ctags, the use of makefile.

3.Linux: Process


Process Concepts,

Process description (PCB),

Process identifier (PID,PPID,),

process location, environment variable.

Process status: Running state, sleep state, disk hibernation state, dead state, zombie state.

Attach (orphan process, zombie process).

Process priority: Pri,ni

Process termination mode: Exit,return _exit,_exit,atexit.

The memory address of the stack frame is stored specifically.

Process identifier:

#include <sys/types.h> #include <unistd.h>pid_t getpid (void); Return value: Process idpid_t getppid (void) of the calling process; Return value: The parent process of the calling process iduid_t getuid (void); Return value: The actual user of the calling process iduid_t geteuid (void); Return value: The active user of the calling process idgid_t getgid (void); Return value: The actual group of the calling process idgid_t getegid (void); Return value: The valid group ID of the calling process

Actual user and active User: basic concept, Gid,uid

Process creation:

#include <unistd.h>pid_t fork (void);p id_t vfork (void);

The difference between fork and vfork creation, the parent-child process.

Process wait: Basic concepts

#include <sys/types.h> #include <sys/wait.h>pid_t wait (int*status);p id_t waitpid (pid_t pid, int *status, int options);

Various parameters, blocking and non-blocking.


Process program substitution:

#include <unistd.h>int execl (const char *path, const char *arg, ...); int EXECLP (const char *file, const char *arg, ...);  int execle (const char *path, const char *arg, ..., Char *const envp[]); int execv (const char *path, char *const argv[]); int EXECVP (const char *file, char *const argv[]); int execve (const char *path, char *const argv[], char *const envp[]);

3. Inter-process communication

The basic realization concept of inter-process communication, thought


Pipeline:

#include <unistd.h>int pipe (int filedes[2]);

Piping restrictions, 4 special states of piping.


Named pipes:

Command creation: Mknod namedpipe

#include <sys/types.h> #include <sys/stat.h>int mknod (const char *path,mode_t mod,dev_t dev); int Mkfifo ( const char *path,mode_t mode);

XSI IPC (System V)


Message Queuing:

Basic concepts, IPC object data, Message queue structure

Function:

int Msgget (key_t key, int msgflg); ssize_t msgrcv (int msqid, void *msgp, size_t msgsz, Long Msgtyp, INTMSGFLG); int msgsnd (i NT Msqid, const void *MSGP, size_t msgsz, int msgflg);

Msgstru:

struct Msgstru{long mtype;//greater than 0char mtext[user-specified size];};
int msgctl (int msgqid, int cmd, struct msqid_ds *buf);

key_t

Ftok ():

# include <sys/types.h># include <sys/ipc.h>key_t ftok (const char *pathname, int proj_id);

Signal Volume:

mechanism, working principle.

The calling program must define the union as follows:

Union Semun {

int Val; The value used

struct Semid_ds *buf; Ipc_stat, Ipc_set use buffer

unsigned short *array; GETALL, SETALL used array

struct Seminfo *__buf; Ipc_info (Linux-specific) using buffers

};

Various operating functions of the semaphore:


Shared Memory:

Basic functions and concepts.


4. Threads

Thread concepts and thread-to-process differences and linkages. Difference.

Thread creation, thread creation related functions.

Thread Waits

Thread termination

Thread separation

Thread synchronization and mutex: Mutex mutex, cindition condition variable, (POSIX version) semaphore

Example: Producer and consumer models, reader-writer models (read-write locks), spin locks

The generation and avoidance of deadlock

4. Signal

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7F/F8/wKiom1cy4rfiOiAuAAFt_F48FqE691.png "alt=" Wkiom1cy4rfioiauaaft_f48fqe691.png (657x512) "/>

1). Signal, signal recursion, signal pending concept, signal generation processing.

2). Generate signal: 3 ways.

3). The signal is represented in the kernel and a signal is obtained and modified in the signal set (block table, pending table, Handler table).

and the associated operation functions

4). Signal capture, signal customization, signal non-atomic operation avoidance.

5). reentrant Functions and thread safety

6). Race condition

7) SIGCHLD.

Inter-process relationships, endpoints, jobs, daemons.


This article is from the "egg-left" blog, please be sure to keep this source http://memory73.blog.51cto.com/10530560/1773584

Linux: Pre-summary

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.