Review the Linux system programming learning process

Source: Internet
Author: User
Tags mutex posix semaphore

First, the basic knowledge

1, Linux operating system, familiar with the commonly used directives.

2, the use of vim compiler, makefile writing.

3, the user and the rights related knowledge.

4, the concept of environment variables under Linux.

Ii. conceptual relevance of the process

1, the concept of process, understand the concept of PCB, as well as task_struct structure.

2, the creation of the process, fork () and vfork () the difference and contact.

3, the process of waiting, waitpid () and wait (), blocking wait and non-blocking wait.

4, process of the program replacement, Execl (), EXECLP (), Execle (), Execv (), EXECVP (), EXECVLP ().

5 , process termination, exit code concept, low eight bits (abnormal semaphore), secondary low eight bits (normal exit code)

III. Inter-process communication (SYMTEM-V)

1. The concept of kernel buffers and user buffers.

2, the concept of file descriptors and file pointers.

3. Named Pipes with anonymous pipes (communicates with the anonymous pipeline for parent-child processes and two interprocess named pipes)

The features of the anonymous pipe (pipe), which are associated with the file flow pattern, the life cycle and the process, can only support one-way communication between related processes, named pipes (Ring buff) (fifo,mkfifo,mkmod) feature (which enables communication between different processes).

4. Message Queuing (implementing mutual messages between two processes client and server)

Msgget (), Ftok (), Msgctl (), MSGRCV (), msgsnd (), Message Queuing features (based on message packet-oriented communication mode, lifecycle and kernel affinity, bidirectional communication).

5. Semaphore (communication for a parent-child process)

First of all, the concept of critical resources and critical areas, the signal is implemented under atomic operation, the SYSTEM-V version of the signal volume is not transmitted data only for control, SENBUF structure, Semun Union,

Semset (), Semctl (), SEMOP () operation.

6. Shared Memory ( implementation of mutual messages between two processes client and server )

Features (the most efficient way to communicate, you need to maintain synchronization and mutual exclusion). Shmget (), Shmctl (), Shmat (), SHMDT ().

Iv. Threading Concepts (POSIX standard)

1, thread and process of the difference and contact.

2, the creation of threads, Pthread_create ().

Wait for thread, Pthread_join () blocking mode.

Thread returns, thread internal return, use Pthread_exit () to exit a thread, use Pthread_cancel () to cancel a thread.

The separation of threads, PTHREAD_DECTH () separated threads will manage their own resource processes without blocking the wait.

3. Synchronization and mutual exclusion of threads

1> Mutex: The mutex of the thread.

Pthread_mutex_lock (), Pthread_mutex_unlock (), pthread_mutex_destory ()

2> producer consumer model, deadlock concept, 4 necessary conditions for deadlock generation, using condition variables and

Mutex implements a producer consumer model.

3>posix version of the volume of the SEM, the Unit for the signal volume is different from the System_v version of the semaphore set. Sem_init (), sem_wait (), Sem_post () (Multi-producer multi-consumer model under the ring array buff).

4> read-write lock, read and write priority issues.

Five, the Linux signal

1, Kill-l common signal 1-31, real-time signal 34-64.

2, the signal production mode, keyboard, hardware and software, Kill (), Alarm (), Abort (), raise () and so on.

3, the signal processing mode, ignore, perform the default action, perform a custom action.

4, signal pending and signal delivery. Pending,block,handler table in Task_struct.

5, signal set sigset_t, signal processing function sigemptyset (), Sigaddset (), Sigpromask (),

Sigpending (). (shield 2nd signal Output current pending set, remove the screen)

6, the signal capture, signal (), sigaction (). (Simulated sleep)

7, the signal processing flow, the user state and the kernel state switch scene.

Vi. operation control and daemon process

1, the process group, the shell under the job control, the concept of conversation.

2, control terminal (Tty,pts,pty), Init under the 7 start mode, user login process, job control, FG command, bg% command.

3, the concept of daemon, crond system process of writing, Setsid (), the creation of the daemon process.



Read books, in-depth understanding of computer systems, UNIX advanced environment programming

This article is from the "Traces" blog, be sure to keep this source http://wpfbcr.blog.51cto.com/10696766/1772842

Review the Linux system programming learning process

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.