5_processes - Part 5: Unix Processes CS252: Systems...

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

View Full Document Right Arrow Icon
Part 5: Unix Processes CS252: Systems Programming Ramana Kompella Computer Science Department Purdue University
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 q A process is a program in execution q A program may have multiple processes running the same program. E.g. csh running for multiple users or multiple times for the same user. q Each process will be a different instance of the same program. q All processes have a parent process except for the first process (init process 0). q To list processes use Ø ps - List processes of the current shell session Ø ps –u <your-login> - List processes owned by you Ø ps –e - List all processes of the system
Background image of page 2
Example of ps command brastius 636 % ps -e PID TTY TIME CMD 0 ? 0:17 sched 1 ? 0:08 init 2 ? 0:00 pageout 3 ? 112:48 fsflush 317 ? 0:00 xdm 218 ? 0:01 cron 248 ? 0:00 sendmail 57 ? 0:00 sysevent 72 ? 0:00 picld 140 ? 0:20 in.route 153 ? 2:17 sshd 158 ? 0:43 rpcbind
Background image of page 3

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

View Full DocumentRight Arrow Icon
States of a Process New Ready Running Waiting Terminated
Background image of page 4
States of a Process q New Ø Process is being initialized q Ready Ø The process is a candidate to run in the CPU but there is another process currently running q Running Ø The process is currently using the CPU. Ø The number of running processes is less than or equal to the number of CPUs q Waiting Ø Process is waiting for an event q Terminated Ø Process is exiting
Background image of page 5

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

View Full DocumentRight Arrow Icon
I/O and CPU Bound Process q I/O bound processes Ø Processes that are most of the time waiting for an event: mouse event, keyboard, Ethernet packet arrives etc. Ø This type of processes are mostly in waiting state . Ø These processes are in ready/running state only for a short period of time: E.g. update mouse cursor after mouse movement, show a character on the screen etc. q CPU bound process : Ø These processes need the CPU for long periods of time: Scientific/Numerical Applications, Compiler/Optimizer, Renderer, Image processing Ø These processes are mostly in ready or running state q Most applications are I/O bound
Background image of page 6
Process Table q Each process will be represented with an entry in the process table. q The Process Table is one of the most important data structures in the kernel. q The maximum number of entries in the process table determines the maximum number of processes in the system and it is set at boot time.
Background image of page 7

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

View Full DocumentRight Arrow Icon
Process Table Process ID (PID) 0 1 2 3 4 5 MAX PID-1 . . . Each Entry Includes: - PID: Index in process table -Command and args -Environment Vars -Current Dir -Owner (User ID) -Stdin/Stdout/Stderr -List of memory mappings used by process -PC (Program Counter) -Registers -Stack -List of Open Files -State (Wait, Ready, Running etc.)
Background image of page 8
Process Table q Each process table entry contains enough information to restart (put in running state) a process that is waiting or in ready state. q
Background image of page 9

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

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

This note was uploaded on 03/06/2012 for the course CS 252 taught by Professor Gustavorodriguez during the Spring '11 term at Purdue University-West Lafayette.

Page1 / 41

5_processes - Part 5: Unix Processes CS252: Systems...

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

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