Bài giảng Hệ điều hành nâng cao - Chapter 3: Processes
lượt xem 15
download
Bài giảng Hệ điều hành nâng cao - Chapter 3: Processes trình bày về khái niệm quy trình, lập kế hoạch quy trình, hoạt động trên quy trình, quy trình truyền thông, ví dụ về các hệ thống IPC, thông tin liên lạc trong hệ thống Client - Server,...Mời bạn đọc cùng tham khảo.
Bình luận(0) Đăng nhập để gửi bình luận!
Nội dung Text: Bài giảng Hệ điều hành nâng cao - Chapter 3: Processes
- Chapter 3: Processes Operating System Concepts – 8th Edition Operating System Concepts – 8th Edition 3.1 Silberschatz, Galvin and Gagne ©2009
- Chapter 3: Processes s Process Concept s Process Scheduling s Operations on Processes s Interprocess Communication s Examples of IPC Systems s Communication in Client-Server Systems Operating System Concepts – 8th Edition 3.2 Silberschatz, Galvin and Gagne ©2009
- Objectives s To introduce the notion of a process -- a program in execution, which forms the basis of all computation s To describe the various features of processes, including scheduling, creation and termination, and communication s To describe communication in client-server systems Operating System Concepts – 8th Edition 3.3 Silberschatz, Galvin and Gagne ©2009
- Process Concept s An operating system executes a variety of programs: q Batch system – jobs q Time-shared systems – user programs or tasks s Textbook uses the terms job and process almost interchangeably s Process – a program in execution; process execution must progress in sequential fashion s A process includes: q program counter q stack q data section Operating System Concepts – 8th Edition 3.4 Silberschatz, Galvin and Gagne ©2009
- The Process s Multiple parts q The program code, also called text section q Current activity including program counter, processor registers q Stack containing temporary data 4 Function parameters, return addresses, local variables q Data section containing global variables q Heap containing memory dynamically allocated during run time s Program is passive entity, process is active q Program becomes process when executable file loaded into memory s Execution of program started via GUI mouse clicks, command line entry of its name, etc s One program can be several processes q Consider multiple users executing the same program Operating System Concepts – 8th Edition 3.5 Silberschatz, Galvin and Gagne ©2009
- Process in Memory Operating System Concepts – 8th Edition 3.6 Silberschatz, Galvin and Gagne ©2009
- Process State s As a process executes, it changes state q new: The process is being created q running: Instructions are being executed q waiting: The process is waiting for some event to occur q ready: The process is waiting to be assigned to a processor q terminated: The process has finished execution Operating System Concepts – 8th Edition 3.7 Silberschatz, Galvin and Gagne ©2009
- Diagram of Process State Operating System Concepts – 8th Edition 3.8 Silberschatz, Galvin and Gagne ©2009
- Process Control Block (PCB) Information associated with each process s Process state s Program counter s CPU registers s CPU scheduling information s Memory-management information s Accounting information s I/O status information Operating System Concepts – 8th Edition 3.9 Silberschatz, Galvin and Gagne ©2009
- Process Control Block (PCB) Operating System Concepts – 8th Edition 3.10 Silberschatz, Galvin and Gagne ©2009
- CPU Switch From Process to Process Operating System Concepts – 8th Edition 3.11 Silberschatz, Galvin and Gagne ©2009
- Process Scheduling s Maximize CPU use, quickly switch processes onto CPU for time sharing s Process scheduler selects among available processes for next execution on CPU s Maintains scheduling queues of processes q Job queue – set of all processes in the system q Ready queue – set of all processes residing in main memory, ready and waiting to execute q Device queues – set of processes waiting for an I/O device q Processes migrate among the various queues Operating System Concepts – 8th Edition 3.12 Silberschatz, Galvin and Gagne ©2009
- Process Representation in Linux s Represented by the C structure task_struct pid t pid; /* process identifier */ long state; /* state of the process */ unsigned int time slice /* scheduling information */ struct task struct *parent; /* this process’s parent */ struct list head children; /* this process’s children */ struct files struct *files; /* list of open files */ struct mm struct *mm; /* address space of this pro */ Operating System Concepts – 8th Edition 3.13 Silberschatz, Galvin and Gagne ©2009
- Ready Queue And Various I/O Device Queues Operating System Concepts – 8th Edition 3.14 Silberschatz, Galvin and Gagne ©2009
- Representation of Process Scheduling Operating System Concepts – 8th Edition 3.15 Silberschatz, Galvin and Gagne ©2009
- Schedulers s Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue s Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU q Sometimes the only scheduler in a system Operating System Concepts – 8th Edition 3.16 Silberschatz, Galvin and Gagne ©2009
- Schedulers (Cont.) s Short-term scheduler is invoked very frequently (milliseconds) (must be fast) s Long-term scheduler is invoked very infrequently (seconds, minutes) (may be slow) s The long-term scheduler controls the degree of multiprogramming s Processes can be described as either: q I/O-bound process – spends more time doing I/O than computations, many short CPU bursts q CPU-bound process – spends more time doing computations; few very long CPU bursts Operating System Concepts – 8th Edition 3.17 Silberschatz, Galvin and Gagne ©2009
- Addition of Medium Term Scheduling Operating System Concepts – 8th Edition 3.18 Silberschatz, Galvin and Gagne ©2009
- Context Switch s 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 via a context switch. s Context of a process represented in the PCB s Context-switch time is overhead; the system does no useful work while switching q The more complex the OS and the PCB -> longer the context switch s Time dependent on hardware support q Some hardware provides multiple sets of registers per CPU -> multiple contexts loaded at once Operating System Concepts – 8th Edition 3.19 Silberschatz, Galvin and Gagne ©2009
- Process Creation s Parent process create children processes, which, in turn create other processes, forming a tree of processes s Generally, process identified and managed via a process identifier (pid) s Resource sharing q Parent and children share all resources q Children share subset of parent’s resources q Parent and child share no resources s Execution q Parent and children execute concurrently q Parent waits until children terminate Operating System Concepts – 8th Edition 3.20 Silberschatz, Galvin and Gagne ©2009
CÓ THỂ BẠN MUỐN DOWNLOAD
-
Bài giảng Hệ điều hành nâng cao - Chapter 5: CPU Scheduling
67 p | 135 | 14
-
Bài giảng Hệ điều hành nâng cao - Chapter 11: File System Implementation
63 p | 188 | 14
-
Bài giảng Hệ điều hành nâng cao - Chapter 19: Real - Time Systems
24 p | 101 | 13
-
Bài giảng Hệ điều hành nâng cao - Chapter 6: Process Synchronization
72 p | 202 | 11
-
Bài giảng Hệ điều hành nâng cao - Chapter 10: File - System Interface
43 p | 99 | 10
-
Bài giảng Hệ điều hành nâng cao - Chapter 12: Mass - Storage Systems
57 p | 166 | 10
-
Bài giảng Hệ điều hành nâng cao - Chapter 13: I/O Systems
42 p | 157 | 9
-
Bài giảng Hệ điều hành nâng cao - Chapter 2: Operating - System Structures
54 p | 176 | 9
-
Bài giảng Hệ điều hành nâng cao - Chapter 1: Introduction
48 p | 142 | 8
-
Bài giảng Hệ điều hành nâng cao - Chapter 4: Threads
45 p | 136 | 8
-
Bài giảng Hệ điều hành nâng cao - Chapter 21: The Linux System
62 p | 148 | 7
-
Bài giảng Hệ điều hành nâng cao - Chapter 20: Multimedia Systems
33 p | 129 | 6
-
Bài giảng Hệ điều hành nâng cao - Chapter 22: Windows XP
64 p | 93 | 6
-
Bài giảng Hệ điều hành nâng cao - Chapter 14: Protection
29 p | 77 | 5
-
Bài giảng Hệ điều hành nâng cao - Chapter 17: Distributed - File Systems
29 p | 87 | 5
-
Bài giảng Hệ điều hành nâng cao - Chapter 18: Distributed Coordination
54 p | 88 | 5
-
Bài giảng Hệ điều hành nâng cao - Chapter 16: Distributed System Structures
36 p | 103 | 4
Chịu trách nhiệm nội dung:
Nguyễn Công Hà - Giám đốc Công ty TNHH TÀI LIỆU TRỰC TUYẾN VI NA
LIÊN HỆ
Địa chỉ: P402, 54A Nơ Trang Long, Phường 14, Q.Bình Thạnh, TP.HCM
Hotline: 093 303 0098
Email: support@tailieu.vn