1、 ( 本科毕业设计外文文献翻译 学校代码: XXX 学 号: XXX 学生姓名 : XXX 学 院 : 信 息 工 程 学 院 系 别: 计算机系 专 业: 软件工程 班 级: 软件 06 指导教师 : XXX 副 教 授 二 一 年 六 月 XXX 工业大学本科毕业设计外文文献翻译 1 Process Management The process is one of the fundamental abstractions in Unix operating systems. A process is a program(object code stored on some media) i
2、n execution. Processes are, however, more than just the executingprogram code (often called the text section in Unix). They also include a set of resources such as open files and pending signals, internal kernel data, processor state, an address space, one or more threads ofexecution, and a data sec
3、tion containing global variables. Processes, in effect, are the living result of running program code. Threads of execution, often shortened to threads, are the objects of activity within the process. Each thread includes a unique program counter, process stack, and set of processor registers. The k
4、ernel schedules individual threads, not processes. In traditional Unix systems, each process consists of one thread. In modern systems, however, multithreaded programsthose that consist of more than one threadare common. Linux has a unique implementation of threads: It does not differentiate between
5、 threads and processes. To Linux, a thread is just a special kind of process. On modern operating systems, processes provide two virtualizations: a virtualized processor and virtual memory. The virtual processor gives the process the illusion that it alone monopolizes the system, despite possibly sh
6、aring the processor among dozens of other processes. discusses this virtualization. Virtual memory lets the process allocate and manage memory as if it alone owned all the memory in the system. Interestingly, note that threads share the virtual memory abstraction while each receives its own virtuali
7、zed processor. A program itself is not a process; a process is an active program and related resources. Indeed, two or more processes can exist that are executing the same program. In fact, two or more processes can exist that share various resources, such as open files or an address space. A proces
8、s begins its life when, not surprisingly, it is created. In Linux, this occurs by means of the fork()system call, which creates a new process by duplicating an existing one. The process that calls fork() is the parent, whereas the new process is the child. The parent resumes execution and the child
9、starts execution at the same place, where the call returns. The fork() system call returns from the kernel twice:once in the parent process and again in the newborn child. XXX 工业大学本科毕业设计外文文献翻译 2 Often, immediately after a fork it is desirable to execute a new, different, program. The exec*() family
10、of function calls is used to create a new address space and load a new program into it. In modern Linux kernels, fork() is actually implemented via the clone() system call, which is discussed in a followingsection. Finally, a program exits via the exit() system call. This function terminates the pro
11、cess and frees all its resources. A parent process can inquire about the status of a terminated child via the wait4() system call, which enables a process to wait for the termination of a specific process. When a process exits, it is placed into a special zombie state that is used to represent termi
12、nated processes until the parent calls wait() or waitpid(). Another name for a process is a task. The Linux kernel internally refers to processes as tasks. although when I say task I am generally referring to a process from the kernels point of view. 1 Process Descriptor and the Task Structure The k
13、ernel stores the list of processes in a circular doubly linked list called the task list. Each element in the task list is a process descriptor of the type struct task_struct, which is defined in .The process descriptor contains all the information about a specific process. The task_struct is a rela
14、tively large data structure, at around 1.7 kilobytes on a 32-bit machine. This size,however, is quite small considering that the structure contains all the information that the kernel has and needs about a process. The process descriptor contains the data that describes the executing programopen fil
15、es, the processs address space, pending signals, the processs state, and much more 2 Allocating the Process Descriptor The task_struct structure is allocated via the slab allocator to provide object reuse and cache coloring Prior to the 2.6 kernel series, struct task_struct was stored at the end of the kernel stack of each process. This allowed architectures with few registers, such as x86, to calculate the location of the process descriptor via the stack pointer without using an extra register to store the location. With the process descriptor now dynamically created via the slab