Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the Java process

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces Java process how to understand the relevant knowledge, content detailed and easy to understand, simple and fast operation, has a certain reference value, I believe everyone read this Java process how to understand the article will have some gains, let's take a look at it.

process description

Broadly speaking, all process information is placed in a data structure called a process control block, which can be understood as a collection of process attributes.

process control block

Each process has a process control block (PCB) in the kernel to maintain process-related information. The Linux kernel's PCB is the task_struct structure.

task_struct struct

task_struct is a data structure in the Linux kernel, which is loaded into RAM and contains information about processes. Each process puts its information in the task_struct structure. task_struct contains these contents:

Identifier: A unique identifier that describes the process.

Status: Task status, exit code, exit message, etc.

Priority: Priority relative to other processes

Program counter: Address of the next instruction to be executed in a program.

Memory addresses: pointers to program code and process-related data, as well as to memory blocks shared with other processes

Context data: Data in registers processed during process execution

I/O status information: Includes displayed I/O requests, I/O devices assigned to processes, and a list of files used by processes

Billing information: including processor time sum, clock usage sum, time limit, billing signal, etc.

The data structure that stores process information is called task_struct. All processes running in the system are stored in the form of task_struct list. The process information in the kernel can be viewed through the/proc system folder. To obtain the process information with PID 400, you need to view the/proc/400 folder. Most processes can also be accessed using the user-level tools top and ps.

process identifier

Process ID(PID)

Parent Process ID (PPID)

process location

process memory mapping

C program generation under Linux consists of four main steps: pre-compilation, compilation, assembly, linking. Compiler gcc converts source program files into object files through three steps: precompilation, compilation and assembly. If the program has multiple object files or library functions are used in the program, the compiler also needs to link all the object files and required library files to generate the executable program. As the program executes, the operating system copies the executable program into memory. The process of program conversion usually involves the following steps:

* The kernel reads programs into memory and allocates memory space for programs;

* The kernel saves the PID and corresponding state information for the process, and puts the process in the run queue for execution. Programs are translated into processes that can be executed by the operating system scheduler.

A memory image of a process refers to how the kernel stores executable program files in memory. In the process of converting programs into processes, the operating system copies executable programs from hard disk to memory. The layout is as follows:

2. The process image location depends on the memory management used

3. Executable programs differ from process memory images in that:

a. Executable programs reside on disk and memory images reside in memory

b. Supportable line programs do not have stacks because stacks are allocated when program programs are loaded into memory.

c. Executable programs also have uninitialized data segments, but they are not stored in executable files on hard disk.

d. Executable programs are static and immutable, while internal images change statically with program execution, such as variable values stored by data segments as the program executes, and stacks are constantly changing during function calls.

#include #include int g_val = 100;void test(){int a = 10;int b = 10;printf("test stack1 address : 0x%x\n", &a);printf("test stack2 address : 0x%x\n", &b);}void (*fp)();int main(){int a = 10;int *heap = malloc(sizeof(int));fp = test;printf("code address : 0x%x\n", fp);printf("data address : 0x%x\n", &g_val);printf("heap address : 0x%x\n", heap);printf("main stack0 address : 0x%x\n", &a);fp();return 0;}

About "Java process how to understand" the content of this article is introduced here, thank you for reading! I believe everyone has a certain understanding of "how to understand Java process" knowledge. If you still want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report