1 / 5

Introduction to Unix Processes: MP3 Overview, Command Management, and Error Handling

In this section of CS.241, we explore key Unix shell concepts including MP3 overview, the `printf()` and `fgets()` functions, and handling process creation with `fork()`, `exec()`, and `wait()`. We provide practical examples showcasing how to execute non-built-in commands, manage error handling, and navigate directories using built-in commands. Understanding these concepts is crucial for developing efficient and functional Unix-based applications. You'll learn how to read commands from stdin and the importance of managing process execution in the Unix environment.

kevork
Download Presentation

Introduction to Unix Processes: MP3 Overview, Command Management, and Error Handling

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 241Section Week #4 02/16/12

  2. Topics This Section • MP3 overview • printf() / fgets(), getline() example • fork() / exec() / wait() example • strtok(), chdir() example

  3. MP3 • Simple Unix shell • Built-in commands • Change directory • Termination • History • Non built-in commands • Error handling • Concepts: process, fork, exec, wait

  4. Read the command from stdin • Let’s look at 1.c

  5. 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

More Related