Abstract:
A data processing system with routing tables comprising an operating system for supporting processes, such that the process are associated with one or more resources and the operating system being arranged to police the accessing by processes of resources so as to inhibit a process from accessing resources with which it is not associated. Part of this system is an interface for interfacing between each process and the operating system and a memory for storing state information for at least one process. The interface may be arranged to analyze instructions from the processes to the operating system, and upon detecting an instruction to re-initialize a process cause state information corresponding to that pre-existing state information to be stored in the memory as state information for the re-initialized process and to be associated with the resource.

Description:
PRIOR APPLICATION DATA 
     This application is a continuation of, claims priority to and the benefit of U.S. patent application Ser. No. 11/982,109 entitled Data Processing System with Routing Tables filed Oct. 31, 20007 which is a divisional application of and claims priority to U.S. patent application Ser. No. 11/900,377 entitled User-Level Re-Initialization Instruction Interception filed Sep. 10, 2007, which is a continuation of and claims priority to PCT Application No. PCT/GB2006/000852 which was published as WO 2006/095184 on Sep. 14, 2006 and claims priority to Great Britain Patent Application No. 0506403.5 filed Mar. 30, 2005. 
    
    
     FIELD OF THE INVENTION 
     This disclosure relates to data processing systems. 
     RELATED ART 
     In the field of computer systems it is generally necessary to determine an appropriate path by which to transmit instructions between elements of a computer. Typically the path is defined by the operating system running on the computer, but it is known that other processes can intervene in some situations to alter the path that instructions take. For example an application which wishes to use a hot-pluggable input-output device will take an instruction path which is determined by a hot-plug controller device according to the particular device which is resident in the system at that time. 
     For example, the application can invoke a system call (syscall) for transmission of data through the socket and then via the operating system to the network. Syscalls can be thought of as functions taking a series of arguments which cause execution of the CPU to switch to a privileged level and start executing the operating system. A given syscall will be composed of a specific list of arguments, and the combination of arguments will vary depending on the type of syscall. 
     Syscalls made by applications in a computer system can indicate a file descriptor (sometimes called a Handle), which is usually an integer number that identifies an open file within a process. A file descriptor is obtained each time a file is opened or a socket or other resource is created. File descriptors can be re-used within a computer system, but at any given time a descriptor uniquely identifies an open file or other resource. Thus, when a resource (such as a file) is closed down, the descriptor will be destroyed, and when another resource is subsequently opened the descriptor can be re-used to identify the new resource. Any operations which for example read from, write to or close the resource take the corresponding file descriptor as an input parameter. Existing data processing system suffer from various drawbacks in this regard. 
     In addition, in order to transmit data between data processors in a network such as an Ethernet network, data is formed into packets. Each packet includes a header specifying the destination of the data in the packet. In an Ethernet network the destination is typically specified by means of an Ethernet address, an Internet Protocol (IP) address and a Transmission Control Protocol (TCP) address. 
     In known network systems it is common for network routing rules to be stored in tables or other data structures such that when a transmission of data is requested the tables can be accessed to determine the appropriate addresses to which to send the data, and the contents of the packet headers can thus be created. Such tables are generally stored by the operating system of the terminal device that is to send the data, for example a personal computer or server. 
     Layers of the stack include an application and a socket provided by a socket library. The socket library is an application program interface (API) for building software applications. The socket library can carry out various functions, including creating descriptors and storing information. Additionally, there is an operating system (OS) comprising a TCP kernel and a proprietary TCP user-level stack. 
     In order to perform routing the user-level stack must use a routing table. One option would be for the user-level stack to maintain its own routing tables independently of the OS. However, this would require the user-level stack (in addition to the OS) to have access to all the communications necessary for establishing a routing table. There would then be ambiguity as to where those communications should be directed. Alternatively, the user-level stack may be able to access the routing tables stored by the OS. Since the user-level stack may have to access the tables very frequently during operation, accessing the routing tables stored by the OS is likely to create a significant workload for the system and so it can be expected to be inefficient for an application to be required to access tables in the OS each time it wishes to transmit data across the network. This is a drawback to the prior art. 
     It is further known that in computer systems, regions of memory are commonly shared between more than one application. Applications which are running are known as processes, and more than one process in a computer may require access to the shared memory at the same time. However, the regions of memory will typically be controlled by means of an operating system which will provide support to enable only one application at a time to access the shared memory space, as discussed in more detail below. 
     Multiple threads can exist within a single application process and can execute concurrently with access to all the memory of the application context. Thus, there may be multiple threads within each application wishing to access the shared memory. If more than one process or thread were permitted concurrent access to the memory then the application would be likely to crash since the same region of memory cannot be modified simultaneously by more than one set of instructions. Therefore, it is known to provide a lock associated with the memory. The lock can be changed between an unlocked state when no application is accessing the region of memory and a locked state when the memory is being accessed. Thus, when one thread (L) has access to the shared memory, the lock associated with the memory will enter a locked state, indicating that the memory cannot currently be accessed by other threads. When another thread (T) makes an attempt to access the memory while the thread L has access, the thread T will not be permitted access and will need to wait until the memory becomes available. 
     Spin-locks are commonly used by processes attempting to access shared memory. When a process makes an attempt to access the memory the process will either obtain the lock or it will not. If it fails, a decision must be made about how to proceed. If the process cannot proceed with any other operations until the lock is obtained then it will block and repeatedly attempt to access the memory until the lock is finally obtained. This can obviously be inefficient. An alternative is for the process to request a callback, so that when the lock is released the process is woken and can then re-try the lock. Although this can eliminate the requirement for a process to continually try the lock, it can still be inefficient because the process may not be able to carry out other operations while waiting for the memory access. In other words, it may have to block while waiting for a wake-up from the operating system. 
     In known systems, attempts made by threads to enter the memory space while it is being used can cause an entry to be added to a queue so as to indicate that the threads are awaiting access to the memory. If the memory is busy then, when it subsequently becomes available, a “wake-up” call can be sent to any waiting threads or applications. The waiting threads or applications are thus alerted to the availability of the memory and can then each make a further attempt to access the memory. Typically, the first thread or application to attempt to access the memory will be given access, although other scheduling algorithms are employed where appropriate. When an application successfully engages the memory, the lock will enter a locked state and access to the memory will be prevented to other applications. 
     It is also known for an application, on releasing a lock, to send a system call (syscall) to a driver within the operating system to initiate the sending of a wake-up call to waiting applications. The driver on receiving a syscall instructing a wake-up call, would access the queue to determine which applications are waiting, and send wake-up calls to the appropriate applications. 
     This arrangement has the following disadvantages. First, it can be inefficient for applications to have to make repeated attempts to access the memory. Second, some applications will have a higher priority than others and it can be very inefficient for a high priority application to be made to wait and make several access attempts before being permitted access to the memory. For example, an application may be blocked until it can access the memory, and it can therefore be important for that application to be treated as a high priority. Also the priority of all the waiting threads cannot be easily expressed in terms of the Operating System level inputs to the scheduling algorithm and is only known (or expressed) by the particular application and driver code. 
     Various embodiments are disclosed herein for overcoming the drawbacks in the prior art and for providing additional advantages and benefits for data processing systems and the methods associated therewith. 
     SUMMARY 
     To overcome the drawbacks of the prior art and provide additional benefits and features, a data processing system is disclosed. In one embodiment the system comprises an operating system for supporting processes such that each process is associated with one or more resources. The operating system is arranged to police the accessing by processes of resources so as to inhibit a process from accessing resources with which it is not associated, and being responsive to instructions of a certain type to re-initialize a process. Also part of this embodiment is an interface for interfacing between each process and the operating system. A memory is provided for storing state information for at least one process such that the state information is associated with a resource. In addition, the interface is arranged to analyze instructions from the processes to the operating system, upon detecting an instruction to re-initialize a process so as to be associated with a resource that is associated with pre-existing state information. This causes state information corresponding to that pre-existing state information to be stored in the memory as state information for the re-initialized process and to be associated with the resource. 
     In one embodiment, a data processing system is arranged to control access by a plurality of processes to a region of shared memory. In such an embodiment, the data processing system is configured to prevent more than one process from concurrently accessing the region of shared memory and establish a data structure for holding items of a first type. These each comprise an indication of another of the plurality of processes, which are attempting to access the region of shared memory, and a definition of an operation on the region of shared memory. In addition, on a process finishing accessing the region of shared memory, action an item in the data structure by performing the defined operation by other than the process indicated in that item. 
     Also disclosed herein is a data processing system comprising an operating system for supporting processes such that the operating system is arranged to output data by addressing the data to a descriptor corresponding to the intended destination of the data. Also part of this embodiment is an interface for interfacing between each process and the operating system. A memory is provided including one or more address spaces and there is an address space corresponding to each of the processes for use by the respective process. Also, a data communication stack is provided or created for one of the processes such that the stack is located in the address space corresponding to the respective process and having a descriptor allocated to it. In this embodiment, the interface is arranged to analyze requests to alter the allocation of a descriptor sent by the processes towards the operating system to identify whether such a request relates to altering the allocation of the descriptor allocated to the stack, and if it does, allocate a different descriptor to the stack and subsequently permit the request to be processed. 
     Also disclosed herein is a method of compiling a data structure in a computer system such that the computer system is arranged to perform protocol processing and transmit data via an interface on the basis of instructions in accordance with a route. In one embodiment this method comprises receiving a first instruction including an indication of a descriptor and determining a route indicated by the first instruction. This method also identifies an interface within the determined route and attempts to determine the ownership of the interface. As a result, this method causes an entry to be made in the data structure such that the entry includes an identifier of the descriptor and a state of the descriptor, wherein the state represents the result of the attempting step. 
     Also disclosed herein is a data processing system comprising an operating system that stores a first network routing table that comprises one or more entries each indicating at least part of a route over a network to a respective destination. The first network routing table may enable routing using various protocols such as, but not limited to, address resolution protocol, transmission control protocol, user datagram protocol, or a combination thereof. 
     In one or more embodiments, the operating system may be arranged to transmit data using the first network routing table. In addition, the operating system may maintain the first network routing table in various ways. For example, the operating system may be arranged to delete entries from the first network routing table if they are unused. The operating system may also be arranged to periodically delete, with a first frequency, unused entries from the first network routing table. In addition, the operating system may be signaled to maintain the first network routing table by a network data transmission function discussed below. 
     This system also comprises a transmission support function and a network data transmission function. In one or more embodiments, these functions may be defined by software which is executable by the data processing system. The transmission support function maintains a copy of the first network routing table to avoid frequent access to the first network routing table, and to avoid the task of maintaining a separate routing table independent of the operating system. The transmission support function may be internal or external to the operating system, and may function at user level. The copy of the first network routing table may be updated in various ways. For example, the operating system may be arranged to signal to the transmission support function when the first network routing table is updated. In addition or alternatively, the transmission support function may be arranged to check the first network routing table for updates. 
     Generally, the network data transmission function allows transmission of data in accordance with the copy of the first network routing table without accessing the first network routing table. The network data transmission function may read the copy of the first network routing table through memory mapping which may be read only so as to prevent alteration of the routing table. Transmission of data may occur in various ways. In one embodiment, the network data transmission function may transmit data in the form of packets by creating packet headers for such packets based on information in the copy of the first network routing table. 
     The network data transmission function may be arranged to transmit to the operating system signals for causing the operating system to maintain entries in the first network routing table. These signals may be dedicated messages for maintaining tables in the operating system. In one or more embodiments the signals may comprise address resolution protocol reinforce messages. The signals may be sent periodically with a second frequency which may be greater than the operating system&#39;s first frequency for maintaining the first network routing table, as discussed above. 
     In this way, a network endpoint of the data processing system herein, may be arranged such that the network endpoint is unable to access the first network routing table directly, but still capable of network communication. The system may also have a counter which increments each time a change is made to the first network routing table. In one or more embodiments, such counter may be used to identify that cached data or other state data within the system may be inconsistent due to the change. 
     Other systems, methods, features and advantages of the invention will be or will become apparent to one with skill in the art upon examination of the following figures and detailed description. It is intended that all such additional systems, methods, features and advantages be included within this description, be within the scope of the invention, and be protected by the accompanying claims. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The components in the figures are not necessarily to scale, emphasis instead being placed upon illustrating the principles of the invention. In the figures, like reference numerals designate corresponding parts throughout the different views. 
         FIG. 1  shows a prior art computer system. 
         FIG. 2  represents a typical prior art data packet. 
         FIG. 3  shows components of a computer system in accordance with embodiments of the present invention. 
     
    
    
     DETAILED DESCRIPTION 
     The embodiments of the invention described herein may include any one or more of the features described in relation to other inventions. As such various different embodiments may be configured with any element, feature, or step, disclosed herein, either alone or in combination. 
     This invention relates to routing data within a computer system, and in particular but not exclusively to routing data within a network. In order to transmit data between data processors in a network such as an Ethernet network, data is formed into packets. Each packet includes a header specifying the destination of the data in the packet. In an Ethernet network the destination is typically specified by means of an Ethernet address  11 , an Internet Protocol (IP) address  12  and a Transmission Control Protocol (TCP) address  13  as illustrated in  FIG. 2 . 
     In known network systems it is common for network routing rules to be stored in tables or other data structures such that when a transmission of data is requested the tables can be accessed to determine the appropriate addresses to which to send the data, and the contents of the packet headers can thus be created. Such tables are generally stored by the operating system of the terminal device that is to send the data, for example a personal computer or server. 
       FIG. 1  shows components implementing a TCP stack. Layers of the stack include an application  1  and a socket  2  provided by a socket library. The socket library is an application program interface (API) for building software applications. The socket library can carry out various functions, including creating descriptors and storing information. Additionally, there is an operating system (OS)  3  comprising a TCP kernel  4 , and a proprietary TCP user-level stack  5 . It will be understood by the skilled person that although TCP is referred to by way of example, other protocols could also be used in accordance with embodiments of the invention. For example, User Datagram Protocol (UDP), Internet Control Message Protocol (ICMP) or Real-Time Transport Protocol (RTP) could be used. Non-Ethernet protocols could be used. The user-level stack is connected to hardware  6  in  FIG. 1 . The hardware could be a network interface card (NIC). 
     In order to perform routing the user-level stack must use a routing table. One option would be for the user-level stack to maintain its own routing tables independently of the OS. However, this would require the user-level stack (in addition to the OS) to have access to all the communications necessary for establishing a routing table. There would then be ambiguity as to where those communications should be directed. Alternatively, the user-level stack may be able to access the routing tables stored by the OS. However, in order to preserve the integrity of the tables that it stores, the OS is likely to perform security checks on any accesses to the tables. Since the user-level stack may have to access the tables very frequently during operation, accessing the routing tables stored by the OS is likely to create a significant workload for the system and so it can be expected to be inefficient for an application to be required to access tables in the OS each time it wishes to transmit data across the network. 
     According to a first aspect of the present invention there is provided a data processing system comprising: an operating system that stores a first network routing table comprising one or more entries each indicating at least part of a route over a network to a respective destination; a transmission support function arranged to maintain a copy of the first network routing table; and a network data transmission function arranged to transmit data in accordance with the copy network routing table and without accessing the first network routing table. 
     The transmission support function could conveniently be internal to the operating system. The network data transmission function could be external to the operating system. The network data transmission function is preferably at user level. 
     The first network routing table could comprise data enabling routing using address resolution protocol. The first network routing table could comprise data enabling routing using transmission control protocol and/or user datagram protocol. 
     The operating system could be arranged to signal to the transmission support function when data stored in the first network routing table is updated. The transmission support function is preferably arranged to check the first network routing table for updates. The network data transmission function is preferably arranged to read the copy network routing table by means of memory mapping, and the memory mapping is preferably read only memory mapping. 
     The data processing system may further comprise a network endpoint and the system could be arranged such that the network endpoint is unable to access the first network routing table directly. The data processing system preferably has a counter and is preferably arranged to maintain the counter by incrementing it each time a change is made to the first network routing table. The operating system may be arranged to transmit data using the first network routing table. 
     The network data transmission function is preferably arranged to transmit the data in accordance with the copy network routing table in the form of packets and to create packet headers for such packets based on information in the copy network routing table. 
     The operating system may be arranged to delete entries from the first network routing table if they are unused. The operating system may be arranged to periodically delete, with a first frequency, unused entries from the first network routing table. 
     The network data transmission function may be arranged to transmit to the operating system signals for causing the operating system to maintain entries in the network routing table. The signals are preferably dedicated messages for maintaining tables in the operating system. The signals could be address resolution protocol reinforce messages. The signals may be sent periodically with a second frequency, and the second frequency is preferably greater than the first frequency. 
     According to a second aspect of the present invention there is provided software for execution by a data processing system comprising: an operating system that stores a first network routing table comprising one or more entries each indicating at least part of a route over a network to a respective destination; the software defining: a transmission support function arranged to maintain a copy of the first network routing table; and a network data transmission function arranged to transmit data in accordance with the copy network routing table and without accessing the first network routing table. According to a third aspect of the present invention there is provided a data carrier carrying software as defined above. 
     In the system to be described below a driver accesses routing tables stored by the kernel of the operating system. The driver preferably resides in the operating system so as to readily access the operating system&#39;s routing tables. The driver maintains a copy of the operating system&#39;s routing tables: conveniently in memory to which the driver has write access and to which a user-level networking function of the system has read access without performing calls on the operating system. The user-level networking function then performs network data transmission operations using the copy routing tables rather than those maintained directly by the kernel. This avoids the need for it to involve the kernel when accessing those tables, which it may preferably do by virtue of a memory mapping. 
       FIG. 3  shows an OS  3  in a computer system having a TCP user-level stack  5 . The OS is provided with a TCP driver or helper  7  supporting the stack  5 . Routing tables  20 ,  21  are maintained in the OS which specify the rules for routing data within a network including the computer system of  FIG. 3 . The tables could be a TCP routing table  20  (which could also be used for UDP) and an address resolution protocol (ARP) table  21 . They specify details such as the interfaces and gateways through which data should be transmitted in order for it to reach a particular destination within the network. The present system may be applied to all routing tables in a system, or only to one or more selected tables. The tables may be for Ethernet protocols such as TCP or for other network protocols. 
     When an application within the computer system of  FIG. 3  wishes to transmit a packet of data it needs to access the tables  20 ,  21  in order to create an appropriate header to ensure that the packet is routed correctly through the network. When TCP packets are to be sent, copies of the tables  20 ′,  21 ′ which are maintained in the TCP driver  7  are accessed by the socket library  2  to avoid the necessity to access the tables directly in the OS. Memory mapping  22  between the driver  7  and the user-level TCP stack  5  enables the stack  5  to access the copy tables  20 ′,  21 ′. Thus, the socket library can simply access the stack  5  in order to obtain the required information from the tables  20 ,  21 . Instead of a memory mapping, all the data defining the tables or updates to them could be transmitted from the driver  7  to the stack  5 . However, this would be less efficient. 
     In order to avoid locking requirements between TCP endpoints which would otherwise be required, each endpoint maintains a generation counter which is incremented as a result of a routing table callback, or any other state change such as an ARP timeout (discussed below) which would render state cached at the endpoints inconsistent. If a TCP endpoint detects that its generation counter has been incremented then it will leave its fast path, which involves accessing cached interface and packet header information, and will instead consult the user-level stack&#39;s tables. 
     It is preferable for the mapping  22  between the driver  7  and the user-level stack  5  to be read only. This prevents the stack  5  from corrupting data in the OS by writing directly to it. Corruption of the original tables would adversely affect other applications running on the OS. In a preferred embodiment the user-level stack  5  is a Level 5 (or L5) stack. The driver  7  is a corresponding L5 driver. 
     In order to keep the copy tables up-to-date the driver  7  registers with the OS to obtain updates of the routing tables via call backs. By this means new data in the tables  20 ,  21  can either be passed directly from the OS to the driver  7 , or alternatively the driver  7  could simply be informed when a change is made to the tables and subsequently access the tables to obtain the new information. Either of these arrangements allows the driver to maintain up-to-date tables without altering the data in the original tables  20 ,  21 . 
     When a TCP packet is to be sent, the data to be transmitted is written to shared memory, and an indication of the destination is passed to the user-level stack. The user-level stack checks in locally stored data to establish whether it already has access to the Ethernet address of the destination. If so, it forms and sends the Ethernet packet directly. If not, it sends a call to the driver which checks its tables  20 ′,  21 ′ to establish the relevant address. If the Ethernet address is not known to the driver, the driver can issue an ARP request for the address over the network. Once a response is received via the OS, the packet can be formed and sent by the user-level stack. 
     Since ARP is a dynamic protocol, entries in the ARP table  21  are held for a predetermined time, say 30 seconds, and then removed if they have not been used. By “used” may be meant accessed for any purpose, although some systems may remove entries if they have been accessed only for a defined subset of purposes in the predetermined time. Although entries in the tables  20 ,  21  may not have been accessed directly, they may have been used indirectly in the copy tables  20 ′,  21 ′. Thus, it could appear to the OS that the entries are redundant even if they are in fact still in use. It is therefore desirable to cause the OS to continue to hold entries which are only being used indirectly through the copy tables rather than permitting them to be deleted after a time-out. In order to achieve this, an embodiment of the invention requires the L5 driver to run a timer which counts the time since an entry was made in the ARP table  21  and when the predetermined time period is reached, the entry is “reinforced” in the table  21  by means of a duplicate entry being sent to the OS by the driver  7 . The predetermined time period counted by the timer is preferably slightly less than the time-out of the ARP table. For example, if the ARP time-out is 30 seconds, the predetermined time period of the timer could be 28 seconds. In this way, a duplicate entry is made in the table just before the previous entry is removed so that there is no time at which an entry for the particular address is not present in the main ARP table  21 . 
     In the preferred embodiment this “reinforce” procedure is carried out for selected ARP entries as follows. The driver checks a table shared with the user-level stack  5  listing active endpoints in the network. If an ARP table entry is for one of these active endpoints then the entry will be reinforced by the driver. Otherwise, it can be allowed to be removed by the OS. 
     The procedures described above can all operate without the addressor system (i.e. the user-level stack) being aware that there is any difference compared with a standard system configuration in which the OS is accessed directly for address data. The driver could be located outside the operating system if the operating system supported providing it with suitable access to the routing tables. 
     The computer system could be a multi-purpose device such as a personal computer or a server. Alternatively it could be a dedicated device such as a network-attached storage (NAS) or web server device. 
     The applicant hereby discloses in isolation each individual feature described herein and any combination of two or more such features, to the extent that such features or combinations are capable of being carried out based on the present specification as a whole in the light of the common general knowledge of a person skilled in the art, irrespective of whether such features or combinations of features solve any problems disclosed herein, and without limitation to the scope of the claims. The applicant indicates that aspects of the present invention may consist of any such individual feature or combination of features. In view of the foregoing description it will be evident to a person skilled in the art that various modifications may be made within the scope of the invention. 
     While various embodiments of the invention have been described, it will be apparent to those of ordinary skill in the art that many more embodiments and implementations are possible that are within the scope of this invention. In addition, the various features, elements, and embodiments described herein may be claimed or combined in any combination or arrangement.