COP4600_19-5-10 - Administrivia Read: chap 2 * HW due...

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

View Full Document Right Arrow Icon
Administrivia Read: chap 2 * HW due Friday (will be posted) Shell -- human interface to the OS Originally, they were command line interfaces (CLI's) but now a days, most people use graphical shells. A simple shell implementation: while ( 1 ) { display_prompt(); read_command( command, parameters ); if ( fork() != 0 ) { /* the value returned is the child's PID */ /* parent code*/ waitpid( -1, &status, 0 ); /* wait for child to exit */ } else { /* child code */ execvc( command, parameters, 0 ); /*execute command */ } } fork() - spawns a clone of the current process * the clone is executing the same code that the parent is running * returns an int - the parent gets either - negative int == the fork failed (no child spawned) - positive int == the int is the child's PID (Process ID) - the child process gets zero * both the parent and child continue executing from the point that fork() returns Don't do this… int main() { while ( 1 ) fork(); return 0; } //exponential processes, fine way to crash a computer! execXXX()
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.

Page1 / 5

COP4600_19-5-10 - Administrivia Read: chap 2 * HW due...

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