CSC_Final_Study_Guide_2

CSC_Final_Study_Guide_2 - Creating Processes and ICP -A...

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

View Full Document Right Arrow Icon
Creating Processes and ICP -int system (char *cmd) -A process is the memory image + the state of a single executing program -Execute cmd and wait for child process to terminate -Process information includes a unique process ID, or ‘pid’ -Returns the exit status of the shell printf(”\nThis is the parent again" -Every process except the OS is spawned by another process (its ‘parent’) (code) printf("This is the parent\n\n"); -Process information includes PID, Parent PID, Amount of memory used (virtual and real), int result = system("ls -al"); State of process, Priority, Controlling terminal, Command name, User, Group, etc… printf(”\nThis is the parent again, result was %d\n", result); -getpid() returns the pid of the running process (output) This is the parent int pid = getpid(); *Lists Directory” -exit( status ) returns an exit status to the parent process This is the parent again, result was 0 -by convention, 0 means "normal termination” -FILE *popen(char *command, char *type) -execlp() creates another process, without returning control to this one -Creates a process for the command specified in *command, and opens a -execlp(char * cmd, char *arg0, char *arg1, . .., 0);
Background image of page 1

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

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

This note was uploaded on 04/28/2009 for the course CSC 230 taught by Professor Freeh during the Spring '08 term at N.C. State.

Page1 / 2

CSC_Final_Study_Guide_2 - Creating Processes and ICP -A...

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

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