欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > PPT文档下载  

    《进程管理英》PPT课件.ppt

    • 资源ID:5611276       资源大小:424.50KB        全文页数:38页
    • 资源格式: PPT        下载积分:15金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    《进程管理英》PPT课件.ppt

    Chapter 4:Processes,Process ConceptProcess SchedulingOperation on ProcessesCooperating ProcessesInterprocess Communication,Process Concept,An operating system executes a variety of programs:Batch system jobsTime-shared systems user programs or tasksTextbook uses the terms job and process almost interchangeably.Process a program in executionA process includes:program counterstack data section,Process Concept,国内学术界较为一致的定义:进程是一个具有一定独立功能的程序,关于某个数据集合的一次可以并发执行的运行活动。From Wikipedia In computing,a process is an instance of a computer program that is being sequentially executed by a computer system that has the ability to run several computer programs concurrently.,Process Concept,A single computer processor executes one or more instructions at a time(per clock cycle),one after the other.To allow users to run several programs at once,single-processor computer systems can perform multiprogramming and time-sharing.Using more than one physical processor on a computer,permits true simultaneous execution of more than one stream of instructions from different processes.Concurrency is the term generally used to refer to several independent processes sharing a single processorSimultaneously(or parallel)is used to refer to several processes,each with their own processor.,Process vs.Program,Dynamic/staticprocess is a program in execution,so it is dynamic,program is a passive collection of instuctions,so it is a static entity.Lify cycleprocess has a life cycle.It is an active entity in the sense that it can be created,executed,and terminated during its lifetime.Program can exist forever.Structureprocess=program+data+PCBEach process is represented in the OS by a process control block(PCB),it contains all information associated with a specific process.,Process vs.Program,No one-to-one mapping between processes and programscan have mulitple processes of the same programone process can invoke multiple programsProcess is the basic unit of being scheduled and resource allocation from the viewpoint of OS,while program can not be run without process creation.Process can be executed concurrently or simultaneously.,Process State,As a process executes,it changes statenew:The process is being created.running:Instructions are being executed.waiting:The process is waiting for some event to occur.ready:The process is waiting to be assigned to a processor.terminated:The process has finished execution.,Diagram of Process State,admitted,I/O or event completion,scheduler dispatch,I/O or event wait,interrupt,exit,Process Control Block(PCB),Information associated with each process:Process state Program counterCPU registers CPU scheduling informationMemory-management informationAccounting informationI/O status information,Process Control Block(PCB),CPU Switch From Process to Process,Chapter 4:Processes,Process ConceptProcess SchedulingOperation on ProcessesCooperating ProcessesInterprocess Communication,Process Scheduling,Process Scheduling QueuesJob queue set of all processes in the system.Ready queue set of all processes residing in main memory,ready and waiting to execute.Device queues set of processes waiting for an I/O device.Process migration between the various queues.,Ready Queue And Various I/O Device Queues,Representation of Process Scheduling,Schedulers,Long-term scheduler(or job scheduler)selects which processes should be brought into the ready queue.长程调度(或作业调度)Short-term scheduler(or CPU scheduler)selects which process should be executed next and allocates CPU.短程调度(或CPU调度),Addition of Medium Term Scheduling,Schedulers(Cont.),Short-term scheduler is invoked very frequently(milliseconds)(must be fast).调用频率高Long-term scheduler is invoked very infrequently(seconds,minutes)(may be slow).调用频率不高The long-term scheduler controls the degree of multiprogramming.长程调度控制了多道程序的“道数”Processes can be described as either:I/O-bound process spends more time doing I/O than computations,many short CPU bursts.CPU-bound process spends more time doing computations;few very long CPU bursts.,Context Switch上下文切换,When CPU switches to another process,the system must save the state of the old process and load the saved state for the new process.Context-switch time is overhead;the system does no useful work while switching.Time dependent on hardware support.,Process Creation,Parent process creates children processes,which,in turn create other processes,forming a tree of processes.Resource sharingParent and children share all resources.Children share subset of parents resources.Parent and child share no resources.ExecutionParent and children execute concurrently.Parent waits until children terminate.,Process Creation(Cont.),Address spaceChild duplicate of parent.Child has a program loaded into it.UNIX examplesfork system call creates new processexeclp system call used after a fork to replace the process memory space with a new program.,A Tree of Processes On A Typical UNIX System,Process Termination,Process executes last statement and asks the operating system to delete it(exit).Process resources are deallocated by operating system.Output data from child to parent(via wait).Parent may terminate execution of children processes Child has exceeded超过 allocated resources.Task assigned to child is no longer required.Parent is exiting.Operating system does not allow child to continue if its parent terminates.Cascading termination.级联终止,Cooperating Processes,Independent process cannot affect or be affected by the execution of another process.Cooperating process can affect or be affected by the execution of another processAdvantages of process cooperationInformation sharingComputation speed-upModularityConvenience,Producer-Consumer Problem,Paradigm for cooperating processes,producer process produces information that is consumed by a consumer process.unbounded-buffer places no practical limit on the size of the buffer.无界缓冲没有对缓冲区大小的限制bounded-buffer assumes that there is a fixed buffer size.有界缓冲对缓冲区大小作了限定,Bounded-Buffer Shared-Memory Solution,Shared datavar n;type item=;var buffer.array 0.n1 of item;in,out:0.n1;Producer process repeatproduce an item in nextpwhile in+1 mod n=out do no-op;buffer in:=nextp;in:=in+1 mod n;until false;,Bounded-Buffer(Cont.),Consumer process repeatwhile in=out do no-op;nextc:=buffer out;out:=out+1 mod n;consume the item in nextc until false;Solution is correct,but can only fill up n1 buffer.,Threads,A thread(or lightweight process)is a basic unit of CPU utilization;it consists of:program counterregister setstack spaceA thread shares with its peer threads its:code sectiondata sectionoperating-system resourcescollectively know as a task.整体作为一个任务,Threads(Cont.),In a multiple threaded task,while one server thread is blocked and waiting,a second thread in the same task can run.Cooperation of multiple threads in same job confers higher throughput and improved performance.Applications that require sharing a common buffer(i.e.,producer-consumer)benefit from thread utilization.Threads provide a mechanism that allows sequential processes to make blocking system calls while also achieving parallelism.Kernel-supported threads(Mach and OS/2).User-level threads;supported above the kernel,via a set of library calls at the user level.Hybrid approach implements both user-level and kernel-supported threads(Solaris 2).混合处理实现用户级和内核支持线程,Interprocess Communication-IPC,Mechanism for processes to communicate and to synchronize their actions.Message system processes communicate with each other without resorting to shared variables.IPC facility provides two operationssend(message)message size fixed or variablereceive(message)If P and Q wish to communicate,they need to:establish a communication link between themexchange messages via send/receiveImplementation of communication linkphysical(e.g.,shared memory,hardware bus)logical(e.g.,logical properties),Implementation Questions,How are links established?Can a link be associated with more than two processes?How many links can there be between every pair of communicating processes?What is the capacity of a link??Is the size of a message that the link can accommodate fixed or variable?Is a link unidirectional or bi-directional?,Direct Communication,Processes must name each other explicitly显式:send(P,message)send a message to process Preceive(Q,message)receive a message from process QProperties of communication linkLinks are established automatically.A link is associated with exactly one pair of communicating processes.Between each pair there exists exactly one link.The link may be unidirectional,but is usually bi-directional.,Indirect Communication,Messages are directed and received from mailboxes.Each mailbox has a unique id.Processes can communicate only if they share a mailbox.Properties of communication linkLink established only if processes share a common mailbox A link may be associated with many processes.Each pair of processes may share several communication links.Link may be unidirectional.al or bi-directional.Operationscreate a new mailboxsend and receive messages through mailboxdestroy a mailbox,Types of Mailbox,Private Mailbox:owner-Receive other user-SendPublic Mailbox:owned by OSShared Mailbox:created by a process,the ownership and privilege be passed to other processes,Synchronization,Blocking send:sender blocked until the message is receivedNonblocking send:send the message and resume operationBlocking receive:receiver blocked until a message is availableNonblocking receive:receiver retrieves either a valid message or null,Buffering,Queue of messages attached to the link;implemented in one of three ways.1.Zero capacity 0 messages Sender must wait for receiver.2.Bounded capacity finite length of n messages Sender must wait if link full.3.Unbounded capacity infinite length Sender never waits.,Exception Conditions Error Recovery,Process terminates 进程终止Lost messages 消息丢失Scrambled Messages 消息受损,Homework,P113 4.14.44.6,

    注意事项

    本文(《进程管理英》PPT课件.ppt)为本站会员(牧羊曲112)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开