The object-oriented structure of Windows facilitates the development of a general- purpose process facility.Windows makes use of two types of process-related objects: processes and threads.A process is an entity corresponding to a user job or applica- tion that owns resources,such as memory,and opens files.A thread is a dispatchable unit of work that executes sequentially and is interruptible,so that the processor can turn to another thread. Each Windows process is represented by an object whose general structure is shown in Figure 4.13a.Each process is defined by a number of attributes and encap- sulates a number of actions,or services,that it may perform.A process will perform a service when called upon through a set of published interface methods. When Windows creates a new process, it uses the object class, or type, defined for the Windows process as a template to generate a new object instance. At the time of creation, attribute values are assigned. Table 4.3 gives a brief definition of each of the object attributes for a process object. A Windows process must contain at least one thread to execute.That thread may then create other threads. In a multiprocessor system, multiple threads from the same process may execute in parallel.Figure 4.13b depicts the object structure for a thread object, and Table 4.4 defines the thread object attributes. Note that some of the attributes of a thread resemble those of a process. In those cases, the thread attribute value is derived from the process attribute value.For example,the thread processor affinity is the set of processors in a multiprocessor system that may execute this thread; this set is equal to or a subset of the process processor affinity. Note that one of the attributes of a thread object is context.This information enables threads to be suspended and resumed. Furthermore, it is possible to alter the behavior of a thread by altering its context when it is suspended.
No comments:
Post a Comment