CN108121594A - A kind of process management method and device - Google Patents

A kind of process management method and device Download PDF

Info

Publication number
CN108121594A
CN108121594A CN201611078446.1A CN201611078446A CN108121594A CN 108121594 A CN108121594 A CN 108121594A CN 201611078446 A CN201611078446 A CN 201611078446A CN 108121594 A CN108121594 A CN 108121594A
Authority
CN
China
Prior art keywords
subprocess
program
function
link library
dynamic link
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201611078446.1A
Other languages
Chinese (zh)
Other versions
CN108121594B (en
Inventor
关志俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201611078446.1A priority Critical patent/CN108121594B/en
Priority to TW106126766A priority patent/TW201820131A/en
Priority to PCT/CN2017/111997 priority patent/WO2018099292A1/en
Publication of CN108121594A publication Critical patent/CN108121594A/en
Application granted granted Critical
Publication of CN108121594B publication Critical patent/CN108121594B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

This application discloses a kind of process management method and devices.Start agent process, the agent process loads dynamic link library that the agent process linked to memory;The agent process creates the first subprocess, and first subprocess loads first program by calling the entrance function of the program;The agent process creates the second subprocess, and second subprocess loads second program by calling the entrance function of second program;Wherein, the memory that dynamic link library described in first program and second procedure sharing occupies.

Description

A kind of process management method and device
Technical field
This application involves field of computer technology more particularly to a kind of process management methods and device.
Background technology
Process (Process) is program in computer on the once operation activity on certain data acquisition system, be system into The base unit of row Resource Distribution and Schedule is the basis of operating system configuration.Program is instruction, data and its organizational form Description, process is the entity of program.
In linux system, init processes are the parent processes of all processes in linux system.Init processes are by Linux Core guiding operation, is first process in system.Init processes generate subprocess, and subprocess shares the memory of parent process at this time Space, once parent process or subprocess have modified certain page of memory, then linux kernel can create this page of memory and be specific to the process Copy, such father and son's process can share the identical page of content, and not interfere with each other.
The content of the invention
The embodiment of the present application provides a kind of process management method and device.
Method provided by the embodiments of the present application, including:Start agent process, the agent process loads the agent process The dynamic link library linked is to memory;The agent process creates the first subprocess, and first subprocess is by calling The entrance function of the first program is stated, loads first program;The agent process creates the second subprocess, second son into Journey loads second program by calling the entrance function of second program;Wherein, first program and described second The memory that dynamic link library described in procedure sharing occupies.
Description of the drawings
Fig. 1 is the process schematic of linux system loading procedure in the prior art;
Fig. 2 is the memory distribution schematic diagram after linux system loading procedure in the prior art;
Fig. 3 is the process schematic of linux system loading procedure in the embodiment of the present application;
Fig. 4 is the memory distribution schematic diagram after linux system loading procedure in the embodiment of the present application;
Fig. 5 is the Booting sequence schematic diagram of application program in the embodiment of the present application;
Fig. 6 is the structure diagram of device provided by the embodiments of the present application;
Fig. 7 is the structure diagram for the device that the application other embodiment provides.
Specific embodiment
Although the concept of the application is easy to carry out various modifications and alternative form, its specific embodiment is by attached Example in figure shows and will be described in detail herein.It will be appreciated, however, that it is not intended to limit the concept of the application For particular forms disclosed, but on the contrary, it is intended to be the covering all modifications consistent with the application and appended claims, Equivalent and substitute.
To the reference of " one embodiment ", " embodiment ", " illustrative embodiment " etc. in specification, described reality is indicated Applying example may include a particular feature, structure, or characteristic, but each embodiment may or may not must include special characteristic, structure or Characteristic.In addition, such phrase is not necessarily referring to identical embodiment.Further, it is believed that those skilled in the art's In knowledge, when describing a particular feature, structure, or characteristic in conjunction with the embodiments, with reference to regardless of whether the other realities being expressly recited Apply feature as example influence, structure or characteristic.In addition, it will be appreciated that include in the form of " at least one in A, B and C " Project in lists can represent (A);(B);(C);(A and B);(A and C);(B and C);Or (A, B and C).Similarly, with The project that the form of " at least one in A, B or C " is listed can represent (A);(B);(C);(A and B);(A and C);(B and C) Or (A, B and C).
In some cases, the disclosed embodiments can hardware, firmware, software or any combination thereof in realize.Institute Disclosed embodiment is also implemented as machine readable (for example, computer can by one or more temporary or non-transitories Read) storage medium carries or the instruction of storage, and it can be read and be performed by one or more processors.Machine readable storage is situated between Matter can be presented as with machine-readable form (for example, volatibility or nonvolatile memory, dielectric disc or other media) The equipment of any storage device of storage or transmission information, mechanism or other physical arrangements).
In the accompanying drawings, some structures or method characteristic can be shown with specific arrangements and/or order.It will be appreciated, however, that It may not be needed such specific arrangement and/or sequence.On the contrary, in some embodiments, these features can with it is illustrative Different mode shown in attached drawing and/or order are arranged.In addition, including structure in specific pattern or method characteristic is not intended to It and implies that this feature is all needed in all embodiments, and can not include in some embodiments or can be with it His combinations of features.
It is in current linux system, by the schematic diagram of init process initiation program a and program b referring to Fig. 1.As schemed Show, system starts init processes first, and init processes call fork functions to generate subprocess a, and subprocess a calls exec functions With loading procedure a.The loading procedure of program b is similar.
When subprocess calls exec functions one new procedures of loading, the memory headroom of the subprocess, which can be completely removed, lays equal stress on It builds, i.e., the subprocess no longer has shared page with init processes.Init processes wound in linux systems all at present By the way that exec functions is called to realize when building new procedures.Fig. 2 show program a and program b start after memory distribution in system Schematic diagram, it can be seen that there are have a copy in two program a, program b subprocess in dynamic link library.
Wherein, dynamic link library is a kind of mode for realizing Sharing Function storehouse, calls process and is not belonging to it and can hold The function of line code.There are a large amount of dynamic link libraries, most of executable program in system can use dynamic link library.These Dynamic link library occupies a large amount of memories.Therefore, how to reduce the memory overhead of dynamic link library is current problem to be solved.
Since in linux system, init processes can not link dynamic link library, therefore generation is used in the embodiment of the present application Reason process (being known as cinit processes) link dynamic link library, creates subprocess, the son created by agent process by the agent process The entrance function of process caller carrys out loading procedure, due to the entrance by the subprocess that agent process creates by caller Function carrys out loading procedure rather than exec () function is called to carry out loading procedure, thus the memory of distinct program avoid by completely every From;Again since the agent process has linked dynamic link library, when agent process starts, the dynamic link library is loaded into memory, Therefore the multiple programs loaded through the above way can share the memory for the dynamic link library that agent process is loaded, thus with In the prior art each program be both needed to preserve dynamic link library copy compare, reduce the memory overhead of dynamic link library.
Principle provided by the embodiments of the present application, can program in linux system, also can program in have a similar demand other be System.
Below exemplified by applying the embodiment of the present application in linux system, to the specific implementation process of the embodiment of the present application It is described.
When computer booting, system kernel (kernel) only establishes an init process.Linux kernel is not The system calling for directly establishing new process is provided, other all processes are all that init processes pass through fork Mechanism establishings. Fork is that a system is called, and by calling fork functions, old process (parent process) itself can obtain new process (son by replicating Process).Process is survived in memory, and each process is assigned one's own address space (address in memory space).When fork functions are called, Linux hews out new memory headroom to new process in memory, and will always into Content in journey memory headroom is copied in the new space, this latter two process is run simultaneously.
Since init processes can not link dynamic link library, agent process is introduced in the embodiment of the present application and (is known as Cinit processes).Agent process has linked dynamic link library in compiling, which can include linux system and provide Basic dynamic link library, be normally applied program operation when can use.During init process initiations, the agent process It is activated, so as to which the dynamic link library that the agent process is linked is loaded into memory.Other programs can be by this in system Agent process starts.
When needing to load new program (for example user is operated by the screen touch of mobile terminal, clicking one should With the icon of program or have occurred the operations of other triggering loading application programs), subprocess is created by agent process, the son Process loads the program by calling the entrance function of the program.
During being somebody's turn to do, agent process still can be by calling fork function creation subprocess.When agent process calls fork letters After number, system to new process (subprocess) distribution resource, such as Linux hew out in memory a piece of new memory headroom to New process for storing data and code, and the content in the old process space is copied in new space, wherein, only Have that a small number of parameters is different from the parameter of old process, in this way, new process and old process can realize essentially identical function.When So, the initial parameter that inputs or incoming variable can not also be same when calling fork functions, in this way, new process and it is old into Journey can realize different functions.
Subprocess of the obtained process as agent process is newly created, obtains the address of the entrance function of application program, is adjusted With the entrance function of the application program, so as to load the application program.Wherein, application program usually has main functions, it is The entrance function of application program is function called first when starting application program, so as to the application program that brings into operation. In addition in some embodiments, when starting application program, other functions can be performed prior to the main functions of the application program, than All there is _ _ libc_start_main functions, function call main letters in the executable program compiled such as gcc compilers Number, the i.e. function are performed prior to main functions.In this case, after agent process creates subprocess, which can pass through Call application program _ _ libc_start_main functions load the application program.
Wherein, the address of entrance function can be from by obtaining in the executable program of compiling and link.The source of application program Code is needed after compiler is compiled and linker is linked, and forms executable program, and executable program is usual Can perform and can link the storage of form (Executable and Linkable Format, abbreviation ELF) file.ELF files Include machine instruction code, data, symbol table, Debugging message, character string after compiling etc..General ELF files are literary by these Part information presses different attributes, is stored in the form of " section " or " section ".Wherein, the dynsym sections in ELF files are mainly used for depositing Store up the relevant information of operating system, such as variable name, function name etc..It can be by the way that dlsym functions be called to obtain in ELF files Main function addresses in dynsym sections.
Under default situations, when being executable file by compilation of source code, the address of main functions does not export to dynsym Duan Zhong, that is to say, that can not be by the way that dlsym functions is called to obtain the address of main functions.It, can be by repairing in the embodiment of the present application Change linker, linker is made to export to the address of main functions in dynsym sections when being linked.For different linkers, Its amending method is not quite similar.The method that other any addresses that can export main functions can certainly be used.The application Embodiment is not restricted the method for obtaining the address of entrance function.
Further, in some embodiments, before the entrance function of the subprocess caller created by agent process, It is identical with the title of the program by the name modifications of the subprocess.In linux system, under default situations, the name of subprocess Identical with the title of parent process (being referred to as agent process cinit here), otherwise process name can show mistake.It specifically can be by following Mode changes the title of process:
Mode 1:Subprocess calls to change the system call function of process title.In linux system, prctl letters Number is system call function, has higher permission, the title available for the process of setting.Therefore the subprocess can be to operating system Kernel requests call prctl functions, are configured by the title for performing the prctl function pairs subprocess.
Mode 2:Subprocess obtains the address of the region of memory for storage process title in the subprocess, and changes the ground The parameter value (title that process title is revised as to application program) stored in the corresponding region of memory in location.The embodiment of the present application In, in subprocess memory headroom, the region for being argv [0] in address is stored with the title of the subprocess, if deposited in the region The parameter value of storage changes, then the title of the subprocess can also change.Therefore, if being the area of argv [0] by address in subprocess The parameter value stored in domain is revised as needing the title of application program to be started, then can cause title and the application of the subprocess The title of program is identical.The subprocess subsequently created can modified address be to be stored in the region of argv [0] in the subprocess Parameter value, so each subprocess can set the title of oneself, without disturbing other subprocess.
Further, in some embodiments, after application program launching, if necessary to change application name (ratio During if desired for being that current application program shows a special title in the user interface), that is, change the process of the application program Title can also then modify in the following ways:What the process of the application program was stored from the exclusive memory of the process In start-up parameter, obtain for storage process title region of memory address (address of the region of memory be variable argv [0] Value), and change the parameter value stored in the corresponding region of memory in the address and (process title be revised as application program Newname).
Further, in some embodiments, some environmental variances are related to process, and weight is needed when starting new procedures It puts, which specific environmental variance needs are reset depending on then visualisation platforms.In the embodiment of the present application, agent process creates subprocess Afterwards, which can reset environmental variance used in the corresponding program of the subprocess, and subprocess resets the operation of environmental variance It can be before the function of call entry or when other need to change environmental variance.For example, the value there are one environmental variance It is the filename that the application is stored in systems, it is clear that each the corresponding file of application is different, it is necessary to each application Reset the environmental variance.
Further, if in some embodiments it is contemplated that it is some cannot heritable resource inherited by subprocess, can Generate mistake, such as resource as filec descriptor.Therefore, in the embodiment of the present application, agent process create subprocess it Before, the resource that cannot be inherited by the subprocess can be closed.Wherein, agent process can determine which resource cannot by subprocess after It holds.When it is implemented, in some instances, it can pre-set which resource cannot be inherited by subprocess, it is necessary to which agent process exists These resources are closed or discharged before creating subprocess.In other example, the parent process of subprocess can be according to pre-setting Rule determine which resource cannot be inherited by subprocess, for example, when parent process monitor a network port, it be not intended to son into Journey also monitors the port, because two processes are usually present with mistake while listening for same port, then it just needs closing The port is closed, the opportunity of closing is after the parent process calls fork functions, before subprocess is run.
If it should be noted that the program that starts of agent process again using exec functions start other programs (and Thereafter all programs started), then their memory can not be shared.Therefore, it is every to wish that subprocess be total to its parent process Memory is enjoyed, is required to create subprocess and loading procedure in a manner described.Since said program is general, it is to allow Other programs of system abide by the program, and the embodiment of the present application can provide an auxiliary function to realize said program, for other The routine call function, in this way, the function can be used in each process for needing to save memory using said program, without The code for being used to implement said program is write for each process.
With reference to Fig. 3 and Fig. 4, by taking the loading procedure of application program a and application program b as an example, to above-described embodiment Specific implementation process is described.
As shown in Figure 3 and Figure 4, when linux system starts, linux kernel is exclusive for init course allocation init processes Memory headroom, and guide operation init processes.Start agent process (cinit) after init process initiations, agent process has it Exclusive memory headroom, the memory headroom are distributed in the init process initiations agent process by linux kernel.Due to agency Process has linked the basic dynamic link library of linux system in compiling, therefore the dynamic link library is loaded into memory.
The process of loading application programs a, as shown in figure 3, agent process (cinit) calls fork functions, establishment obtains son Process a.During this, as shown in figure 4, Linux hews out a piece of new memory headroom to subprocess a (i.e. in figure in memory Memory exclusive shown a), for storing data and code, and the content in agent process is copied in new space.Such as Shown in Fig. 3, subprocess a calls dlopen functions, and input parameter includes filename (file name and the agency of dynamic link library The filename for the dynamic link library that process is connected is identical), so as to open the dynamic link library in subprocess a.Pass through calling Dlopen functions, the parameter that the dynamic link library handle that dlopen functions return can be passed in dlsym functions, to be accorded with Address number in the dynamic link library using this address, can obtain the pointer of respective function in the dynamic link library, and And call the respective function in the dynamic link library.Subprocess a calls the main functions of application program a, so as to start using journey Sequence a.
The process of loading application programs b, as shown in figure 3, agent process (cinit) calls fork functions, establishment obtains son Process b.During this, as shown in figure 4, Linux hews out a piece of new memory headroom to subprocess b (i.e. in figure in memory Memory exclusive shown b), for storing data and code, and the content in agent process is copied in new space.Such as Shown in Fig. 3, subprocess b calls dlopen functions, and input parameter includes filename (file name and the agency of dynamic link library The filename for the dynamic link library that process is connected is identical), so as to open the dynamic link library in subprocess a.Subprocess b tune With the main functions of application program b, so as to start application program b.
From fig. 4, it can be seen that exec functions are not used when starting application program in subprocess a and subprocess b, but call into Mouthful function, and proxied process is loaded into memory the dynamic link library opened of application program a and application program b, Therefore application program a and application program b can share the memory of the dynamic link library, without each preserving a dynamic chain Connect the copy in storehouse.
When the function in the dynamic link library that application call is loaded by agent process, data which is changed The exclusive memory headroom of the application program (or the corresponding process of the application program) can be stored in.If for example, application program a (subprocess a) calls the method (function) in dynamic link library, and modification data are needed in this method (function) implementation procedure (such as value of modification variable), which can be stored in application program a (the exclusive memory headrooms of subprocess a) by operating system; If application program b (subprocess b) calls this method (function) in dynamic link library, and in this method (function) implementation procedure It needs to change the identical variable of title, operating system can in application program b, (the exclusive memory of subprocess b) be empty by the variable storage Between.In this way, application program a and application program b can sharing DLL, but call the variable changed of dynamic link library that can deposit It stores up in each exclusive memory headroom, avoids data collision.
Referring to Fig. 5, which describes the start-up course of the application program by taking above-mentioned application program a as an example.Application program The start-up course of b is similar.As shown in figure 5, when needing to start application program a, which may include:
Box 501:Agent process determines the resource that cannot be inherited by subprocess, these resources are closed.
Box 502:Agent process calls fork functions, creates subprocess a.In this process, system gives the son newly created The exclusive memory headroom of the course allocation subprocess, the memory headroom are specific to the subprocess.
Box 503:Subprocess a calls prctl functions, is application by performing the function by the name modifications of subprocess a The title of program a.
Box 504:Subprocess a resets component environment variable, for example resets the filename stored in storage system Variate-value.
Box 505:Subprocess a calls dlopen functions, and proxied process is loaded into the dynamic link library of memory Name is referred to as the input parameter of the function, so as to which by performing the function, the dynamic link library is opened in subprocess a.
Box 506:Subprocess a calls dlsym functions, the main function addresses of the program that is applied a.
Box 507:Subprocess a calls the main functions of application program a according to the main function addresses of application program a, from And loading application programs a.
In above-mentioned flow, the order of box 503 to box 506 can adjust, and the embodiment of the present application is without limitation.
Above-mentioned flow implements process, reference can be made to previous embodiment, is not repeated herein.
By above description as can be seen that in above-described embodiment of the application, whens init process initiations in system, starts Agent process when agent process starts, loads dynamic link library that the agent process linked to memory;When needing to load some During program, agent process creates a subprocess, which loads the program by calling the entrance function of the program, this Sample, the multiple programs loaded through the above way can share the memory that the dynamic link library that the agent process is loaded occupies, The copy of a dynamic link library is preserved without each program, reduces the memory overhead of dynamic link library.
Based on identical technical concept, the embodiment of the present application additionally provides a kind of device, which can realize foregoing implementation The flow of example description.
Referring to Fig. 6, for the structure diagram of device provided by the embodiments of the present application.The device may include:Starting module 601st, process creation module 602, wherein:
Starting module 601, for starting agent process, the agent process loads the dynamic that the agent process is linked Chained library is to memory;Process creation module 602, for creating the first subprocess, first subprocess is by calling described The entrance function of one program loads first program;And the second subprocess is created, second subprocess passes through calling The entrance function of second program loads second program;Wherein, first program and the second procedure sharing institute State the memory of dynamic link library occupancy.
Optionally, starting module 601 is first process in operating system, the generation started by the starting module Reason process is used to act on behalf of first process creation subprocess.
Optionally, process creation module 602 is additionally operable to:Before the entrance function for calling first program, pass through calling Be used to open the function of dynamic link library, the dynamic link library opened in first subprocess, wherein, the function it is defeated Entering parameter includes the filename of the dynamic link library;And before calling the entrance function of second program, pass through tune With the function for being used to open dynamic link library, the dynamic link library is opened in second subprocess, wherein, the function Input parameter includes the filename of the dynamic link library.
Optionally, first subprocess that process creation module 602 creates calls the entrance function of first program Before, it is identical with the title of first program by the name modifications of first subprocess;Process creation module 602 creates Second subprocess call the entrance function of second program before, by the name modifications of second subprocess be with The title of second program is identical.
Optionally, process creation module 602 is additionally operable to:Before creating first subprocess, closing cannot be by described The resource that one subprocess is inherited;And before creating second subprocess, close what cannot be inherited by second subprocess Resource.
Optionally, first subprocess that process creation module 602 creates calls the entrance function of first program Before, environmental variance used in first program is reset;Second subprocess that process creation module 602 creates calls Before the entrance function of second program, environmental variance used in second program is reset.
Optionally, first program is when being compiled, and the entrance function address of first program is exported to described In the executable file of first program;First subprocess of the process creation module creation calls first program Before entrance function, the entrance function address of first program is obtained according to the executable file of first program;It is described For second program when being compiled, the entrance function address of second program is exported to the executable file of second program In;Before second subprocess of the process creation module creation calls the entrance function of second program, according to institute The executable file for stating the second program obtains the entrance function address of second program.
Optionally, processing module (being not shown) is may also include in above device, which can be used for adding After carrying first program, data that will be changed by the function in the dynamic link library of first routine call, It is stored in the exclusive memory headroom of first subprocess;It, will be by second journey and after second program is loaded It is empty to be stored in the exclusive memory of second subprocess for the data that function in the dynamic link library that sequence is called is changed Between.
Based on identical technical concept, the embodiment of the present application additionally provides one or more computer-readable mediums, described Instruction is stored on readable medium, when described instruction is executed by one or more processors so that user equipment performs foregoing reality Apply the flow of example description.
Based on identical technical concept, the embodiment of the present application additionally provides a kind of device 700, before which can realize State the flow of embodiment description.
700. device 700 of exemplary device that Fig. 7 schematically illustrates according to various embodiments may include one or more Processor 702, system control logic 701 are coupled at least one processor 702, nonvolatile memory (non-volatile Memory, NMV)/memory 704 is coupled in system control logic 701, and network interface 706 is coupled in system control logic 701.
Processor 702 may include one or more single core processors or polycaryon processor.Processor 702 may include any one As purposes processor or application specific processor (such as image processor, application processor baseband processor) combination.
System control logic 701 in one embodiment, it may include any appropriate interface controller, to provide to processing At least one any suitable interface and/or offer in device 702 is any suitable to what is communicated with system control logic 701 Equipment or component any suitable interface.
System control logic 701 in one embodiment, it may include one or more Memory Controller Hub, to provide to system The interface of memory 703.Installed System Memory 703 is used for loading and storing data and/or instruction.For example, corresponding intrument 700, one In a embodiment, Installed System Memory 703 may include any suitable volatile memory.
NVM/ memories 704 may include the computer-readable medium of one or more tangible nonvolatiles, for storing number According to and/or instruction.For example, NVM/ memories 704 may include any suitable non-volatile memory device, it is such as one or more hard Disk (hard disk device, HDD), one or more CDs (compact disk, CD) and/or one or more numbers Universal disc (digital versatile disk, DVD).
NVM/ memories 704 may include storage resource, which is physically that the system is installed or can be with A part for accessed equipment, but it is not necessarily a part for equipment.For example, NVM/ memories 704 can be via network interface 706 by network access.
Installed System Memory 703 and NVM/ memories 704 can include the copy of interim or lasting instruction 710 respectively.Refer to Make 710 may include when by cause during at least one execution in processor 702 method that device 700 realizes that Fig. 2 to Fig. 5 describes it One or combination instruction.In each embodiment, instruction 710 or hardware, firmware and/or component software can additionally/alternatively by It is placed in system control logic 701, network interface 706 and/or processor 702.
Network interface 706 may include a receiver to provide wireless interface and one or more networks for device 700 And/or any suitable equipment communicates.Network interface 706 may include any suitable hardware and/or firmware.Network interface 706 may include mutiple antennas to provide MIMO wireless interface.In one embodiment, network interface 706 may include One network adapter, a wireless network adapter, a telephone modem and/or radio modem.
In one embodiment, at least one in processor 702 can be with one for system control logic or more The logic of a controller encapsulates together.In one embodiment, in processor it is at least one can with for system control patrol The logic for the one or more controllers collected encapsulates to form system in package together.In one embodiment, in processor It is at least one to be integrated on the same die with the logic of one or more controllers for system control logic.One In a embodiment, at least one in processor can be with the logical set of one or more controllers for system control logic Into on the same die to form System on Chip/SoC.
Device 700 can further comprise input/output device 705,.Input/output device 705 may include user interface purport It is interacted making user with device 700, it may include peripheral component interface is designed so that peripheral assembly can be with system Interaction and/or, it may include sensor, it is intended to determine environmental condition and/or the location information in relation to device 700.
The disclosure can include the various example embodiments of following discloses.
In example embodiment 1, the method for use can merge:Start agent process, the agent process loads institute Dynamic link library that agent process linked is stated to memory;The agent process creates the first subprocess, first subprocess By calling the entrance function of first program, first program is loaded;The agent process creates the second subprocess, institute The second subprocess is stated by calling the entrance function of second program, loads second program;Wherein, first program The memory occupied with dynamic link library described in second procedure sharing.
In example embodiment 2, according to example embodiment 1, the agent process is opened by first process in operating system Dynamic, the agent process is used to act on behalf of first process creation subprocess.
In example embodiment 3,1-2, further includes according to example embodiment:By the letter for being used to open dynamic link library Number, the dynamic link library is opened in first subprocess, wherein, the input parameter of the function includes the dynamic chain Connect the filename in storehouse;And/or it further includes:By being used to open the function of dynamic link library, in second subprocess The dynamic link library is opened, wherein, the input parameter of the function includes the filename of the dynamic link library.
In example embodiment 4,1-3, further includes according to example embodiment:By the name modifications of first subprocess be with The title of first program is identical;And/or it further includes:It is and second journey by the name modifications of second subprocess The title of sequence is identical.
In example embodiment 5, according to example embodiment 4, the title of subprocess is changed in the following manner:Subprocess calls For changing the system call function of process title;Alternatively, subprocess is obtained in the subprocess for storage process title The address of region of memory, and change the parameter value stored in the corresponding region of memory of described address.
In example embodiment 6,1-5, before the agent process creates first subprocess, goes back according to example embodiment Including:Close the resource that cannot be inherited by first subprocess;Before the agent process creates second subprocess, also Including:Close the resource that cannot be inherited by second subprocess.
In example embodiment 7,1-6, further includes according to example embodiment:Environment used in first program is reset to become Amount;And/or it further includes:Reset environmental variance used in second program.
In example embodiment 8,1-7, further includes according to example embodiment:First subprocess obtains to store first The address of the region of memory of subprocess title, and change the parameter value stored in the corresponding region of memory of described address;And/or It further includes:Second subprocess sends to the agent process and asks;The agent process is used for according to the request, acquisition The address of the parameter of the second subprocess title is stored, and changes the parameter value in described address.
In example embodiment 9,1-8, further includes according to example embodiment:It will be by the dynamic of first routine call The data that function in chained library is changed are stored in the exclusive memory headroom of first subprocess;And/or it further includes:It will It is only to be stored in second subprocess for the data changed by the function in the dynamic link library of second routine call Some memory headrooms.
In example embodiment 10,1-9 according to example embodiment, first program is when being compiled, first program Entrance function address be exported in the executable file of first program;First subprocess calls first journey Before the entrance function of sequence, the entrance function address of first program is obtained according to the executable file of first program; For second program when being compiled, the entrance function address of second program is exported to the executable of second program In file;Before second subprocess calls the entrance function of second program, according to the executable of second program The entrance function address of second program described in file acquisition.
The disclosure can also include the various example embodiments of following discloses.
In example embodiment 1, device can merge, which may include:Starting module, for start act on behalf of into Journey, the agent process load dynamic link library that the agent process linked to memory;Process creation module, for creating First subprocess, first subprocess load first program by calling the entrance function of first program;With And the second subprocess is created, second subprocess loads second journey by calling the entrance function of second program Sequence;Wherein, the memory that dynamic link library described in first program and second procedure sharing occupies.
In example embodiment 2, according to example embodiment 1, the starting module is first process in operating system, quilt The agent process that the starting module starts is used to act on behalf of first process creation subprocess.
In example embodiment 3,1-2, the process creation module are additionally operable to according to example embodiment:It is used to beat by calling The function of dynamic link library is opened, the dynamic link library is opened in first subprocess, wherein, the input parameter of the function Include the filename of the dynamic link library;And/or the function by being used to open dynamic link library, described The dynamic link library is opened in two subprocess, wherein, the input parameter of the function includes the file of the dynamic link library Name.
In example embodiment 4,1-3 according to example embodiment, first subprocess of the process creation module creation It is identical with the title of first program by the name modifications of first subprocess;And/or the process creation module wound The name modifications of second subprocess are identical with the title of second program by second subprocess built.
In example embodiment 5,1-4, the process creation module are additionally operable to according to example embodiment:Create first son Before process, the resource that cannot be inherited by first subprocess is closed;And before creating second subprocess, close The resource that cannot be inherited by second subprocess.
In example embodiment 6,1-5 according to example embodiment, first subprocess of the process creation module creation Reset environmental variance used in first program;And/or the second subprocess weight of the process creation module creation Put environmental variance used in second program.
In example embodiment 7,1-6, further includes processing module according to example embodiment, for will be by the first program tune The data that function in the dynamic link library is changed are stored in the exclusive memory headroom of first subprocess;With/ Or, the data that will be changed by the function in the dynamic link library of second routine call, it is stored in second son The exclusive memory headroom of process.
In example embodiment 8,1-7 according to example embodiment, first program when being compiled, first program Entrance function address is exported in the executable file of first program;Described the first of the process creation module creation Subprocess obtains the entrance function address of first program according to the executable file of first program;Second program When being compiled, the entrance function address of second program is exported in the executable file of second program;With/ Or, second subprocess of the process creation module creation obtains described the according to the executable file of second program The entrance function address of two programs.
The disclosure can also include the various example embodiments of following discloses.
In example embodiment 1, computer-readable medium can merge, and may include:One or more computers can Medium is read, instruction is stored on the readable medium, when described instruction is executed by one or more processors so that communication equipment Perform the method as any one of claim 1-10.
The disclosure can also include the various example embodiments of following discloses.
In example embodiment 1, device can merge, and may include:One or more processors;And one or Multiple computer-readable mediums are stored with instruction on the readable medium, and described instruction is held by one or more of processors During row so that described device performs the method as any one of claim 1-10.

