intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Bài giảng Hệ điều hành nâng cao - Chapter 3: Processes

Chia sẻ: Xaydung K23 | Ngày: | Loại File: PPTX | Số trang:54

139
lượt xem
15
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

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.

Chủ đề:
Lưu

Nội dung Text: Bài giảng Hệ điều hành nâng cao - Chapter 3: Processes

  1. Chapter 3: Processes Operating System Concepts – 8th Edition Operating System Concepts – 8th Edition 3.1 Silberschatz, Galvin and Gagne ©2009
  2. 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
  3. 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
  4. 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
  5. 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
  6. Process in Memory Operating System Concepts – 8th Edition 3.6 Silberschatz, Galvin and Gagne ©2009
  7. 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
  8. Diagram of Process State Operating System Concepts – 8th Edition 3.8 Silberschatz, Galvin and Gagne ©2009
  9. 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
  10. Process Control Block (PCB) Operating System Concepts – 8th Edition 3.10 Silberschatz, Galvin and Gagne ©2009
  11. CPU Switch From Process to Process Operating System Concepts – 8th Edition 3.11 Silberschatz, Galvin and Gagne ©2009
  12. 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
  13. 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
  14. Ready Queue And Various I/O Device Queues Operating System Concepts – 8th Edition 3.14 Silberschatz, Galvin and Gagne ©2009
  15. Representation of Process Scheduling Operating System Concepts – 8th Edition 3.15 Silberschatz, Galvin and Gagne ©2009
  16. 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
  17. 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
  18. Addition of Medium Term Scheduling Operating System Concepts – 8th Edition 3.18 Silberschatz, Galvin and Gagne ©2009
  19. 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
  20. 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
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2