Presentation is loading. Please wait.

Presentation is loading. Please wait.

Module 2.2 COP4600 – Operating Systems Richard Newman

Similar presentations


Presentation on theme: "Module 2.2 COP4600 – Operating Systems Richard Newman"— Presentation transcript:

1 Module 2.2 COP4600 – Operating Systems Richard Newman
Process Basics Module 2.2 COP4600 – Operating Systems Richard Newman

2 Process States States a process may be in:
Running (actually using the CPU at that instant). Ready (runnable; temporarily stopped to let another process run). Blocked (unable to run until some external event happens). Initializing (system preparing process to run). Exiting (system cleaning up after process terminates). Swapped out & Blocked (image not in RAM, waiting for event) Swapped out & Ready (image not in RAM, not waiting for event) Tanenbaum & Bos,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.

3 Process States (3) Figure 2-3. The lowest layer of a process-structured operating system handles interrupts and scheduling. Above that layer are sequential processes. Tanenbaum & Bos,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.

4 Process Implementation
Resources associated with a process Process Management Process table entry – state and attributes Register values Memory Management Text (instructions), Data (Constants, Globals, Heap), Stack File Management Resource Segment – open files, pipes, devices, etc. Process Control Block (PCB) – all the control info about process

5 Implementation of Processes (1)
Figure 2-4. Some of the fields of a typical process table entry. Tanenbaum & Bos,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.

6 Implementation of Processes (1.5)
Figure 2-4. Some of the fields of the MINIX 3 process table. The fields are distributed over the kernel, the process manager, and the file system. Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved

7 Basic memory layout of a process
Figure (a) A program as stored in a disk file. (b) Internal memory layout for a single process. In both parts of the figure the lowest disk or memory address is at the bottom and the highest address is at the top. Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved

8 Basic memory layout of a process
As procedures are called and return, stack grows and shrinks Proc-1 called, activation frame pushed Proc-2 called, activation frame pushed Proc-2 returns, activation frame popped Proc-3 called, activation frame pushed Proc-3 returns, activation frame popped Proc-1 returns, activation frame popped Stack AF-1 Free AF-2 AF-3 Data Text

9 Context switches Process may give up CPU
Block on I/O or sleep Interrupt handling Processor sharing – multi-programming Save state of current process, set up state for process that is to be run next Special purpose registers General purpose registers Memory locations – text, data, stack, etc. Update process state – may no longer be running If handling an interrupt, process may not change state per system

10 Non-sequential events
Nonsequential events happen Interrupts Asynchronous event – clock/device signals CPU in hardware CPU controller checks for interrupts each FDE cycle (per mask) Signals Software interrupt – sent by another process Exceptions Software – explicitly raise exception when problem occurs Hardware – trap when problem occurs (overflow, DBZ, etc.)

11 Summary Process State (in big sense) Process memory layout
Process state (in scheduling sense) Memory – registers, memory segments Resources – open files, devices Process memory layout Context switches Asynchronous events


Download ppt "Module 2.2 COP4600 – Operating Systems Richard Newman"

Similar presentations


Ads by Google