1 / 8

Understanding Process Management in Operating Systems

This chapter delves into the intricacies of process management in operating systems (OS). It explains the transformation of programs into running processes, the need for multitasking through CPU virtualization, and the principles of time-sharing. Key topics include scheduling policies, context switching, the machine state of a process, and the lifecycle of a process from creation to termination. The chapter also highlights the data structures utilized by the OS, including process control blocks (PCBs) and various process states, providing a comprehensive overview suitable for students and professionals in computer science.

Download Presentation

Understanding Process Management in Operating Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 4Process Abstraction Chien-Chung Shen CIS, UD cshen@cis.udel.edu

  2. Process • Process is a running program • A program itself is a lifeless thing sitting on disk with instructions (and static data) • OS transforms a program into a running process • Need to run many processes at once • Problem: how to provide the illusion of many CPUs? • virtualize the CPU – run one process, stop it, and then run another process, etc. • time sharing • scheduling policy & context switching mechanism

  3. Machine State of Process • Address space (including stack) http://www.cs.umd.edu/class/spring2003/cmsc311/Notes/Mips/stack.html • CPU registers (including PC, SP, FP) • Opened files

  4. Process API • Create – a process is created when an application icon is double-clicked • Destroy • Wait • Miscellaneous control – stop& resume • Status

  5. Process Creation • Load code and static data into memory (address space) • Initialize (run-time) stack with argc & argv • Initialize 3 default file descriptors (0, 1, and 2) • Jump to main()

  6. Process State (Life Cycle) • Running – using CPU • Ready – someone else is using CPU • Blocked – not ready until some other event takes place (e.g., initiate I/O request to disk)

  7. Data Structures of OS • OS is a program itself containing data structures • Process lists (or queues) • running queue (single CPU) • ready queue • I/O queues • PCB (Process Control Block) • register context • process state • for context switching

  8. PCB in xv6 Kernel struct context { // registers saved/restored in context switch inteip; intesp; intebx; intecx; intedx; intesi; intedi; intebp; }; enumproc_state// process state { UNUSED, EMBRYO, SLEEPING, RUNNABLE, RUNNING, ZOMBIE }; structproc { // PCB char *mem; uintsz; char *kstack; enumproc_statestate; intpid; structproc *parent; void *chan; intkilled; structfile *ofile[NOFILE]; structinode *cwd;structcontext context; structtrapframe *tf; };

More Related