1 / 13

Operating Systems CMPSC 473

Operating Systems CMPSC 473. Processes August 26, 2010 - Lecture 2 Instructor: Bhuvan Urgaonkar. Last class. Definition of an operating system Software that virtualizes physical resources for applications CPU, memory, IO devices virtualized to process, virtual memory, and files

jharpole
Télécharger la présentation

Operating Systems CMPSC 473

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. Operating SystemsCMPSC 473 Processes August 26, 2010 - Lecture 2 Instructor: Bhuvan Urgaonkar

  2. Last class • Definition of an operating system • Software that virtualizes physical resources for applications • CPU, memory, IO devices virtualized to process, virtual memory, and files • OS requires a variety of support from hardware • For protecting processes from each other and to control their resource usage -> User/Kernel Modes

  3. Announcements • A brief tutorial on using gdb in the next class • Slides up on Angel

  4. Services & Hardware Support • Protection: Kernel/User mode, Protected Instructions, Base & Limit Registers • Scheduling: Timer • Interrupts: Interrupt Vectors • System Calls: Trap Instructions • Efficient I/O: Interrupts, Memory-mapping • Synchronization: Atomic Instructions • Virtual Memory: Translation Lookaside Buffer (TLB)

  5. Interrupts • Polling = “are we there yet?” “no!” (repeat…) • Inefficient use of resources • Annoys the CPU • Interrupt = silence, then: “we’re there” • I/O device has own processor • When finished, device sends interrupt on bus • CPU “handles” interrupt

  6. CPU Interrupt Handling • Handling interrupts: relatively expensive • CPU must: • Save hardware state • Registers, program counter • (Often) disable interrupts (why?) • Invoke via in-memory interrupt vector (like trap vector, soon) • Enable interrupts • Restore hardware state • Continue execution of interrupted process

  7. Traps • Special conditions detected by architecture • E.g.: page fault, write to read-only page, overflow, system call • On detecting trap, hardware must: • Save process state (PC, stack, etc.) • Transfer control to trap handler (in OS) • CPU indexes trap vector by trap number • Jumps to address • Restore process state and resume

  8. Timer • OS needs timers for • Time of day • CPU scheduling • Interrupt vector for timer

  9. Processes

  10. Process: Definition • For us: Instance of a program in execution • For OS: The collection of data structures that fully describes how far the execution of the program has progressed • From kernel’s point of view, an entity to which system resources (CPU time, memory, …) are allocated

  11. Overview of Process-related Topics • How a process is born • Parent/child relationship • fork, clone, … • How it leads its life • Loaded: Later in the course • Executed • CPU scheduling • Where a process “lives”: Address space • OS maintains some info. for each process: PCB • Process = Address Space + PCB • How processes request services from the OS • System calls • How processes communicate • A variant of processes: threads • How processes die

  12. Process Address Space • Text section • Stack • Temporary data • Function params, return addresses, local variables • Data • Global variables • Heap • Used for dynamically allocating memory

  13. Process Life-cycle • New: Being created • Running: Instructions are being executed • Only one process can be in this state at any given time per-CPU • Waiting: Waiting for some event to occur (e.g., I/O completion or reception of a signal) • Ready: Waiting to be assigned the CPU • Terminated: Finished execution

More Related