Android system development (8)-basic concepts of linx Processes

Source: Internet
Author: User

Android system development (8)-basic concepts of linx Processes
1. in the traditional sense, the proc file system is used to store information on Block devices. The/proc directory is a virtual file system, where the data is stored in the memory, therefore, this directory does not occupy any hard disk space. It mainly includes the following system information: memory management system process features Data File System Device Driver System Bus Power Management Terminal System Control Parameters

Users and applications can obtain system information through proc and change certain kernel parameters. Because system information, such as processes, is dynamically changed, when a user or application reads the proc file, the proc file system dynamically reads the required information from the system kernel and submits it. The files or subfolders listed below do not all exist in your system, depending on your Kernel configuration and loaded modules. In addition, there are three important directories in/proc: net, scsi, and sys. The Sys directory is writable and can be used to access or modify kernel parameters. net and scsi depend on Kernel configuration. For example, if the system does not support scsi, the scsi directory does not exist. <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD48cD6z/logs/u1xMS/logs + logs/wrzD + 6Osy/logs + itcS907/aoaO2 + logs/NPJwb249rK/logs + mzybK/t9bKx7LZ1/logs/ PKx8 + release/yw/Lqsy/nT0L/release + m78kRMTMSjv + release/Lqstq/release/1bzkoaPI58/release + release/bPMoaO/ydLUy7y/release + signature + expires/stnX98 + expires/expires + 1zbPE2r/expires/q + zb/J0tTKtc/Wv + fGvcyooaM8aDM + expires/expires + jqTMyzru2/r341sbPtc2z1 + export + dLUztLDx7XEzu/A7cTatObX7rTzv8nS1Mq508M0Ry682cjnztLDx8/export = "http://www.2cto.com/uploadfile/Collfiles/20140831/2014083109370882.png" alt = "\"/>
Virtual Memory is an abstract concept that provides an illusion for every process. Each process exclusively uses the primary storage (hard disk) virtual address space as follows: (Note: figure from deep understanding of computer systems)
The code and data defined by the user process are stored at the bottom of the address space. For all processes, the Code starts from the same fixed address. The next step is global variables and corresponding data locations, such as heap, shared library, and stack. At the top is the kernel virtual memory. The kernel always resides in the memory and is part of the operating system. The top area of the address space is reserved for the kernel, applications are not allowed to read or write content in this region or directly call functions defined by kernel code.
2. Read the program segment content in the memory and allocate space to the variables, during the call, the addressing operation process maps the binary file of the disk to the memory space and directs the CPU to the memory addressing, then calculates and returns (I/O).

 #include 
 
  #include 
  
   #include 
   
    int main(){        printf("hello PID:%d\n", getpid());        printf("hello ppid:%d\n", getppid());        char *p;        scanf("%s", p);        return 0;}
   
  
 
Start this program (process)
The process ID is 1634 and the process parent ID is 1617. Run the ps-aux command to check the current process. The process parent process is a shell process. First, the binary program getpid is identified by the linux system. The binary file is put into the memory, the processor is addressable, and the variable is allocated memory space (put functions and variables in different regions ), finally, output the result. 4. Two features in the process of running a process 1. Multi-task, multi-process "concurrency in linux is multi-task, time-sharing, an independent logical control flow, as if our program exclusively uses the processor, the following figure shows the CPU process scheduling.
Process 1, 2, 3, 4, 5, 6 ...... in the running process, the CPU allocates time segments. The processor is like a turntable. When it points to a process, it allocates time slices to the process and starts to execute the process. 2. The virtual memory is isolated from each other, and each process has a private address space, as if our program excludes and uses the memory. 5. the life cycle of a process has three major states for the Program: running, suspension, and extinction. 1. Create a task (Process Creation) 2. Prepare to run the task (wait for the CPU to allocate a time slice) 3. Run the task (in the actual running status, if it is not allocated to the actual cpu slice, continue to wait) 4. Pending (including disturbing and non-disturbing). For example, scanf waits for user input to interrupt. 5. extinction (when the task is terminated or recycled by the parent process)

Related Article

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.