进程与调度 (Processes and Scheduling).ppt

进程与调度 (Processes and Scheduling).ppt

CHAPTER 5 Concurrency: Mutual Exclusion and Synchronization (并发性:互斥和同步) Concurrency (并发性) Communication among processes Sharing of and competing (竟争)for resources Synchronization of the activities of multiple processes Allocation of processor time to processer Concurrency Multiple applications Multiprogramming Structured application Application can be a set of concurrent processes Operating-system structure Operating system is a set of processes or threads 5.1 PRINCIPLES OF NCURRENCY (并发的原理) Difficulties with Concurrency Sharing global resources Management of allocation of resources It become very difficult to locate a Programming errors A Simple Example procedure echo; Var out,in:character; begin input (in,keyboard); out: = in; output(out,display); end A Simple Example Process P1 Process P2 . . Input(in,keyboard) . . Input(in,keyboard) Out: = in out: = in Output(out,display) . . Output(out,display) . . Operating System Concerns (操作系统关注的问题) Keep track of active processes:PCB Allocate and deallocate resources Processor time:scheduling Memory:virtual memory Files I/O devices Protect data and resources Result of process must be independent of the speed of execution of other concurrent processes(应保证进程执行的结果与速度无关) Process Interaction Processes unaware of each other - Competition - Mutual exclusion, Deadlock, Starvation Processes indirectly aware of each other - Cooperation by sharing - Mutual exclusion, Deadlock, Starvation, Data coherence(一致性) Process directly aware of each other - Cooperation by communication - Deadlock, Starvation 表5.1进程的交互 Competition Among Processes for Resources Mutual Exclusion(互斥) Critical sections(临界区) Only one program at a time is allowed in its critical section (一次仅允许一个进程在临界区) Example only one process at a time is allowed to send command to the printer(critical resource)(例如一次仅允许一个进程发打印命令) Deadlock(死锁) Starvation Competition Among Proce

文档评论(0)

1亿VIP精品文档

相关文档