-
Create a new process with a fork, exec to execute a new program, exit function and two wait functions to handle termination and wait for termination. Let's take a look at each of them: With the exception of swapper, init, and daemon, an existing process calling the fork function is the only way for the Unix kernel to create a new process.
A new process created by a fork is called a child process. The function is called once, but returns twice. The difference between the two returns is that the return value of the child process is 0, while the return value of the parent process is the process ID of the new child process.
A child process is a replica of the parent process. For example, a child process gets a copy of the parent process data space, heap, and stack. Note that this is a copy, not a share (except for shareable text segments).
In general, it is uncertain whether the parent process executes first or the child process after the fork. It depends on the scheduling algorithm used by the kernel. Typical usage of fork is:
1) A parent process wants to replicate itself, so that the parent and child processes execute different segments at the same time; 2) A process is to perform a different procedure. In this case, the child process calls exec as soon as it returns from the fork. For exit, it has been stated before, and here is one more addition.
If the parent process is terminated before the child process, the parent process is changed to an init process for all processes whose parent has been terminated. A process that has been terminated, but whose parent process has not yet rewound it (to get information about terminating the child process, to free up the resources it is still occupying) is called a zombie process. To solve the problem of a dead process, you can fork twice, parent->-son->grandchild, and let the child process exit in the middle, so that the parent process of the grandchild process becomes init, and init is written so that as long as one child process is terminated, init will call a wait function to get its termination state and handle the aftermath, thus preventing a lot of dead processes in the system.
Both wait and waitpid are used to handle process termination. There is a difference between wait, which blocks the caller until a child process is terminated, while waitpid has an option that allows the caller not to block. And waitpid also has some controllable options (please check the book for details).
There are also some macros available for both. There are six types of exec functions, collectively known as exec. When a process calls an exec function, the process is completely replaced by the new program, which executes from its main function.
Because calling exec does not create a new process, the process ID before and after does not change. exec simply replaces the body, data, heap, and stack of the current process with another new program.
-
Yi volunteered, omitted to report.
-
A complete service primitive should include three parts: the primitive name, the primitive type, and the primitive parameters. The original name and type of primitives are generally written in English. The two are separated by dots or spaces, and primitive parameters can be represented in Chinese, separated by parentheses from the first two parts.
For example, the request primitive of a transport connection is written as follows: t—connect, request(called address, calling address、......).Here, t—connect is the primitive name, request is the primitive type, separated by dots, and the called address and caller address are primitive parameters. OSI stipulates that the size of the information unit that passes through the interlayer interface in the sequential interaction of two adjacent layers of entities of the same system is called the interface information unit IDU.
According to the characteristics of the interlayer interface, the size of the interface information unit has certain requirements. However, there is no direct correlation between the size of the interface information unit and the size of the corresponding protocol data unit. For example, a protocol data unit can be 1000 bytes, but an interface may require that only 1 byte pass at a time.
On the other hand, when the protocol data unit passes through the vibrato interlayer interface, it needs to add some control information on the sock cave, for example, indicating how many bytes are passed through, or indicating whether to accelerate the transmission, and these accusation information becomes the interface control information ici. Obviously, this kind of interface control information knowledge is only useful to the protocol data unit when it passes through the interface, but it is not directly useful to the protocol data unit that constitutes the next layer, therefore, after a protocol data unit PDU adds the appropriate interface control information ICI, it becomes the interface data unit idu. When the IDU passes through the interlayer interface, the interface control information ICI that was originally added is removed.
-
I understand primitives as the underlying protocol, and we just call the upper-layer functions when we program.
A primitive is simply a theoretical-level term that describes the relationship between the service hierarchy and the relationship between two communicating n users and the n layer (sub-layer) to which they are connected treats the protocol entity. When I first learned, I always couldn't figure out what the primitive had to do with the protocol stack, but later I realized that the primitive is just a term in the specification, and it is a specific function reflected in the protocol stack! For example, we can see that many primitives are suffix with request, confirm, etc., and in the program, it is the corresponding request request function, and the confirm confirmation function.
-
Primitives are not dependent on any language's description of logic and structure.
-
1. Primitives are the way in which layers in the protocol stack communicate with each other. For example, if the application layer needs to send data, it will send the data to the NWK layer in the form of data primitives (such as data request primitives), and the NWK layer will determine whether to send it to the MAC layer through defined rules, and so on, until it is sent to the lowest PHY layer.
2. What is the format of this frame?
Let's take the nwk layer as an example, for example, nwk has a command frame called "routing request command", which is not detailed in its role. The nwk layer needs to send the command through the mac layer and the phy layer, so the nwk layer needs to organize the command into primitives and send it. This command frame is the so-called "frame" of the NWK layer.
Ok, now let's talk about where the primitives are at this point.
3. There is such a class of primitives in the service primitives of the NWK layer and the MAC layer, as well as confirm and indication), which are defined as follows:
There is an MSDU argument that, for the implementation of the program, is a pointer to a piece of data. In 2, if NWK wants to send a routing request command to another entity (which can be understood as another node terminal running on the Zigbee protocol stack) for some reason, NWK must organize such a primitive in the way of primitives, which can be understood as assigning a value to a data structure, where MSDU points to the frame defined by the NWK layer according to the rules described in 2, that is, the NWK layer command frame.
Of course, primitives can not only transmit that command frame to the Mac layer.
The code word is so tired, hope. Not yet divided...
-
The implementation of the protocol guarantees the ability to provide services to the next level. The service users of this layer can only see the services but not the following protocols. The following protocol is transparent to the service users above.
A protocol is "horizontal", i.e., an agreement is a rule that governs communication between two peers. But the service is "vertical", i.e. the service is provided by the lower layer to the upper layer through the interlayer interface. The upper layer uses the provided services and must exchange some commands with the lower layer, which are called service primitives in OSI.
Network protocol: A rule, standard, or convention established for the exchange of data in a network. It consists of the following three elements:
1) Grammar: i.e. the structure or format of data and control information.
2) Semantics: that is, what kind of control information needs to be sent, what actions need to be completed, and what kind of response needs to be made.
3) Synchronization: i.e. a detailed description of the order in which the events are implemented. A protocol is a collection of rules that govern communication between two peering entities.
Under the control of the protocol, the communication between two peers enables the upper layer to provide services, and the implementation of this layer protocol requires the use of the lower layer to provide services.
References: Encyclopedia Entry Service Agreement.
-
The landlord is asking about the two terms of agreement and service on computer network courses, right?
By definition, a protocol is a rule, a convention, and a service is a function and a skill. Hierarchical:
The protocol is unique to the peering layer of the two communicating parties, and it is a horizontal relationship. The service is only between the upper and lower layers at one end of the communication, which is a vertical relationship and is provided from the bottom up.
As for the relationship between the two concepts, it can be said that the protocol of each layer is supported by the services provided by the lower layer to this layer.
-
Distinction between the concepts of protocols and services:
a.The implementation of the protocol ensures that the service can be provided to the upper layer, and the service users of this layer can only see the service but cannot see the following protocol, and the following protocol is transparent to the above service users;
b.A protocol is "horizontal", i.e., an agreement is a rule that governs communication between two peers. But the service is "vertical", i.e. the service is provided by the lower layer to the upper layer through the interlayer interface. The upper layer uses the provided services and must exchange some commands with the lower layer, which are called service primitives in OSI.
-
A computer network protocol is a set of rules, conventions, and standards, while a network service is a software module. The specific explanation is as follows:
1) Computer network protocol is a set of rules related to computer network communication, or the rules, conventions and standards formulated for the completion of computer network communication. A network protocol consists of three elements: syntax, semantics, and timing. "Web services" refers to some software modules running on the network, service-oriented, based on distributed programs, network services use HTTP and XML and other Internet common standards, so that people can access the data on the web through different terminal devices in different places, such as online booking, view the reservation situation.
2) Network services are widely used in e-commerce, e-government, electronic business processes and other application fields, and are regarded as the next focus of the Internet by industry insiders.
Differences: (1) (n) service is a comprehensive capability provided by layer (n) and below to layer (n+1); A (n) protocol is a collection of rules that govern communication between peer (n) entities. A service is an operation between adjacent layers in the same open system;
2) A protocol is a regulation that must be followed for communication between peers in different open systems. The protocol is horizontal, while the service is vertical.
3) Relationship: The (n) layer service is implemented by using the (n-1) service and the exchange of information with the peer entity according to the (n) protocol, that is, the service is supported by the protocol.
Human resources are the primary driving force for the development of enterprises and the most valuable resources of enterprises. The EAP program provides comprehensive employee benefits for employees to enhance their satisfaction and sense of belonging. >>>More
If you have forgotten your service password, you can retrieve it through the following channels: >>>More
Hello landlord, if it is an enterprise that chooses a server, it depends on what aspect of the business it is doing. If it is an enterprise, the general requirements for host configuration are not high, even a few hundred trillion virtual hosts can be satisfied, if the overall security requirements are higher, you can also choose cloud hosts, or independent servers. If you want to place other types of services in the enterprise, you can select a suitable host based on the requirements of the business for machine hardware and bandwidth. >>>More
I think that a smile is the transmission of feelings between people, and with a sincere smile, we can create an atmosphere of tolerance and understanding, and with a smile, we no longer have unnecessary disputes and friction. Smile is no international language, smile can conquer a person's soul, we can not live without a smile, work can not do without a smile, smile service is indispensable for quality service. As one of the top 12 in Yangcheng employment agency, honest and reliable market, consumers trust the brand the most, and these honors are inseparable from the professionalism and smile service of all employees. >>>More
The service outsourcing industry is an important part of the modern high-end service industry, which has the characteristics of high information technology carrying capacity, large added value, low resource consumption, less environmental pollution, strong ability to absorb employment (especially college students), and high level of internationalization. Here's what I've sorted out the details, let's take a look! >>>More