Abstract: This section describes some basic operations on a process. Through this section, we will learn how to generate a sub-process, how the process changes its execution image, and synchronization of parent and child processes. We also learned
1. Exit FunctionThe C,c++ function exit is used to terminate the current program, and the function is defined as follows:
void exit (int status);
The official notes are as follows:Terminates the process normally, performing the regular
Address: http://blog.csdn.net/henhen2002/archive/2010/03/09/5360162.aspx
You can use either automatic initialization or custom initialization to enable the Niosi processor. The differences between alt_main and main in the Nios are also
ArticleDirectory
5.1 Introduction
Process 5.2
Thread 5.3
5.4 introduction to resource access Synchronization
5.4.2 deadlock
5.5 use the volatile field to synchronize with the interlocked class
5.6 use the lock keyword of
Original article link
Reference
Http://baobaoyangzhou.blog.163.com/blog/static/117831250201241232756488/
Http://wenku.baidu.com/view/5e5438186bd97f192279e964.html
Index
GPROF usage
Usage notes
Additional reading
main function and start routineWhen the kernel executes a C program using an EXEC function, a special startup routine is called before the main function is called, and the executable program designates this routine as the starting address of the
Atexit function name: atexit
Header file: # include
Function: registers the termination function (that is, the function called after the main execution ends)
Usage: int atexit (void (* func) (void ));
Note: according to iso c, a process can
1. What is a process?
From the user's perspective, a process is a program execution process.From the core of the operating system, processes are the basic units of resources such as memory allocated by the operating system and CPU time slice.A
// XK> foreshadowing 1: fork () and Exec
The only way to derive a new process in UNIX is the fork () function (some systems may provide its various variants ). All descriptors opened in the parent process are shared by the child process after
Function Name: tellFunction: obtains the current position of the file pointer.Usage: long tell (int handle );Program example:# Include# Include# Include# IncludeInt main (void){Int handle;Char msg [] = "Hello world ";If (handle = open ("TEST. $",
Method of Process Termination:
1. Normal termination:
Return from main;
Call exit;
Call _ exit;
2. exceptional termination:
Call abort;
Terminated by a signal.
Difference between exit and _ Exit:
# Include
Void exit (INT status );
# Include
Void _
Differences between exit () and _ exit ()
Linux source code
# DEFINE _ nr_exit 1
# DEFINE _ nR _ exit _ nr_exit/* from the File Include/asm-i386/unistd. H */"_ NR _" is the prefix for each system call in the Linux source code. Note that there are
So far, thread synchronization is most commonly used to ensure that multiple threads are mutually exclusive to shared resources. For synchronizing multiple threads in a single process for mutex access, the critical_section structure of Win32 API and
Before learning a process, you must first understand the execution environment of the process.
Main Function
The process is always executed from the main function. During programming, the program runs from the main function. Its prototype is as
1. Process Termination
There are eight ways to terminate the process
(1) return from main
(2) Call exit;
(3) Call _ exit or _ exit;
(4) The last thread returns from its startup history
(5) The last thread calls pthread_exit;
There are three methods
In general, in order to end our program, we will use return or call exit () in the main function (). There are also exitprocess () and terminateprocess () functions in windows.The purpose of this article is to compare the differences between the
There are often multiple exit procedures in the program, and some cleaning work should be performed when the program exits. If there is a method that can provide no relation to the program exit method to process the program exit, it is necessary to
Process Termination:
There are eight methods to terminate the process, of which five are normal termination.
(1) return from main
(2) Call exit
(3) Call _ exit or _ exit
(4) The last current response from the startup routine
(5) The
View Linux Processes
Linux Process
Processes are the basic unit of Transaction Management in Linux. All processes have their own independent processing environment and system resources, and they cannot directly access the resources of the other
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.