Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems CMPSC 473

Similar presentations


Presentation on theme: "Operating Systems CMPSC 473"— Presentation transcript:

1 Operating Systems CMPSC 473
Processes August 26, 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 Interrupt vector for timer 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 Data Heap 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


Download ppt "Operating Systems CMPSC 473"

Similar presentations


Ads by Google