进程与线程简介

 

文章来源:http://www.sf.org.cn/blog/symbianapi/symbianossdk/symbianosguide/base/usinguserlibrary/memorymanagement/concepts/200605/18310.html

 

Introduction to threads and processes
进程与线程简介

Programs consist of a number of processes, each of which contains one or more conceptually concurrent threads of execution.
程序包含了若干进程,每一个进程包含了一个或多个概念上知执行的线程。

 

A thread is the unit of execution within a process. Every time a process is initialised, a primary thread is created. For many applications the primary thread is the only one that the application requires; however, processes can create additional threads.
线程是进程的执行单元。当进程被初始化后,主线程就被创建了。对于绝大多数的应用程序来说,通常仅要求有一个主线程。尽管如此进程也可以创建额外的线程。


Each user process has its own private address space, i.e. a collection of memory regions which that process can access. A user process cannot directly address memory areas in the address space of another process. There is also a special process, the Kernel process, whose threads run at supervisor privilege level. This process normally contains two threads:
每一个用户进程拥有自己私有的地址空间,也就是说,进程拥有一定的可被其访问的内存区域。一个用户进程不可以直接访问其他进程的地址空间。另外还有一个特殊的进程,内核进程,它运行在超级用户权限模式。这个进程通常包括两个线程:

 

the Kernel server thread, which is the initial thread whose execution begins at the reset vector, and which is used to implement all Kernel functions requiring allocation or deallocation on the Kernel heap. This is the highest priority thread in the system.

Kernel server (内核服务器)线程:是一个初始的进程,在系统启动时就已经存在。它可以在heap执行由核心函数请求的内存分配或内存的重分配。这是系统中具有最高权限的线程。

 

the null thread, which runs only when no other threads are ready to run. The null thread places the processor into idle mode to save power.

null (空)线程:当系统中没有其他可运行的线程时这个线程就开始运行,null 线程使处理器处于空闲状态,减少耗电。

 

Threads execute individually and are unaware of other threads in a process. The scheduling of threads is pre-emptive, i.e. a currently executing thread may be suspended at any time to allow another thread to run.

线程是独立运行的,它且并不知道进程中还有其他线程存在。线程的执行是抢占式的,也就是说,当前运行的线程在任何时候都可能被挂起,以便另外一个线程可以运行。

 

Each thread is assigned a priority; at any time, the thread running is the highest priority thread which is ready to run. Threads with equal priority are time-sliced on a round-robin basis. Context switching between threads involves saving and restoring the state of threads. This state includes not only the processor registers (the thread context) but also the address space accessible to the thread (the process context). The process context only needs switching if a reschedule is between threads in different processes.
每一个线程都设置了优先限权;在任何时候,只要线程已经准备就绪,具有高优先权的线程总是首先运行。如果线程具有相同的悠闲权,则根据时间片进行轮转调度。上下文的切换包括了保存和恢复线程状态。这个状态不仅仅包含了处理器寄存器(进程上下文)而且还包含了线程可访问的地址空间(进程上下文)。只有在重新调度是在两个进程间进行的时候,进程上下文才被切换。


Compare this with active objects which allow non pre-emptive multi-tasking within a single thread.
把这个与活动对象比较,活动对象允许在一个线程中实现非强占式的多任务调度。


A thread can suspend, resume, panic and kill another thread.
一个线程可以被挂起,唤醒、异常抛出和结束其他线程。

 

When a thread is created it is put into a suspended state, it does not begin to run until that thread’s Resume() member function is called.
线程被创建以后,它处于挂起状态。它没有马上进入运行状态,直到它的Resume()成员函数被调用。

 

When a thread is created, it is given the priority EPriorityNormal by default. The fact that a thread is initially put into a suspended state means that the thread priority can be changed (RThread::SetPriority()) before the thread is started (RThread::Resume()).
线程创建以后,它具有EPriorityNormal的默认优选级。线程被初始化并处于挂起状态,这意味着在线程开始运行前,线程的运行优先级可以被改变(通过调用RThread::SetPriority()) 。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值