为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

WINDOWS进程管理工具设计与实现—计算机毕业设计(论文)

2017-10-16 50页 doc 353KB 6阅读

用户头像

is_511210

暂无简介

举报
WINDOWS进程管理工具设计与实现—计算机毕业设计(论文)WINDOWS进程管理工具设计与实现—计算机毕业设计(论文) 毕业设计(论文) Windows进程管理工具设计与实现 论文作者姓名: 申请学位专业: 申请学位类别: 指导教师姓名,职称,: 论文提交日期: Windows进程管理工具设计与实现 摘 要 Windows自带的任务管理器存在功能上的缺陷,比如不能查看进程的模块及线程信息。课题设计就是模拟Windows任务管理器,开发一个功能更完善的Windows进程管理软件。主要设计的是一个基于对话框的VC++程序,在主对话框上面放置了一个标签控件,并创建了任务...
WINDOWS进程管理工具设计与实现—计算机毕业设计(论文)
WINDOWS进程管理工具设计与实现—计算机毕业设计() 毕业设计(论文) Windows进程管理工具设计与实现 论文作者姓名: 申请学位专业: 申请学位类别: 指导教师姓名,职称,: 论文提交日期: Windows进程管理工具设计与实现 摘 要 Windows自带的任务管理器存在功能上的缺陷,比如不能查看进程的模块及线程信息。课题设计就是模拟Windows任务管理器,开发一个功能更完善的Windows进程管理软件。主要设计的是一个基于对话框的VC++程序,在主对话框上面放置了一个标签控件,并创建了任务、进程和系统信息三个页面,标签控件用于选择并显示页面。三个页面分别用于显示当前运行的窗口程序、进程及进程模块、系统资源使用情况。程序还实现了结束任务、切换任务、终止进程等对进程管理的基本功能。在程序的设计过程中,通过调用Windows API函数而获得任务、进程、线程模块,以及系统资源使用情况等信息。最后在Windows XP系统上进行测试,实现了进程管理的基本功能,为用户了解当前进程及系统资源使用情况提供了很好的参考。 关键词:任务管理器;线程;进程;API The Design and Implementation of the Processes Management Tool for Windows Abstract There are some defects in the Task Manager built-in Windows. For example, it doesn't show us the information of process modules and threads. The work of my design is to follow the Windows Task Manager and develop the software which has improved function for managing process. This software is designed to be a program based on a dialog write in the VC++. There is a label control in the main dialog box, and there are three pages for task, process and system information. The label control is used to select the page and to show it. The three pages are used respectively to display the information of task runs at current, process and process modules, the utilization of system resources. This software also realized some basic function for managing process, such as ending the task, switching the task, terminating the process and so on. During the process of my program, the information for tasks, process, thread modules and the utilization of system resource is got by calling the Windows API functions. Finally I test it on the Windows XP system. And it achieves the basic function for managing process. It provides a good reference for users to view the process at current and the utilization of system resources. Key words: Task Manager; Threads; Process; API 目 录 论文总页数:25页 1 引言 ..................................................................... 1 1.1 课题背景 ............................................................. 1 1.2 国内外研究现状 ....................................................... 1 1.3 课题研究的意义 ....................................................... 1 课题的研究方法 ....................................................... 1 1.4 1.5 进程与线程简介 ....................................................... 1 1.5.1 进程简介 ......................................................... 1 1.5.2 线程简介 ......................................................... 3 1.5.3 进程与线程的关系 ................................................. 3 1.5.4 Windows自带的任务管理器分析 ..................................... 4 2 主要功能及设计思路 ....................................................... 4 2.1 主要功能 ............................................................. 4 2.2 设计思路 ............................................................. 5 3 详细设计 ................................................................. 5 3.1 主框架的实现 ......................................................... 5 3.1.1 子对话框的显示 ................................................... 6 3.1.2 实现菜单 ......................................................... 7 3.1.3 提升程序权限 ..................................................... 8 3.2 任务列表页面设计 ..................................................... 8 3.2.1 显示任务信息 ..................................................... 8 3.2.2 结束任务 ......................................................... 9 3.2.3 切换任务 ........................................................ 10 3.3 进程列表页面设计 .................................................... 10 3.3.1 显示进程信息 .................................................... 11 3.3.2 显示模块及线程信息 .............................................. 13 3.3.3 结束进程 ........................................................ 15 3.3.4 删除文件 ........................................................ 16 3.3.5 保存进程信息到文件 .............................................. 17 3.4 系统性能页面设计 .................................................... 17 3.4.1 绘制CPU使用率图 ................................................ 17 3.4.2 绘制内存使用率图 ................................................ 19 3.4.3 其他性能显示 .................................................... 19 3.4.4 系统信息显示 .................................................... 20 4 测试结果 ................................................................ 21 4.1 测试环境 ............................................................ 21 4.2 测试方法 ............................................................ 21 4.3 测试结果 ............................................................ 21 结 论 .................................................................... 23 参考文献 .................................................................... 23 致 谢 .................................................................... 24 声 明 .................................................................... 25 1 引言 1.1 课题背景 随着计算机的广泛应用,很多的软件被安装在计算机上,使计算机运行的程序进程越来越多;很多的程序在运行时常出现异常(如不能正常结束、占用大量资源、发现异常的进程等)。这些现象给我们的计算机使用及管理带来很多的不便。为了给计算机上运行的程序进行很好的管理,现在出现了许多的进程管理工具软件。课题设计的目的主要是为了检查综合运用以前所学知识(包括以前所学的一些关于计算机操作系统、进程、计算机安全、编程等知识)的能力,模拟Windows任务管理器,开发一个功能更完善的Windows进程管理软件,对任务、进程进行查看、结束等操作。 1.2 国内外研究现状 从现状看来,Windows进程管理工具及其理论的研究,无论是国外还是国内,技术都相当成熟。微软Windows操作系统系列(98和ME除外)都自带有进程管理器,但功能不是很完善,不能查看进程模块及线程信息,而许多其他版本的Windows进程管理软件都具有完善的功能。 1.3 课题研究的意义 随着计算机技术的迅猛发展,计算机的运用给人们带来了很多便利,无论是学习,办公,还是商务。一款好的系统管理软件能大大地提高计算机的使用和管理效率,进程管理器就能很好地对系统上运行的进程进行管理。很多人都使用过进程管理器之类的软件,或者是Windows自带的任务管理器,它们都能够对进程进行管理。课题设计选择开发一个进程管理器软件,能够使自己综合运用以前所学知识(包括操作系统、编程、系统安全等知识)的能力,同时也使自己了解当今软件编程的一些新技术;既锻炼了自己的实际动手能力,又引导自己进行了一次模拟实际产品的开发,对于自己以后工作能力的培养具有重要的意义。 1.4 课题的研究方法 系统使用VC++ 6.0的开发环境,模拟Windows的任务管理器进行设计与开发。因此,课题设计应首先分析进程管理器软件的相关功能;其次,综合运用以前所学的相关知识,广泛查阅资料(尤其是进程、线程及其相关知识),选择所熟悉的开发工具进行开发;同时,在开发设计与实现中,要保存好相关的设计文挡。 1.5 进程与线程简介 1.5.1 进程简介 进程通常被定义为一个正在运行的程序的实例,它由两个部分组成:一个是 第 1 页 共 25 页 操作系统用来管理进程的内核对象。内核对象也是系统用来存放关于进程的统计信息的地方。另一个是地址空间,它包含所有可执行模块或DLL模块的代码和数据。它还包含动态内存分配的空间。如线程堆栈和堆分配空间。 进程是一个动态的执行过程,它动态地被创建,并被调度执行后消亡。进程是资源分配的基本单位,也是抢占处理机的调度单位,它拥有一个完整的虚拟地址空间。 系统中需要有描述进程存在和能够反应其变化的物理实体,即进程的静态描述。进程的静态描述由三部份组成:进程控件块PCB,有关程序段和该程序段对其进行操作的数据结构集。进程控制块包含了有关进程的描述信息、控制信息以及资源信息,是进程动态特征的集中反应。系统根据PCB感知进程的存在和通过PCB中所包含的各项变量的变化,掌握进程所处的状态以及达到控制进程活动的目的。由于进程的PCB是系统感知进程的唯一实体,因此,在几乎所有的多道操作系统中,一个进程的PCB结构都是全部或部分常驻内存的。 进程的程序部分描述进程所要完成的功能。而数据结构集是程序在执行时必不可少的工作区和操作对象。这两部分是进程完成所需功能的物质基础。由于进程的这两部分内容与控制进程的执行及完成进程功能直接有关,因而,在大部分多道操作系统中,这两部分内容存放在外存中,直到该进程执行时再调入内存。 一个进程的生命周期可以划分为一组状态,这些状态描述了整个进程。系统根据PCB结构中的状态值控制进程。 在进程的整个生命周期内,一个进程至少具有三种基本状态,它们是:执行状态、等待状态和就绪状态。这三种状态之间可以相互换,处于就绪状态的进程已经得到除CPU之外的其它资源,只要由调度得到处理机,便可立即投入执行。处于执行状态的进程因时间片到而放弃处理机进入就绪状态,因等待某个事件发生而放弃处理机进入等待状态。处于等待状态的进程因等待的事件发生而被唤醒进入就绪状态,如图1。 图1 进程状态转换 第 2 页 共 25 页 1.5.2 线程简介 线程是一个进程内的基本调度单位,它既可以由操作系统内核控制,也可由用户程序控制。 线程是由两个部分组成的:一个是线程的内核对象,操作系统用它来对线程实施管理。内核对象也是系统用来存放线程统计信息的地方。另一个是线程堆栈,它用于维护线程在执行代码时需要的所有函数参数和局部变量 线程只由相关的堆栈(系统栈或用户栈)、寄存器和线程控制表TCB组成。寄存器可被用来存储线程内的局部变量,但不能存储其它线程的相关变量。 线程也有三个基本状态:执行状态、就绪状态和阻塞状态。针对线程的三种基本状态,存在五种基本操作来转换线程的状态。这五种基本操作是: 1、派生:线程在进程内派生出来,它既可由进程派生,也可由线程派生。 2、阻塞:如果一个线程在执行过程中需要等待某个事件发生,则被阻塞。 3、激活:如果阻塞线程的事件发生,则该线程被激活并进入就绪队列。 4、调度:选择一个就绪线程进入执行状态。 5、结束:如果一个线程执行结束,它的寄存器上下文以及堆栈内容等将被释放。 1.5.3 进程与线程的关系 进程是不活泼的。若要使进程完成某项操作,它必须拥有一个在它的环境中运行的线程,该线程负责执行包含在进程的地址空间中的代码。实际上,单个进程可能包含若干个线程,所有这些线程都“同时”执行进程地址空间中的代码。 线程与资源分配无关,它属于某一个进程,并与进程内的其它线程一起共享进程的资源。当进程发生调度时,不同的进程拥有不同的虚拟地址空间,而同一进程内的不同线程共享同一地址空间。为此,每个线程都有它自己的一组CPU寄存器和它自己的堆栈。每个进程至少拥有一个线程,来执行进程的地址空间中的代码。如果没有线程来执行进程的地址空间中的代码,那么进程就没有存在的理由了,系统就将自动撤消该进程和它的地址空间。 若要使所有这些线程都能运行,操作系统就要为每个线程安排一定的CPU时间。它通过以一种循环方式为线程提供时间片(称为量程),造成一种假象,仿佛所有线程都是同时运行的一样。图3显示了在单个CPU的计算机上是如何实现这种运行方式的。如果计算机拥有多个CPU,那么操作系统就要使用复杂得多的算法来实现CPU上线程负载的平衡。 当创建一个进程时,系统会自动创建它的第一个线程,称为主线程。然后,该线程可以创建其他的线程,而这些线程又能创建更多的线程。 第 3 页 共 25 页 1.5.4 Windows自带的任务管理器分析 Windows任务管理器由性能、进程、应用程序三大部分组成。其实这三大部分是有机的联系在一起的,尤其是性能和进程,性能中除了CPU使用率以外,其余的数据都是由进程模块顺便取得的。 Windows2000/XP的任务管理器通过 NtQuerySystemInformation 的调用来获取各类信息,如CPU使用率,内存使用率,句柄总数,线程总数,进程总数等等。在任务管理器中的几乎所有信息都是来自该函数。 NtQuerySystemInformation函数隶属Ntdll.dll,是一个未公开的函数。其调用方式为: NTSTATUS NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass,PVOID SystemInformation, ULONG SystemInformationLength,PULONG ReturnLength); SystemInformationClass:在SYSTEM_INFORMATION_CLASS中的枚举值之一, 声明返回信息的种类; SystemInformation:指到一个要求返回信息的缓冲区,这个系统信息变量的尺寸和结构依赖于SystemInformationClass参数的值; SystemInformationLength:SystemInformation参数指定的缓冲区尺寸; ReturnLength:返回值尺寸。 这个函数是一个正在修改的函数,在Windows2000和Windows XP中可用,但在Windows 98和Windows Me中不可用。而且该函数调用的入口参数非常之多,调用复杂。因此,在此次进程管理器的开发中,将使用其它方法来获取各类信息。 2 主要功能及设计思路 2.1 主要功能 设计要求实现的主要功能——进程管理功能,具体包括以下内容: (1)任务管理:列出所有当前运行的窗口程序名、运行状态等信息;对它们进行终止、切换等操作。 (2)进程管理:列出所有的Windows进程,以及进程所在的磁盘绝对路径,进程消耗资源状况等;列出所有进程的相关模块挂载名,模块所在磁盘的绝对路径以及进程的线程情况,包括资源占用情况、所在内存空间地址等;除核心进程外,所有的其他进程均可以被终止,能够尽量不丢失信息,在提升本管理进程级别后,也能够对系统的核心进程终止。; (3)系统性能显示:绘制CPU、内存使用率图,以描述系统性能;列出物理内存、虚拟内存和页文件的使用情况;显示系统当前信息,包括系统名、计算机名和用户名等。 第 4 页 共 25 页 2.2 设计思路 在Visual C++ 6.0环境设计一个基于对话框的应用程序,类似于Windows自带的任务管理器,主窗口上添加一个标签控件,加入三个页面,分别是:任务、进程和系统性能信息。 其中,任务页面显示当前正在运行的任务(可见且有窗口标题),用列表控件进行显示,并能够对任务进行操作,如:添加新任务,结束任务,切换任务等。 进程页面显示当前系统正在运行的进程及相关的模块,线程等,用列表控件进行显示,并能够实行终止进程、进程列表保存到文件等操作。 系统性能页面显示物理内存、虚拟内存和页文件等详细使用情况,CPU、内存的使用率,并绘制CPU使用率和内存使用率的图形,并用列表控件显示系统当前信息(系统名、计算机名和当前用户等)。 3 详细设计 程序主界面如图2。 在主界面上面设置了一个标签控件,并创建了任务列表、进程列表和系统信息三个页面,标签控件用于选择并显示页面。三个页面分别用于显示当前运行的窗口程序、进程及进程模块、系统资源使用情况。 图2 主界面 3.1 主框架的实现 所设计的程序是基于对话框的程序。首先创建一个基于对话框的应用程序PcsMgr.exe, 在主对话框类PcsMgrDlg中添加一个标签控件用于放置任务、进程 第 5 页 共 25 页 和系统信息等三个页面,如图3。 图3 标签控件 3.1.1 子对话框的显示 子对话框的显示与切换,是通过标签控件完成的。当用户点击标签控件上的 每一项时,分别显示对应页面的相关信息。 要显示三个子对话框,需要添加三个对话框到中,并将Style属性设为 Child,Board设为None,取消标题栏。再分别创建三个对话框的类CTask , CProcess,CChart,并定义这三个类的变量: CTask m_Task; //任务 CProcess m_Process; //进程 CChart m_Chart; //图表 并定义一个图像列表变量用于存放标签图标:CImageList m_ImageList; 接下来就创建子窗口: m_Task.Create(IDD_TASK,m_Tab.GetActiveWindow()); m_Process.Create(IDD_PROCESS,m_Tab.GetActiveWindow()); m_Chart.Create(IDD_CHART,m_Tab.GetActiveWindow()); 当用户选择标签中的一项是,为了将对应的对话框在标签控件中显示出来, 需要在OnShowWindow(BOOL bShow,UINT nStatus)中添加代码相关代码。这样便 可将在个对话框分别显示于标签控件的每个页面中,但要实现选择标签的不同项 显示不同页面还需在OnSelchangeMaintab(NMHDR* pNMHDR,LRESULT* pResult) 和OnSelchangingMaintab(NMHDR* pNMHDR,LRESULT* pResult)两函数中添加显 示代码。 void CPcsMgrDlg::OnSelchangeMaintab(NMHDR* pNMHDR, LRESULT* pResult) { switch(m_Tab.GetCurSel()) { case 0:m_Task.ShowWindow(SW_SHOW);//任务页面被选中,则显示任务 页面 m_Task.CenterWindow(); 第 6 页 共 25 页 break; case 1:m_Process.ShowWindow(SW_SHOW); //任务页面被选中,则显示进程页面 m_Process.CenterWindow(); break; case 2:m_Chart.ShowWindow(SW_SHOW); //任务页面被选中,则显示系统信息页面 m_Chart.CenterWindow(); break; } } 3.1.2 实现菜单 关机、注销、重起菜单命令是通过调用一个Windows API函数ExitWindowsEx() 完成的。但在Windows 98和Windows 2000实现稍有不同。ExitWindowsEx()函数定义格式: BOOL ExitWindowsEx( UINT uFlags //操作 DWORD dwReason //原因 ); 在Windows 98实现“注销/重启/关机”功能将直接调用ExitWindiwsEx函数: ExitWindowsEx(EWX_LOGOFF,0); // 注销 ExitWindowsEx(EWX_REBOOT,0); // 重启 ExitWindowsEx(EWX_SHUTDOWN,0); // 关机 在Windows 2000实现“注销/重启/关机”功能须取得高级权限: LookupPrivilegeValue(NULL,SE_SHUTDOWN_NAME,&tkp.Privileges[0].Lui d); tkp.PrivilegeCount = 1; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges(hToken,FALSE,&tkp,0,(PTOKEN_PRIVILEGES)NULL ,0); ExitWindowsEx(FFlag,0); 新建菜单直接调用系统运行对话框: RUN RunFileDlg; 第 7 页 共 25 页 RunFileDlg = (RUN)GetProcAddress(hShell32, MAKEINTRESOURCE(61)); 开机自动运行可在注册表的主键”HKEY_LOCAL_MACHINE”下的运行子键”Software\Microsoft\Windows\CurrentVersion\Run”下写入和删除一个键值的方法实现。 3.1.3 提升程序权限 为了能够终止所有进程,需要提升本进程的权限: 1、先调用GetCurrentProcess函数取得当前进程的句柄; 2、然后调用OpenProcessToken打开当前进程的访问令牌; 3、接着调用LookupPrivilegeValue函数取得你想提升的权限的值; 4、最后调用AdjustTokenPrivileges函数给当前进程的访问令牌增加权限。 相关代码是在CPcsMgrApp类的InitInstance()函数中添加。 3.2 任务列表页面设计 该类实现当前系统运行任务(有可见窗口的程序)的管理,如查看当前任务,添加新任务,结束任务,切换任务等。 3.2.1 显示任务信息 任务信息包括窗口中可见程序的程序名、路径、运行状态等信息,将在任务列表页面中添加一个列表控件,用于将任务信息显示出来,如图4。 图4 任务列表 要显示桌面窗口中的任务信息,首先要一个结构体类型用于存放任务的相关信息: typedef struct { CString strTaskName; //窗口标题 DWORD dwProcessID; //进程ID DWORD dwThreadID; //线程ID 第 8 页 共 25 页 CString strRunState; //运行状态 DWORD dwWndHandle; //窗口句柄 }TASK_IFNO,*PTASK_INFO; 获取窗口标题,使用API函数GetWindowText (): char temp[MAX_PATH]; GetWindowText(hwnd,temp,sizeof(temp)) 获取进程及线程ID: TID=GetWindowThreadProcessId(hwnd,&PID); 确定运行状态是利用SendMessageTimeout向窗口发送消息而取得: if(SendMessageTimeout(hwnd,WM_SYSCOMMAND,NULL,NULL,SMTO_ABORTIFHU NG,1000,NULL)) strRunState = "正在运行"; else strRunState = "没有响应"; 然后添加任务信息到数组: TASK_IFNO ti; ti.strTaskName = temp; ti.dwProcessID = PID; ti.dwThreadID = TID; ti.dwWndHandle = (DWORD)hwnd; ti.strRunState = strRunState; pTaskThis->m_TaskInfoArray.Add(ti); 最后把任务信息的每一行在任务列表中显示出来: for(int i=0;i规定
,其中包括: (1)学校有权保管并向有关部门递交学位论文的原件与复印件。 (2)学校可以采用影印、缩印或其他复制方式保存学位论文。 (3)学校可以学术交流为目的复制、赠送和交换学位论文。 (4)学校可允许学位论文被查阅或借阅。 (5)学校可以公布学位论文的全部或部分内容(保密学位论文在解密后遵守此规定)。 除非另有科研和其他法律文书的制约,本论文的科研成果属于成都信息工程学院。 特此声明~ 作者签名: 2007年06月 日 第 25 页 共 25 页 FROM my father I received the best inheritance, namely a "good temper." "And who was my father?" That has nothing to do with the good temper; but I will say he was lively, good-looking round, and fat; he was both in appearance and character a complete contradiction to his profession. "And pray what was his profession and his standing in respectable society?" Well, perhaps, if in the beginning of a book these were written and printed, many, when they read it, would lay the book down and say, "It seems to me a very miserable title, I don't like things of this sort." And yet my father was not a skin-dresser nor an executioner; on the contrary, his employment placed him at the head of the grandest people of the town, and it was his place by right. He had to precede the bishop, and even the princes of the blood; he always went first,- he was a hearse driver! There, now, the truth is out. And I will own, that when people saw my father perched up in front of the omnibus of death, dressed in his long, wide, black cloak, and his black-edged, three-cornered hat on his head, and then glanced at his round, jocund face, round as the sun, they could not think much of sorrow or the grave. That face said, "It is nothing, it will all end better than people think." So I have inherited from him, not only my good temper, but a habit of going often to the churchyard, which is good, when done in a proper humor; and then also I take in the Intelligencer, just as he used to do. I am not very young, I have neither wife nor children, nor a library, but, as I said, I read the Intelligencer, which is enough for me; it is to me a delightful paper, and so it was to my father. It is of great use, for it contains all that a man requires to know; the names of the preachers at the church, and the new books which are published; where houses, servants, clothes, and provisions may be obtained. And then what a number of subscriptions to charities, and what innocent verses! Persons seeking interviews and engagements, all so plainly and naturally stated. Certainly, a man who takes in the Intelligencer may live merrily and be buried contentedly, and by the end of his life will have such a capital stock of paper that he can lie on a soft bed of it, unless he prefers wood shavings for his resting-place. The newspaper and the churchyard were always exciting objects to me. My walks to the latter were like bathing-places to my good humor. Every one can read the newspaper for himself, but come with me to the churchyard while the sun shines and the trees are green, and let us wander among the graves. Each of them is like a closed book, with the back uppermost, on which we can read the title of what the book contains, but nothing more. I had a great deal of information from my father, and I have noticed a great deal myself. I keep it in my diary, in which I write for my own use and pleasure a history of all who lie here, and a few more beside. Now we are in the churchyard. Here, behind the white iron railings, once a rose-tree grew; it is gone now, but a little bit of evergreen, from a neighboring grave, stretches out its green tendrils,and makes some appearance; there rests a very unhappy man, and yet while he lived he might be said to occupy a very good position. He had enough to live upon, and something to spare; but owing to his refined tastes the least thing in the world annoyed him. If he went to a theatre of an evening, instead of enjoying himself he would be quite annoyed if the machinist had put too strong a light into one side of the moon, or if the representations of the sky hung over the scenes when they ought to have hung behind them; or if a palm-tree was introduced into a scene representing the Zoological Gardens of Berlin, or a cactus in a view of Tyrol, or a beech-tree in the north of Norway. As if these things were of any consequence! Why did he not leave them alone? Who would trouble themselves about such trifles? especially at a comedy, where every one is expected to be amused. Then sometimes the public applauded too much, or too little, to please him. "They are like wet wood," he would say, looking round to see what sort of people were present, "this evening; nothing fires them." Then he would vex and fret himself because they did not laugh at the right time, or because they laughed in the wrong places; and so he fretted and worried himself till at last the unhappy man fretted himself into the grave. Here rests a happy man, that is to say, a man of high birth and position, which was very lucky for him, otherwise he would have been scarcely worth notice. It is beautiful to observe how wisely nature orders these things. He walked about in a coat embroidered all over,and in the drawing-rooms of society looked just like one of those rich pearl-embroidered bell-pulls, which are only made for show; and behind them always hangs a good thick cord for use. This man also had a stout, useful substitute behind him, who did duty for him, and performed all his dirty work. And there are still, even now, these serviceable cords behind other embroidered bell-ropes. It is all so wisely arranged, that a man may well be in a good humor. Here rests,- ah, it makes one feel mournful to think of him!-but here rests a man who, during sixty-seven years, was never remembered to have said a good thing; he lived only in the hope of having a good idea. At last he felt convinced, in his own mind, that he really had one, and was so delighted that he positively died of joy at the thought of having at last caught an idea. Nobody got anything by it; indeed, no one even heard what the good thing was. Now I can imagine that this same idea may prevent him from resting quietly in his grave; for suppose that to produce a good effect, it is necessary to bring out his new idea at breakfast, and that he can only make his appearance on earth at midnight, as ghosts are believed generally to do; why then this good idea would not suit the hour, and the man would have to carry it down again with him into the grave- that must be a troubled grave. The woman who lies here was so remarkably stingy, that during her life she would get up in the night and mew, that her neighbors might think she kept a cat. What a miser she was! Here rests a young lady, of a good family, who would always make her voice heard in society, and when she sang "Mi manca la voce,"* it was the only true thing she ever said in her life. * "I want a voice," or, "I have no voice." Here lies a maiden of another description. She was engaged to be married,- but, her story is one of every-day life; we will leave her to rest in the grave. Here rests a widow, who, with music in her tongue, carried gall in her heart. She used to go round among the families near, and search out their faults, upon which she preyed with all the envy and malice of her nature. This is a family grave. The members of this family held so firmly together in their opinions, that they would believe in no other. If the newspapers, or even the whole world, said of a certain subject, "It is so-and-so;" and a little schoolboy declared he had learned quite differently, they would take his assertion as the only true one, because he belonged to the family. And it is well known that if the yard-cock belonging to this family happened to crow at midnight, they would declare it was morning, although the watchman and all the clocks in the town were proclaiming the hour of twelve at night. The great poet Goethe concludes his Faust with the words, "may be continued;" so might our wanderings in the churchyard be continued. I come here often, and if any of my friends, or those who are not my friends, are too much for me, I go out and choose a plot of ground in which to bury him or her. Then I bury them, as it were; there they lie, 第 26 页 共 25 页 dead and powerless, till they come back new and better characters. Their lives and their deeds, looked at after my own fashion, I write down in my diary, as every one ought to do. Then, if any of our friends act absurdly, no one need to be vexed about it. Let them bury the offenders out of sight, and keep their good temper. They can also read the Intelligencer, which is a paper written by the people, with their hands guided. When the time comes for the history of my life, to be bound by the grave, then they will write upon it as my epitaph- "The man with a cheerful temper." E OLD MAN DOES IS ALWAYS RIGHT by Hans Christian Andersen I WILL tell you a story that was told me when I was a little boy. Every time I thought of this story, it seemed to me more and more charming; for it is with stories as it is with many people- they become better as they grow older. I have no doubt that you have been in the country, and seen a very old farmhouse, with a thatched roof, and mosses and small plants growing wild upon it. There is a stork's nest on the ridge of the gable, for we cannot do without the stork. The walls of the house are sloping, and the windows are low, and only one of the latter is made to open. The baking-oven sticks out of the wall like a great knob. An elder-tree hangs over the palings; and beneath its branches, at the foot of the paling, is a pool of water, in which a few ducks are disporting themselves. There is a yard-dog too, who barks at all corners. Just such a farmhouse as this stood in a country lane; and in it dwelt an old couple, a peasant and his wife. Small as their possessions were, they had one article they could not do without, and that was a horse, which contrived to live upon the grass which it found by the side of the high road. The old peasant rode into the town upon this horse, and his neighbors often borrowed it of him, and paid for the loan of it by rendering some service to the old couple. After a time they thought it would be as well to sell the horse, or exchange it for something which might be more useful to them. But what might this something be? "You'll know best, old man," said the wife. "It is fair-day to-day; so ride into town, and get rid of the horse for money, or make a good exchange; whichever you do will be right to me, so ride to the fair." And she fastened his neckerchief for him; for she could do that better than he could, and she could also tie it very prettily in a double bow. She also smoothed his hat round and round with the palm of her hand, and gave him a kiss. Then he rode away upon the horse that was to be sold or bartered for something else. Yes, the old man knew what he was about. The sun shone with great heat, and not a cloud was to be seen in the sky. The road was very dusty; for a number of people, all going to the fair, were driving, riding, or walking upon it. There was no shelter anywhere from the hot sunshine. Among the rest a man came trudging along, and driving a cow to the fair. The cow was as beautiful a creature as any cow could be. "She gives good milk, I am certain," said the peasant towe could keep him in the room with us. Perhaps it would 第 27 页 共 25 页 be more profitable to have a sheep than a cow. Shall I exchange?" The man with the sheep was quite ready, and the bargain was quickly made. And then our peasant continued his way on the high-road with his sheep. Soon after this, he overtook another man, who had come into the road from a field, and was carrying a large goose under his arm. "What a heavy creature you have there!" said the peasant; "it has plenty of feathers and plenty of fat, and would look well tied to a string, or paddling in the water at our place. That would be very useful to my old woman; she could make all sorts of profits out of it. How often she has said, 'If now we only had a goose!' Now here is an opportunity, and, if possible, I will get it for her. Shall we exchange? I will give you my sheep for your goose, and thanks into the bargain." The other had not the least objection, and accordingly the exchange was made, and our peasant became possessor of the goose. By this time he had arrived very near the town. The crowd on the high road had been gradually increasing, and there was quite a rush of men and cattle. The cattle walked on the path and by the palings, and at the turnpike-gate they even walked into the toll-keeper's potato-field, where one fowl was strutting about with a string tied to its leg, for fear it should take fright at the crowd, and run away and get lost. The tail-feathers of the fowl were very short, and it winked with both its eyes, and looked very cunning, as it said "Cluck, cluck." What were the thoughts of the fowl as it said this I cannot tell you; but directly our good man saw it, he thought, "Why that's the finest fowl I ever saw in my life; it's finer than our parson's brood hen, upon my word. I should like to have that fowl. Fowls can always pick up a few grains that lie about, and almost keep themselves. I think it would be a good exchange if I could get it for my goose. Shall we exchange?" he asked the toll-keeper. hapter I of Volume I IT is a truth universally acknowledged, that a single man in possession of a good fortune must be in want of a wife. However little known the feelings or views of such a man may be on his first entering a neighbourhood, this truth is so well fixed in the minds of the surrounding families, that he is considered as the rightful property of some one or other of their daughters. ``My dear Mr. Bennet,'' said his lady to him one day, ``have you heard that Netherfield Park is let at last?'' Mr. Bennet replied that he had not. ``But it is,'' returned she; ``for Mrs. Long has just been here, and she told me all about it.'' Mr. Bennet made no answer. ``Do not you want to know who has taken it?'' cried his wife impatiently. ``You want to tell me, and I have no objection to hearing it.'' This was invitation enough. ``Why, my dear, you must know, Mrs. Long says that Netherfield is taken by a young man of large fortune from the north of England; that he came down on Monday in a chaise and four to see the place, and was so much delighted with it that he agreed with Mr. Morris immediately; that he is to take possession before Michaelmas, and some of his servants are to be in the house by the end of next week.'' ``What is his name?'' ``Bingley.'' ``Is he married or single?'' ``Oh! single, my dear, to be sure! A single man of large fortune; four or five thousand a year. What a fine thing for our girls!'' ``How so? how can it affect them?'' ``My dear Mr. Bennet,'' replied his wife, ``how can you be so tiresome! You must know that I am thinking of his marrying one of them.'' ``Is that his design in settling here?'' ``Design! nonsense, how can you talk so! But it is very likely that he may fall in love with one of them, and therefore you must visit him as soon as he comes.'' 第 28 页 共 25 页 ``I see no occasion for that. You and the girls may go, or you may send them by themselves, which perhaps will be still better; for, as you are as handsome as any of them, Mr. Bingley might like you the best of the party.'' ``My dear, you flatter me. I certainly have had my share of beauty, but I do not pretend to be any thing extraordinary now. When a woman has five grown up daughters, she ought to give over thinking of her own beauty.'' ``In such cases, a woman has not often much beauty to think of.'' ``But, my dear, you must indeed go and see Mr. Bingley when he comes into the neighbourhood.'' ``It is more than I engage for, I assure you.'' ``But consider your daughters. Only think what an establishment it would be for one of them. Sir William and Lady Lucas are determined to go, merely on that account, for in general, you know they visit no new comers. Indeed you must go, for it will be impossible for us to visit him, if you do not.'' ``You are over-scrupulous, surely. I dare say Mr. Bingley will be very glad to see you; and I will send a few lines by you to assure him of my hearty consent to his marrying which ever he chuses of the girls; though I must throw in a good word for my little Lizzy.'' ``I desire you will do no such thing. Lizzy is not a bit better than the others; and I am sure she is not half so handsome as Jane, nor half so good humoured as Lydia. But you are always giving her the preference.'' ``They have none of them much to recommend them,'' replied he; ``they are all silly and ignorant like other girls; but Lizzy has something more of quickness than her sisters.'' ``Mr. Bennet, how can you abuse your own children in such way? You take delight in vexing me. You have no compassion on my poor nerves.'' ``You mistake me, my dear. I have a high respect for your nerves. PERSONS OF THE DIALOGUE: An ATHENIAN STRANGER; CLEINIAS, aCretan; MEGILLUS, a Lacedaemonian Athenian Stranger. Tell me, Strangers, is a God or some man supposedto be the author of your laws? Cleinias. A God, Stranger; in very truth a, God: among us Cretans heis said to have been Zeus, but in Lacedaemon, whence our friend herecomes, I believe they would say that Apollo is their lawgiver: wouldthey not, Megillus? Megillus. Certainly. Ath. And do you, Cleinias, believe, as Homer tells, that every ninthyear Minos went to converse with his Olympian sire, and was inspiredby him to make laws for your cities? Cle. Yes, that is our tradition; and there was Rhadamanthus, abrother of his, with whose name you are familiar; he is reputed tohave been the justest of men, and we Cretans are of opinion that heearned this reputation from his righteous administration of justicewhen he was alive. Ath. Yes, and a noble reputation it was, worthy of a son of Zeus. Asyou and Megillus have been trained in these institutions, I dare saythat you will not be unwilling to give an account of your governmentand laws; on our way we can pass the time pleasantly in about them,for I am told that the distance from Cnosus to the cave and templeof Zeus is considerable; and doubtless there are shady places underthe lofty trees, which will protect us from this scorching sun.Being no longer young, we may often stop to rest beneath them, and getover the whole journey without difficulty, beguiling the time byconversation. Cle. Yes, Stranger, and if we proceed onward we shall come to grovesof cypresses, which are of rare height and beauty, and there are greenmeadows, in which we may repose and converse. Ath. Very good. Cle. Very good, indeed; and still better when we see them; let usmove on cheerily. Ath. I am willing-And first, I want to know why the law has ordainedthat you shall have common meals and gymnastic exercises, and weararms. Cle. I think, Stranger, that the aim of our institutions is easilyintelligible to any one. Look at the character of our country: Creteis not like Thessaly, a large plain; and for this reason they havehorsemen in Thessaly, and we have runners-the inequality of the groundin our country is more adapted to locomotion on foot; but then, if youhave runners you must have light arms-no one can carry a heavyweight when running, and bows and arrows are convenient because theyare light. Now all these regulations have been made with a view towar, and the legislator appears to me to have looked to this in allhis arrangements:-the common meals, if I am not mistaken, wereinstituted by him for a similar reason, because he saw that while theyare in the field the citizens are by the nature of the casecompelled to take their meals together for the sake of mutualprotection. He seems to me to have thought the world foolish in notunderstanding that all are always at war with one another; and if inwar there ought to be common meals and certain persons regularlyappointed under others to protect an army, they should be continued inpeace. For what men in general term peace would be said by him to beonly a name; in reality every city is in a natural state of war withevery other, not indeed proclaimed by heralds, but everlasting. And ifyou look closely, you will find that this was the intention of theCretan legislator; all institutions, private as well as public, werearranged by him with a view to war; in giving them he was under theimpression that no possessions or institutions are of any value to himwho is defeated in battle; for all the good things of the conqueredpass into the hands of the conquerors. Ath. You appear to me, Stranger, to have been thoroughly trainedin the Cretan institutions, and to be well informed about them; willyou tell me a little more explicitly what is the principle ofgovernment which you would lay down? You seem to imagine that a wellgoverned state ought to be so ordered as to conquer all other statesin war: am I right in supposing this to be your meaning? Cle. Certainly; and our Lacedaemonian friend, if I am notmistaken, will agree with me. Meg. Why, my good friend, how could any Lacedaemonian say anythingelse? 第 29 页 共 25 页 Ath. And is what you say applicable only to states, or also tovillages? Cle. To both alike. Ath. The case is the same? Cle. Yes. an Stranger. And now we have to consider whether the insightinto human nature is the only benefit derived from well orderedpotations, or whether there are not other advantages great and much tobe desired. The argument seems to imply that there are. But how and inwhat way these are to be attained, will have to be consideredattentively, or we may be entangled in error. Cleinias. Proceed. Ath. Let me once more recall our doctrine of right education; which,if I am not mistaken, depends on the due regulation of convivialintercourse. Cle. You talk rather grandly. Ath. Pleasure and pain I maintain to be the first perceptions ofchildren, and I say that they are the forms under which virtue andvice are originally present to them. As to wisdom and true and fixedopinions, happy is the man who acquires them, even when declining inyears; and we may say that he who possesses them, and the blessingswhich are contained in them, is a perfect man. Now I mean by educationthat training which is given by suitable habits to the first instinctsof virtue in children;-when pleasure, and friendship, and pain, andhatred, are rightly implanted in souls not yet capable ofunderstanding the nature of them, and who find them, after they haveattained reason, to be in harmony with her. This harmony of thesoul, taken as a whole, is virtue; but the particular training inrespect of pleasure and pain, which leads you always to hate whatyou ought to hate, and love what you ought to love from thebeginning of life to the end, may be separated off; and, in my view,will be rightly called education. Cle. I think, Stranger, that you are quite right in all that youhave said and are saying about education. Ath. I am glad to hear that you agree with me; for, indeed, thediscipline of pleasure and pain which, when rightly ordered, is aprinciple of education, has been often relaxed and corrupted inhuman life. And the Gods, pitying the toils which our race is bornto undergo, have appointed holy festivals, wherein men alternaterest with labour; and have given them the Muses and Apollo, the leaderof the Muses, and Dionysus, to be companions in their revels, thatthey may improve their education by taking part in the festivals ofthe Gods, and with their help. I should like to know whether acommon saying is in our opinion true to nature or not. For men saythat the young of all creatures cannot be quiet in their bodies orin their voices; they are always wanting to move and cry out; someleaping and skipping, and overflowing with sportiveness and delight atsomething, others uttering all sorts of cries. But, whereas theanimals have no perception of order or disorder in their movements,that is, of rhythm or harmony, as they are called, to us, the Gods,who, as we say, have been appointed to be our companions in the dance,have given the pleasurable sense of harmony and rhythm; and so theystir us into life, and we follow them, joining hands together indances and songs; and these they call choruses, which is a termnaturally expressive of cheerfulness. Shall we begin, then, with theacknowledgment that education is first given through Apollo and theMuses? What do you say? Cle. I assent. Ath. And the uneducated is he who has not been trained in thechorus, and the educated is he who has been well trained? Cle. Certainly. Ath. And the chorus is made up of two parts, dance and song? Cle. Trheir faces differ? Ath. Good, my friend; I may observe, however, in passing, that inmusic there certainly are figures and there are melodies: and music isconcerned with harmony and rhythm, so that you may speak of a melodyor figure having good rhythm or good harmony-the term is correctenough; but to speak metaphorically of a melody or figure having a"good colour," as the masters of choruses do, is not allowable,although you can speak of the melodies or figures of the brave and thecoward, praising the one and censuring the other. And not to betedious, let us say that the figures and melodies which are expressiveof virtue of soul or body, or of images of virtue, are withoutexception good, and those which are expressive of vice are the reverseof good. Cle. Your suggestion is excellent; and let us answer that thesethings are so. Ath. Once more, are all of us equally delighted with every sort ofdance? Cle. Far otherwise. Ath. What, then, leads us astray? Are beautiful things not thesame to us all, or are they the same in themselves, but not in 第 30 页 共 25 页
/
本文档为【WINDOWS进程管理工具设计与实现—计算机毕业设计(论文)】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索