CS 241
This presentation is the property of its rightful owner.
Sponsored Links
1 / 5

CS 241 Section Week #4 PowerPoint PPT Presentation


  • 61 Views
  • Uploaded on
  • Presentation posted in: General

CS 241 Section Week #4. 02/16/12. Topics This Section. MP3 overview printf () / fgets () , getline () example fork() / exec() / wait() example s trtok (), chdir () example. MP3. Simple Unix shell Built-in commands Change directory Termination History Non built-in commands

Download Presentation

CS 241 Section Week #4

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Cs 241 section week 4

CS 241Section Week #4

02/16/12


Cs 241 section week 4

Topics This Section

  • MP3 overview

  • printf() / fgets(), getline() example

  • fork() / exec() / wait() example

  • strtok(), chdir() example


Cs 241 section week 4

MP3

  • Simple Unix shell

  • Built-in commands

    • Change directory

    • Termination

    • History

  • Non built-in commands

  • Error handling

  • Concepts: process, fork, exec, wait


Cs 241 section week 4

Read the command from stdin

  • Let’s look at 1.c


Cs 241 section week 4

Running Non Built-in Commands

  • Requires a new process to run the binary

    • Why?

    • fork() creates a new process

    • exec() runs executable

    • wait () makes the parent wait for the child to finish

  • Instead of using system() , we use fork + exec + wait


  • Login