Claims (20)

  1. A kind of 1. method, which is characterized in that including:
    Start agent process, the agent process loads dynamic link library that the agent process linked to memory;
    The agent process creates the first subprocess, first subprocess by calling the entrance function of first program, Load first program;
    The agent process creates the second subprocess, second subprocess by calling the entrance function of second program, Load second program;
    Wherein, the memory that dynamic link library described in first program and second procedure sharing occupies.
  2. 2. the method as described in claim 1, which is characterized in that the agent process is opened by first process in operating system Dynamic, the agent process is used to act on behalf of first process creation subprocess.
  3. 3. the method as described in claim 1, which is characterized in that further include:By the letter for being used to open dynamic link library Number, the dynamic link library is opened in first subprocess, wherein, the input parameter of the function includes the dynamic chain Connect the filename in storehouse;And/or
    It further includes:By being used to open the function of dynamic link library, the dynamic chain is opened in second subprocess Storehouse is connect, wherein, the input parameter of the function includes the filename of the dynamic link library.
  4. 4. the method as described in claim 1, which is characterized in that further include:By the name modifications of first subprocess be with The title of first program is identical;And/or
    It further includes:It is identical with the title of second program by the name modifications of second subprocess.
  5. 5. method as claimed in claim 4, which is characterized in that change the title of subprocess in the following manner:
    Subprocess calls to change the system call function of process title;Alternatively,
    Subprocess obtains the address of the region of memory for storage process title in the subprocess, and changes described address correspondence Region of memory in the parameter value that stores.
  6. 6. the method as described in claim 1, which is characterized in that before the agent process creates first subprocess, also Including:Close the resource that cannot be inherited by first subprocess;And/or
    Before the agent process creates second subprocess, further include:Close what cannot be inherited by second subprocess Resource.
  7. 7. the method as described in claim 1, which is characterized in that further include:Environment used in first program is reset to become Amount;And/or
    It further includes:Reset environmental variance used in second program.
  8. 8. the method as described in claim 1, which is characterized in that further include:
    First subprocess is obtained for storing the address of the region of memory of the first subprocess title, and changes described address pair The parameter value stored in the region of memory answered;
    And/or it further includes:
    Second subprocess sends to the agent process and asks;
    The agent process obtains for storing the address of the parameter of the second subprocess title according to the request, and changes institute State the parameter value in address.
  9. 9. the method as described in claim 1, which is characterized in that further include:
    The data that will be changed by the function in the dynamic link library of first routine call are stored in first son The exclusive memory headroom of process;And/or
    The data that will be changed by the function in the dynamic link library of second routine call are stored in second son The exclusive memory headroom of process.
  10. 10. method as claimed in any one of claims 1-9 wherein, which is characterized in that first program is when being compiled, institute The entrance function address for stating the first program is exported in the executable file of first program;First subprocess calls Before the entrance function of first program, the entrance of first program is obtained according to the executable file of first program Function address;
    For second program when being compiled, what the entrance function address of second program was exported to second program can It performs in file;Before second subprocess calls the entrance function of second program, according to second program can Perform the entrance function address of the second program described in file acquisition.
  11. 11. a kind of device, which is characterized in that including:
    Starting module, for starting agent process, the agent process loads the dynamic link library that the agent process is linked To memory;
    Process creation module, for creating the first subprocess, first subprocess is by calling the entrance of first program Function loads first program;And
    Create the second subprocess, second subprocess is by calling the entrance function of second program, loading described second Program;
    Wherein, the memory that dynamic link library described in first program and second procedure sharing occupies.
  12. 12. device as claimed in claim 11, which is characterized in that the starting module be operating system in first into Journey is used to act on behalf of first process creation subprocess by the agent process that the starting module starts.
  13. 13. device as claimed in claim 11, which is characterized in that the process creation module is additionally operable to:By being used for The function of dynamic link library is opened, the dynamic link library is opened in first subprocess, wherein, the input ginseng of the function Number includes the filename of the dynamic link library;And/or
    By being used to open the function of dynamic link library, the dynamic link library is opened in second subprocess, In, the input parameter of the function includes the filename of the dynamic link library.
  14. 14. device as claimed in claim 11, which is characterized in that first subprocess of the process creation module creation It is identical with the title of first program by the name modifications of first subprocess;And/or
    The name modifications of second subprocess are and described the by second subprocess of the process creation module creation The title of two programs is identical.
  15. 15. device as claimed in claim 11, which is characterized in that the process creation module is additionally operable to:Create described first Before subprocess, the resource that cannot be inherited by first subprocess is closed;And
    Before creating second subprocess, the resource that cannot be inherited by second subprocess is closed.
  16. 16. device as claimed in claim 11, which is characterized in that first subprocess of the process creation module creation Before the entrance function for calling first program, environmental variance used in first program is reset;And/or
    Before second subprocess of the process creation module creation calls the entrance function of second program, institute is reset State environmental variance used in the second program.
  17. 17. device as claimed in claim 11, which is characterized in that further include:
    Processing module for the data that will be changed by the function in the dynamic link library of first routine call, is deposited It is stored in the exclusive memory headroom of first subprocess;It and/or will be by the dynamic link library of second routine call The data changed of function, be stored in the exclusive memory headroom of second subprocess.
  18. 18. the device as any one of claim 11 to 17, which is characterized in that first program when being compiled, The entrance function address of first program is exported in the executable file of first program;The process creation module First subprocess created is with obtaining the entrance function of first program according to the executable file of first program Location;
    For second program when being compiled, what the entrance function address of second program was exported to second program can It performs in file;Second subprocess of the process creation module creation is obtained according to the executable file of second program Take the entrance function address of second program.
  19. 19. one or more computer-readable mediums, instruction is stored on the readable medium, described instruction is one or more When processor performs so that communication equipment performs the method as any one of claim 1-10.
  20. 20. a kind of device, including:
    One or more processors;And
    One or more computer-readable mediums are stored with instruction on the readable medium, and described instruction is by one or more When a processor performs so that described device performs the method as any one of claim 1-10.
