C language structure longest you've ever seen how long?

waring: heading the party Foreword: Point incoming junior partner may be to look at the length of the structure, of course, will not let you down, the entire copy down below the posted , another way to learn C language to write nothing more than to see more look good demo, the following story from the beginning of a structure, this structure is selected from Linux3.5 version, in /include/linux/sched.h inside,

========================== text ======================= =

  The structure is 360 lines long, so much structure in the end in what is described? Here we take a walk into the structure, take a look at this structure in the end what to do?

  From the operating system perspective, every program run can be seen as a process, we know that, you can run many processes simultaneously in the computer, run these processes do not interfere with each other, but the computer's resources are limited it ( register, memory) operating system is no problem between the process of how to do it?

  This is because the operating system is created for each process at the same time, each process will create a process control block - referred to as the PCB, the PCB is defined and all information related to the process, a PCB correspond to a process, a process It corresponds to a PCB, while we talk about the process can be said to be talking about the PCB.

  Process has several states, on different operating systems the following description of the process is slightly different, but the general outline of the process can be the following four: start state, ready state, running state, wait state. Each queue corresponds to a following state, so that PCB forth in these switching states. This realization, I can read, listen to music forum results friends on the computer.

The following code is very long, the reader can look at Chinese comments, interested can learn more about other parts.

  So there are many small partners might have doubts, such a large structure would not visit them a lot of trouble?

  Yes This structure in the time of the visit, access to the form instead of the regular pointers, this is very slow, he is the first address of the structure plus the offset form of access. Therefore, the amount of each position can not be easily moved.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  

Old nine Academy members produced

Author: Happy Mirror

Guess you like

Origin www.cnblogs.com/ljxt/p/11579845.html