Purchase Solution

Explain the C code and rearrange part of it

Not what you're looking for?

Ask Custom Question

I have two questions about the attached code and then a slight modification needs to be made to the code.

1. Please explain exactly what this code is doing as it is written right now.

2. Where is the code following (textually) the "switch" block executed - in the parent process or in the child process? The first instruction following the "switch" block is "act.sa_handler = setflag".

3. Change the code so that no code appears _textually_ after the "switch" block. All the code following the "switch" block must be placed somewhere else, yet the effect of the "tml" command must be the same.

Attachments
Purchase this Solution

Solution Summary

In question 2, it also explains "why" behind the answer.

Solution Preview

1. This code is creating a child process which first sets up a signal handler to process SIGALRM signals and then an alarm for minutes specified by the user as the first argument on command line. After that the child process pauses ...

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Networking Questions

This quiz consists of some basic networking questions.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.