CN201611078446.1A 2016-11-29 2016-11-29 Process management method and device Active CN108121594B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201611078446.1A CN108121594B (en) 2016-11-29 2016-11-29 Process management method and device
TW106126766A TW201820131A (en) 2016-11-29 2017-08-08 Process management method and apparatus
PCT/CN2017/111997 WO2018099292A1 (en) 2016-11-29 2017-11-21 Process management method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611078446.1A CN108121594B (en) 2016-11-29 2016-11-29 Process management method and device

Publications (2)

Publication Number Publication Date
CN108121594A true CN108121594A (en) 2018-06-05
CN108121594B CN108121594B (en) 2020-10-20

Family

ID=62226976

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611078446.1A Active CN108121594B (en) 2016-11-29 2016-11-29 Process management method and device

Country Status (3)

Country Link
CN (1) CN108121594B (en)
TW (1) TW201820131A (en)
WO (1) WO2018099292A1 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086136A (en) * 2018-07-26 2018-12-25 广东浪潮大数据研究有限公司 A kind of request processing method and relevant apparatus of Samba software
CN109408147A (en) * 2018-10-22 2019-03-01 深圳市元征科技股份有限公司 A kind of agreement determines method, system, device and readable storage medium storing program for executing
CN111083195A (en) * 2019-11-12 2020-04-28 烽火通信科技股份有限公司 Virtual single disk agent system and method
CN111596970A (en) * 2020-05-12 2020-08-28 广州市百果园信息技术有限公司 Dynamic library delay loading method, device, equipment and storage medium
CN113377543A (en) * 2021-06-28 2021-09-10 上海商汤科技开发有限公司 Task processing system, electronic device, and storage medium
CN114385261A (en) * 2021-12-23 2022-04-22 湖南小算科技信息有限公司 Method for loading program in process

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112083998B (en) * 2019-06-14 2024-05-17 中车株洲电力机车研究所有限公司 Dynamic configuration method and device for task parameters in RTP of VxWorks system
CN112256339B (en) * 2019-07-22 2023-11-03 百度在线网络技术(北京)有限公司 Multi-process management method, device, electronic equipment and storage medium
CN113282380B (en) * 2020-02-18 2024-05-24 深圳信可通讯技术有限公司 Method, device and computer readable medium for calling multipath control interface
CN115309523A (en) * 2022-07-28 2022-11-08 青岛云天励飞科技有限公司 Data processing method and device, electronic equipment and storage medium
CN115589503A (en) * 2022-10-28 2023-01-10 惠州市德赛西威汽车电子股份有限公司 Vehicle-mounted host startup animation implementation method, system, host and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101382953A (en) * 2008-09-19 2009-03-11 中兴通讯股份有限公司 Interface system for accessing file system in user space and file reading and writing method
US20090113425A1 (en) * 2007-10-30 2009-04-30 Vmware, Inc. Transparent Memory-Mapped Emulation of I/O Calls
CN101576912A (en) * 2009-06-03 2009-11-11 中兴通讯股份有限公司 System and reading and writing method for realizing asynchronous input and output interface of distributed file system
US20140282457A1 (en) * 2013-03-13 2014-09-18 Alex C. Chow Systems And Methods For Embedded Shared Libraries In An Executable Image

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113425A1 (en) * 2007-10-30 2009-04-30 Vmware, Inc. Transparent Memory-Mapped Emulation of I/O Calls
CN101382953A (en) * 2008-09-19 2009-03-11 中兴通讯股份有限公司 Interface system for accessing file system in user space and file reading and writing method
CN101576912A (en) * 2009-06-03 2009-11-11 中兴通讯股份有限公司 System and reading and writing method for realizing asynchronous input and output interface of distributed file system
US20140282457A1 (en) * 2013-03-13 2014-09-18 Alex C. Chow Systems And Methods For Embedded Shared Libraries In An Executable Image

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
刘生平 等: "桌面Linux 内存管理算法改进", 《系统工程与电子技术》 *
杨紫薇 等: "某火控系统软件消息传递和DLL共享内存技术研究及应用", 《第二届中国指挥控制大会论文集——发展中的指挥与控制》 *
王仁塘 等: "预加载共享动态链接库算法在桌面Linux环境下的设计与实现", 《干旱气象》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086136A (en) * 2018-07-26 2018-12-25 广东浪潮大数据研究有限公司 A kind of request processing method and relevant apparatus of Samba software
CN109408147A (en) * 2018-10-22 2019-03-01 深圳市元征科技股份有限公司 A kind of agreement determines method, system, device and readable storage medium storing program for executing
CN109408147B (en) * 2018-10-22 2022-04-19 深圳市元征科技股份有限公司 Protocol determination method, system, device and readable storage medium
CN111083195A (en) * 2019-11-12 2020-04-28 烽火通信科技股份有限公司 Virtual single disk agent system and method
CN111083195B (en) * 2019-11-12 2022-09-13 烽火通信科技股份有限公司 Virtual single disk proxy system and method
CN111596970A (en) * 2020-05-12 2020-08-28 广州市百果园信息技术有限公司 Dynamic library delay loading method, device, equipment and storage medium
CN111596970B (en) * 2020-05-12 2023-04-28 广州市百果园信息技术有限公司 Method, device, equipment and storage medium for dynamic library delay loading
CN113377543A (en) * 2021-06-28 2021-09-10 上海商汤科技开发有限公司 Task processing system, electronic device, and storage medium
CN114385261A (en) * 2021-12-23 2022-04-22 湖南小算科技信息有限公司 Method for loading program in process

