06-processesBirthLifeDeath - Processes Copyright University...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Copyright ©: University of Illinois CS 241 Staff 1 Processes
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Processes What is a process? How do I make one? wait for one? kill one? Birth Life Death Copyright ©: University of Illinois CS 241 Staff 2
Background image of page 2
Program or Process? Process A process is the context (the information/data) maintained for an executing program An executable instance of a program A program can have many processes Each process has a unique identifier Unix processes Process #1 is known as the 'init' process (root of the process hierarchy) Copyright ©: University of Illinois CS 241 Staff 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What makes up a Process? Program code Machine registers Global data Stack Open files An environment Copyright ©: University of Illinois CS 241 Staff 4
Background image of page 4
Process Context Process ID ( pid ) unique integer Parent process ID ( ppid ) unique integer Current directory File descriptor table Environment VAR=VALUE pairs Pointer to program code Pointer to data Mem for global vars Pointer to stack Mem for local vars Pointer to heap Dynamically allocated memory Execution priority Signal information Copyright ©: University of Illinois CS 241 Staff 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Unix Processes Address space The address space is a section of memory that contains the code to execute as well as the process stack Set of data structures in the kernel to keep track of that process Address space map Current status of the process Execution priority of the process Resource usage of the process Current signal mask Owner of the process Copyright ©: University of Illinois CS 241 Staff 6
Background image of page 6
Process Lifetime Some processes run from system boot to shutdown Servers & Daemons (e.g. Apache httpd server) Most processes come and go rapidly, as tasks start and complete 'unit of work' on a modern computer A process can die a premature, even horrible death (say, due to a crash) Copyright ©: University of Illinois CS 241 Staff 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Know your process Each process has a unique identifier int myid = getpid() Copyright ©: University of Illinois CS 241 Staff 8 What is wrong with this?
Background image of page 8
Know your process better… pid_t myid = getpid() pid_t: int in linux, pid_t: long in other systems Know your parent pid_t myparentid = getppid() Copyright ©: University of Illinois CS 241 Staff 9
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Process Creation On creation, process needs resources CPU, memory, files, I/O devices Get resources from the OS or from the parent process Child process is restricted to a subset of parent resources Prevents many processes from overloading system Copyright ©: University of Illinois CS 241 Staff 10
Background image of page 10
Process Creation Execution Parent continues concurrently with child Parent waits until child has terminated Address space Child process is duplicate of parent process Child process has a new program loaded into it Copyright ©: University of Illinois CS 241 Staff 11
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/04/2010 for the course CS 373 taught by Professor Kuma during the Spring '10 term at University of Illinois at Urbana–Champaign.

Page1 / 39

06-processesBirthLifeDeath - Processes Copyright University...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online