Also Published As

Publication number Publication date
TW201820131A (en) 2018-06-01
WO2018099292A1 (en) 2018-06-07
CN108121594B (en) 2020-10-20

Similar Documents

Publication Publication Date Title
CN108121594A (en) A kind of process management method and device
Oakes et al. {SOCK}: Rapid task provisioning with {Serverless-Optimized} containers
US10140113B2 (en) Data processing method and device of preset application after upgrading
US20240048631A1 (en) Demand resources
US9813485B2 (en) Communication of virtual machine data
US20160357538A1 (en) On demand resources
US20140075583A1 (en) Management of media items
EP3374857A1 (en) Dashboard as remote computing services
US20150277941A1 (en) Method and system for linking to shared library
CN108509215A (en) A kind of replacing options of system software, device, terminal device and storage medium
US20230061228A1 (en) Managing shared applications at the edge of a content delivery network
US20150113506A1 (en) Method and system for adaptive loading of application
US20150113502A1 (en) Method and system for encapsulation of application
US20100318967A1 (en) Supplementary deployment actions
CN110045998A (en) Load the method and device of dynamic base
JP2007510211A (en) Mapping dynamic link libraries on computer equipment
US9241002B2 (en) Trusted relationships in multiple organization support in a networked system
CN110471744B (en) Password modification method, device, equipment and computer readable storage medium
CN107077356A (en) Memory privilege
JP6418419B2 (en) Method and apparatus for hard disk to execute application code
US20150081968A1 (en) Decommissioning virtual appliances
US9418175B2 (en) Enumeration of a concurrent data structure
CN114679465A (en) Resource operation method and device, electronic equipment and storage medium
US20110154374A1 (en) Apparatus and method for managing customized application
Pandurov et al. Platform for extending home automation gateway's functionality with plugin mechanism

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant